修改为单屏

This commit is contained in:
2025-09-26 11:23:55 +08:00
parent aa43943f33
commit 0884292626
11 changed files with 223 additions and 420 deletions

View File

@@ -1,23 +1,23 @@
{ {
"Time": "10:00:00", "Time": "10:00:00", /* */
"TimeSize": 44, "TimeSize": 44, /* */
"Charger": "刘华强", "Charger": "刘华强", /* */
"ChargerSize": 44, "ChargerSize": 44, /* */
"RiskLevel": "高", "RiskLevel": "高", /* */
"RiskLevelSize": 44, "RiskLevelSize": 44, /* */
"Content": "1、 负责组织项目开工前的准备工作,按照施工图总平面布置确定所建建筑物位置,复合定位、标高。安排临时道路铺设工作。参与工程技术管理,配合总工程师编制项目部施工生产计划\r\n2、认真会审施工图纸掌握设计意图严格按图施工。在实际施工中发现设计图纸不能满足实用要求时要及时向领导报告按规定办理设计变更手续", "Content": "1、 负责组织项目开工前的准备工作,按照施工图总平面布置确定所建建筑物位置,复合定位、标高。安排临时道路铺设工作。参与工程技术管理,配合总工程师编制项目部施工生产计划;\r\n2、认真会审施工图纸掌握设计意图严格按图施工。在实际施工中发现设计图纸不能满足实用要求时要及时向领导报告按规定办理设计变更手续", /* */
"ContentSize": 44, "ContentSize": 35, /* */
"DangerPoint": "高空作业的安全风险\r\n化学品使用风险", "DangerPoint": "高空作业的安全风险,化学品使用风险", /* */
"DangerPointSize": 44, "DangerPointSize": 35, /* */
"Measures": "1.佩戴个人防护装备:所有高空作业人员必须佩戴符合国家标准的安全帽、安全带、防滑鞋等个人防护装备,并定期检查这些设备的完好性\r\n2.设置安全设施:在可能坠落的高度处安装安全网、护栏和踢脚板,以防止施工人员意外跌落,并避免小物件掉落伤人。\r\n3.进行安全技术交底:在施工前,必须进行针对性的书面安全交底,确保所有参与人员了解安全技术措施和个人防护要求。", "Measures": "1.佩戴个人防护装备:所有高空作业人员必须佩戴符合国家标准的安全帽、安全带、防滑鞋等个人防护装备,并定期检查这些设备的完好性;\r\n2.设置安全设施:在可能坠落的高度处安装安全网、护栏和踢脚板,以防止施工人员意外跌落,并避免小物件掉落伤人。\r\n3.进行安全技术交底:在施工前,必须进行针对性的书面安全交底,确保所有参与人员了解安全技术措施和个人防护要求。", /* */
"MeasuresSize": 44, "MeasuresSize": 35, /* */
"CPCMember1Path": "/Upload/0.jpg", "CPCMember1Path": "/Upload/0.jpg", /* 1 */
"CPCMember1Name": "张三", "CPCMember1Name": "张三", /* 1 */
"CPCMember2Path": "/Upload/0.jpg", "CPCMember2Path": "/Upload/0.jpg", /* 2 */
"CPCMember2Name": "李四", "CPCMember2Name": "李四", /* 2 */
"CPCMember3Path": "/Upload/0.jpg", "CPCMember3Path": "/Upload/0.jpg", /* 3 */
"CPCMember3Name": "王五", "CPCMember3Name": "王五", /* 3 */
"CPCMember4Path": "/Upload/0.jpg", "CPCMember4Path": "/Upload/0.jpg", /* 4 */
"CPCMember4Name": "赵六", "CPCMember4Name": "赵六", /* 4 */
"CPCMemberSize": 44 "CPCMemberSize": 35 /* */
} }

View File

@@ -1,7 +1,8 @@
<Application x:Class="电子展板.App" <Application x:Class="电子展板.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:电子展板" > xmlns:local="clr-namespace:电子展板"
StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -13,16 +13,7 @@ namespace 电子展板
{ {
public App() public App()
{ {
} }
protected override void OnStartup(StartupEventArgs e)
{
MainWindow mainWindow = new MainWindow();
mainWindow.Show();
MainWindow2 mainWindow2 = new MainWindow2();
mainWindow2.Show();
base.OnStartup(e);
}
} }
} }

View File

@@ -146,7 +146,7 @@
</div> </div>
<div style="width: 132px;margin-left:100px"> <div style="width: 132px;margin-left:100px">
<div class="layui-upload-list"> <div class="layui-upload-list">
<img class="layui-upload-img" id="image1" style="width: 100%; height: 92px;" /> <img class="layui-upload-img" id="image1" style="width: 100%; height: 150px;" />
<div id="upload-text1"></div> <div id="upload-text1"></div>
</div> </div>
<!--<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-progress1"> <!--<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-progress1">
@@ -175,7 +175,7 @@
</div> </div>
<div style="width: 132px;margin-left:100px"> <div style="width: 132px;margin-left:100px">
<div class="layui-upload-list"> <div class="layui-upload-list">
<img class="layui-upload-img" id="image2" style="width: 100%; height: 92px;" /> <img class="layui-upload-img" id="image2" style="width: 100%; height: 150px;" />
<div id="upload-text2"></div> <div id="upload-text2"></div>
</div> </div>
<!--<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-progress2"> <!--<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-progress2">
@@ -204,7 +204,7 @@
</div> </div>
<div style="width: 132px;margin-left:100px"> <div style="width: 132px;margin-left:100px">
<div class="layui-upload-list"> <div class="layui-upload-list">
<img class="layui-upload-img" id="image3" style="width: 100%; height: 92px;" /> <img class="layui-upload-img" id="image3" style="width: 100%; height: 150px;" />
<div id="upload-text3"></div> <div id="upload-text3"></div>
</div> </div>
<!--<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-progress3"> <!--<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-progress3">
@@ -233,7 +233,7 @@
</div> </div>
<div style="width: 132px;margin-left:100px"> <div style="width: 132px;margin-left:100px">
<div class="layui-upload-list"> <div class="layui-upload-list">
<img class="layui-upload-img" id="image4" style="width: 100%; height: 92px;" /> <img class="layui-upload-img" id="image4" style="width: 100%; height: 150px;" />
<div id="upload-text4"></div> <div id="upload-text4"></div>
</div> </div>
<!--<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-progress4"> <!--<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-progress4">

View File

@@ -9,6 +9,7 @@
xmlns:vm="clr-namespace:电子展板.ViewModels" xmlns:vm="clr-namespace:电子展板.ViewModels"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowStyle="None" WindowStyle="None"
WindowState="Maximized"
mc:Ignorable="d" mc:Ignorable="d"
x:Name="window" x:Name="window"
Title="MainWindow" Background="#E5E5E5"> Title="MainWindow" Background="#E5E5E5">
@@ -27,69 +28,82 @@
<Viewbox Stretch="Uniform" > <Viewbox Stretch="Uniform" >
<Canvas Width="1920" Height="1080"> <Canvas Width="1920" Height="1080">
<Grid Width="1920" Height="1080"> <Grid Width="1920" Height="1080">
<Grid.RowDefinitions> <TextBlock Text="时间:" FontSize="50" Foreground="#1F7572" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="95,18,0,0"/>
<RowDefinition Height="80"/> <Border Background="#C0E3D9" CornerRadius="20" Height="80" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="250,12,0,0" Width="277">
<RowDefinition Height="*"/> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{Binding Config.TimeSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.Time}"/>
</Grid.RowDefinitions> </Border>
<Grid Grid.Row="1">
<Grid.RowDefinitions> <TextBlock Text="负责人:" FontSize="50" Foreground="#1F7572" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="718,18,0,0"/>
<RowDefinition Height="140"/> <Border Background="#C0E3D9" CornerRadius="20" Height="80" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="925,10,0,0" Width="263">
<RowDefinition Height="80"/> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{Binding Config.ChargerSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.Charger}" />
<RowDefinition Height="*"/> </Border>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions> <TextBlock Text="风险等级:" FontSize="50" Foreground="#1F7572" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="1335,18,0,0"/>
<ColumnDefinition Width="50"/> <Border Background="#C0E3D9" CornerRadius="20" Height="85" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="1620,7,0,0" Width="240">
<ColumnDefinition Width="6*"/> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{Binding Config.RiskLevelSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.RiskLevel}"/>
<ColumnDefinition Width="8*"/> </Border>
<ColumnDefinition Width="6*"/> <TextBlock Text="工作内容" FontSize="50" Foreground="#1F7572" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="145,116,0,0"/>
<ColumnDefinition Width="50"/> <Border Background="#C0E3D9" CornerRadius="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="35,205,0,0" Width="485" Height="820" >
</Grid.ColumnDefinitions> <TextBlock HorizontalAlignment="Left" Margin="10" VerticalAlignment="Top" FontSize="{Binding Config.ContentSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.Content}"/>
<Grid Grid.Row="0" Grid.Column="1"> </Border>
<Grid>
<Grid.ColumnDefinitions> <TextBlock Text="危险点" FontSize="50" Foreground="#1F7572" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="636,116,0,0" Height="65" Width="164"/>
<ColumnDefinition Width="180"/> <Border Background="#C0E3D9" CornerRadius="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="541,205,0,0" Height="820" Width="394">
<ColumnDefinition Width="*"/> <TextBlock Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{Binding Config.DangerPointSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.DangerPoint}"/>
</Grid.ColumnDefinitions> </Border>
<TextBlock Text="时间:" Grid.Column="0" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/> <TextBlock Text="重点管控措施" FontSize="50" Foreground="#1F7572" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="1005,130,0,0" Height="65" Width="339"/>
<Border Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Height="140"> <Border Background="#C0E3D9" CornerRadius="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="960,205,0,0" Height="820" Width="455">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{Binding Config.TimeSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.Time}"/> <TextBlock Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{Binding Config.MeasuresSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.Measures}"/>
</Border> </Border>
</Grid>
<TextBlock Text="党员亮身份" FontSize="50" Foreground="#1F7572" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="1540,130,0,0" Height="65" Width="320"/>
<Border Background="#C0E3D9" CornerRadius="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="1452,205,0,0" Height="385" Width="223">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Image Margin="10" Source="{Binding Image1}" Stretch="Uniform" />
<TextBlock Text="{Binding Config.CPCMember1Name}" Grid.Row="1" FontSize="{Binding Config.CPCMemberSize}" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
</Grid> </Grid>
<Grid Grid.Row="0" Grid.Column="2" Margin="40,0,0,0"> </Border>
<Grid> <Border Background="#C0E3D9" CornerRadius="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="1687,205,0,0" Height="385" Width="223">
<Grid.ColumnDefinitions> <Grid>
<ColumnDefinition Width="240"/> <Grid.RowDefinitions>
<ColumnDefinition Width="*"/> <RowDefinition Height="*"/>
</Grid.ColumnDefinitions> <RowDefinition Height="80"/>
<TextBlock Text="负责人:" Grid.Column="0" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/> </Grid.RowDefinitions>
<Border Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Height="140"> <Image Margin="10" Source="{Binding Image2}" Stretch="Uniform" />
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{Binding Config.ChargerSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.Charger}"/> <TextBlock Text="{Binding Config.CPCMember2Name}" Grid.Row="1" FontSize="{Binding Config.CPCMemberSize}" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
</Border>
</Grid>
</Grid> </Grid>
<Grid Grid.Row="0" Grid.Column="3" Margin="40,0,0,0"> </Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="270"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> <Border Background="#C0E3D9" CornerRadius="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="1452,635,0,0" Height="385" Width="223">
<TextBlock Text="风险等级:" Grid.Column="0" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/> <Grid>
<Border Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Height="140"> <Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{Binding Config.RiskLevelSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.RiskLevel}"/> <RowDefinition Height="*"/>
</Border> <RowDefinition Height="80"/>
</Grid> </Grid.RowDefinitions>
<Image Margin="10" Source="{Binding Image3}" Stretch="Uniform" />
<TextBlock Text="{Binding Config.CPCMember3Name}" Grid.Row="1" FontSize="{Binding Config.CPCMemberSize}" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
</Grid> </Grid>
<TextBlock Grid.Row="1" Grid.Column="1" Text="工作内容:" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/> </Border>
<Border Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Background="#C0E3D9" CornerRadius="20" Margin="0,40,0,40"> <Border Background="#C0E3D9" CornerRadius="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="1687,635,0,0" Height="385" Width="223">
<TextBlock HorizontalAlignment="Left" Margin="10" VerticalAlignment="Top" FontSize="{Binding Config.ContentSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.Content}"/> <Grid>
</Border> <Grid.RowDefinitions>
</Grid> <RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Image Margin="10" Source="{Binding Image4}" Stretch="Uniform" />
<TextBlock Text="{Binding Config.CPCMember4Name}" Grid.Row="1" FontSize="{Binding Config.CPCMemberSize}" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
</Grid>
</Border>
</Grid> </Grid>
</Canvas> </Canvas>
</Viewbox> </Viewbox>
</Grid> </Grid>

View File

@@ -1,110 +0,0 @@
<Window xmlns:hc="https://handyorg.github.io/handycontrol" x:Class="电子展板.MainWindow2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:电子展板"
xmlns:vm="clr-namespace:电子展板.ViewModels"
ResizeMode="NoResize"
WindowStyle="None"
x:Name="window"
mc:Ignorable="d"
Title="MainWindow" Background="#E5E5E5">
<Window.DataContext>
<vm:MainWindow2ViewModel/>
</Window.DataContext>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding LoadedCommand}" CommandParameter="{Binding ElementName=window}"/>
</i:EventTrigger>
<i:EventTrigger EventName="Closing">
<i:InvokeCommandAction Command="{Binding WindowClosingCommand}" PassEventArgsToCommand="True"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Grid>
<Viewbox Stretch="Uniform" >
<Canvas Width="1920" Height="1080">
<Grid Width="1920" Height="1080">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="70"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="460"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBlock Text="危险点" Grid.Row="1" Grid.Column="1" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0"/>
<TextBlock Text="重点管控措施" Grid.Row="1" Grid.Column="2" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0"/>
<TextBlock Text="党员亮身份" Grid.Row="1" Grid.Column="3" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0"/>
<Border Grid.Row="2" Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Margin="0,20,20,50">
<TextBlock Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{Binding Config.DangerPointSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.DangerPoint}"/>
</Border>
<Border Grid.Row="2" Grid.Column="2" Background="#C0E3D9" CornerRadius="20" Margin="25,20,20,50">
<TextBlock Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{Binding Config.MeasuresSize}" Foreground="Black" TextWrapping="Wrap" Text="{Binding Config.Measures}"/>
</Border>
<Grid Grid.Row="2" Grid.Column="3" Margin="20,20,0,50">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Grid.Column="0" Background="#C0E3D9" CornerRadius="20" Margin="10,0,5,5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Image Margin="10" Source="{Binding Image1}" Stretch="Uniform" />
<TextBlock Text="{Binding Config.CPCMember1Name}" Grid.Row="1" FontSize="{Binding Config.CPCMemberSize}" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
</Grid>
</Border>
<Border Grid.Row="0" Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Margin="5,0,10,5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Image Margin="10" Source="{Binding Image2}" Stretch="Uniform" />
<TextBlock Text="{Binding Config.CPCMember2Name}" Grid.Row="1" FontSize="{Binding Config.CPCMemberSize}" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
</Grid>
</Border>
<Border Grid.Row="1" Grid.Column="0" Background="#C0E3D9" CornerRadius="20" Margin="10,5,5,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Image Margin="10" Source="{Binding Image3}" Stretch="Uniform" />
<TextBlock Text="{Binding Config.CPCMember3Name}" Grid.Row="1" FontSize="{Binding Config.CPCMemberSize}" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
</Grid>
</Border>
<Border Grid.Row="1" Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Margin="5,5,10,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Image Margin="10" Source="{Binding Image4}" Stretch="Uniform" />
<TextBlock Text="{Binding Config.CPCMember4Name}" Grid.Row="1" FontSize="{Binding Config.CPCMemberSize}" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
</Grid>
</Border>
</Grid>
</Grid>
</Canvas>
</Viewbox>
</Grid>
</Window>

View File

@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace
{
/// <summary>
/// MainWindow2.xaml 的交互逻辑
/// </summary>
public partial class MainWindow2 : Window
{
public MainWindow2()
{
InitializeComponent();
}
}
}

View File

@@ -122,44 +122,47 @@ namespace 电子展板.Models
/// 转换成JSON字符串 /// 转换成JSON字符串
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public string ToJson() //public string ToJson()
{ //{
StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
sb.AppendLine("{"); // sb.AppendLine("{");
//得到所有的Property // //得到所有的Property
var properties = GetType().GetProperties(); // var properties = GetType().GetProperties();
for (int i = 0; i < properties.Length; i++) // for (int i = 0; i < properties.Length; i++)
{ // {
var property = properties[i]; // var property = properties[i];
string endChar = ","; // string endChar = ",";
if (i == properties.Length - 1) // if (i == properties.Length - 1)
{ // {
endChar = ""; // endChar = "";
} // }
var comment = property.GetCustomAttributes(typeof(CommentAttribute), false).FirstOrDefault() as CommentAttribute; // var comment = property.GetCustomAttributes(typeof(CommentAttribute), false).FirstOrDefault() as CommentAttribute;
string commentText = ""; // string commentText = "";
if (comment != null) // if (comment != null)
{ // {
commentText = $" /* {comment.Comment} */"; // commentText = $" /* {comment.Comment} */";
} // }
string propertyName = property.Name; // string propertyName = property.Name;
var value = property.GetValue(this, null); // var value = property.GetValue(this, null);
if (value != null) // if (value != null)
{ // {
var valueType = value.GetType(); // var valueType = value.GetType();
if (valueType == typeof(string)) // if (valueType == typeof(string))
{ // {
sb.AppendLine($" \"{propertyName}\":\"{value}\"{endChar}{commentText}"); // string value1 = (string)value;
} // value1 = value1.Replace("\"", "\\\"");
else // value1 = value1.Replace("\r\n", "\\r\\n");
{ // sb.AppendLine($" \"{propertyName}\":\"{value1}\"{endChar}{commentText}");
sb.AppendLine($" \"{propertyName}\":{value}{endChar}{commentText}"); // }
} // else
} // {
} // sb.AppendLine($" \"{propertyName}\":{value}{endChar}{commentText}");
sb.AppendLine("}"); // }
return sb.ToString(); // }
} // }
// sb.AppendLine("}");
// return sb.ToString();
//}
} }

View File

@@ -1,142 +0,0 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using .Base;
using .Utility;
using .Utility.Extension;
namespace .ViewModels
{
public class MainWindow2ViewModel : ViewModelBase
{
private Window window;
public DelegateCommand<Window> LoadedCommand { get; set; }
public DelegateCommand<CancelEventArgs> WindowClosingCommand { get; set; }
public ImageSource Image1 { get; set; }
public ImageSource Image2 { get; set; }
public ImageSource Image3 { get; set; }
public ImageSource Image4 { get; set; }
public MainWindow2ViewModel()
{
LoadedCommand = new DelegateCommand<Window>(Loaded);
WindowClosingCommand = new DelegateCommand<CancelEventArgs>(WindowClosing);
EventBus.Instance.Subscribe(this, "save", ReloadImage);
InitImage();
}
private void ReloadImage(string obj)
{
App.Current.Dispatcher.Invoke(() =>
{
InitImage();
});
}
private void InitImage()
{
try
{
BitmapImage image1 = new BitmapImage();
image1.BeginInit();
image1.CacheOption = BitmapCacheOption.OnLoad;
image1.StreamSource = new MemoryStream(File.ReadAllBytes(MyEnvironment.Root(Config.CPCMember1Path)));
image1.EndInit();
image1.Freeze();
Image1 = image1;
}
catch (Exception ex)
{
Image1 = null;
}
try
{
BitmapImage image2 = new BitmapImage();
image2.BeginInit();
image2.CacheOption = BitmapCacheOption.OnLoad;
image2.StreamSource = new MemoryStream(File.ReadAllBytes(MyEnvironment.Root(Config.CPCMember2Path)));
image2.EndInit();
image2.Freeze();
Image2 = image2;
}
catch (Exception ex)
{
Image2 = null;
}
try
{
BitmapImage image3 = new BitmapImage();
image3.BeginInit();
image3.CacheOption = BitmapCacheOption.OnLoad;
image3.StreamSource = new MemoryStream(File.ReadAllBytes(MyEnvironment.Root(Config.CPCMember3Path)));
image3.EndInit();
image3.Freeze();
Image3 = image3;
}
catch (Exception ex)
{
Image3 = null;
}
try
{
BitmapImage image4 = new BitmapImage();
image4.BeginInit();
image4.CacheOption = BitmapCacheOption.OnLoad;
image4.StreamSource = new MemoryStream(File.ReadAllBytes(MyEnvironment.Root(Config.CPCMember4Path)));
image4.EndInit();
image4.Freeze();
Image4 = image4;
}
catch (Exception ex)
{
Image4 = null;
}
}
private void Loaded(Window window)
{
this.window = window;
Screen[] screens = Screen.AllScreens;
if (screens.Length > 1)
{
int screenIndex = 1;
this.window.Left = (int)(Screen.AllScreens[screenIndex].Bounds.Left / GetDpiScaleX());
this.window.Top = (int)(Screen.AllScreens[screenIndex].Bounds.Top / GetDpiScaleX());
this.window.Width = (int)(Screen.AllScreens[screenIndex].Bounds.Width / GetDpiScaleX());
this.window.Height = (int)(Screen.AllScreens[screenIndex].Bounds.Height / GetDpiScaleX());
}
else
{
window.Close();
}
}
/// <summary>
/// 界面关闭时
/// </summary>
public void WindowClosing(CancelEventArgs args)
{
GlobalVariable.WebServer?.Stop();
GlobalVariable.WebServer?.Dispose();
GlobalVariable.WebServer = null;
Screen[] screens = Screen.AllScreens;
if (screens.Length > 1)
{
Environment.Exit(0);
}
}
public double GetDpiScaleX()
{
return VisualTreeHelper.GetDpi(this.window).DpiScaleX;
}
}
}

View File

@@ -4,25 +4,35 @@ using Nancy.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging;
using .Base; using .Base;
using .Utility;
using .Utility.Extension;
namespace .ViewModels namespace .ViewModels
{ {
public class MainWindowViewModel : ViewModelBase public class MainWindowViewModel : ViewModelBase
{ {
private Window window; private Window window;
public ImageSource Image1 { get; set; }
public ImageSource Image2 { get; set; }
public ImageSource Image3 { get; set; }
public ImageSource Image4 { get; set; }
public DelegateCommand<Window> LoadedCommand { get; set; } public DelegateCommand<Window> LoadedCommand { get; set; }
public DelegateCommand<CancelEventArgs> WindowClosingCommand { get; set; } public DelegateCommand<CancelEventArgs> WindowClosingCommand { get; set; }
public MainWindowViewModel() public MainWindowViewModel()
{ {
LoadedCommand = new DelegateCommand<Window>(Loaded); LoadedCommand = new DelegateCommand<Window>(Loaded);
WindowClosingCommand = new DelegateCommand<CancelEventArgs>(WindowClosing); WindowClosingCommand = new DelegateCommand<CancelEventArgs>(WindowClosing);
EventBus.Instance.Subscribe(this, "save", ReloadImage);
InitImage();
} }
private void Loaded(Window window) private void Loaded(Window window)
@@ -48,5 +58,75 @@ namespace 电子展板.ViewModels
{ {
return VisualTreeHelper.GetDpi(this.window).DpiScaleX; return VisualTreeHelper.GetDpi(this.window).DpiScaleX;
} }
private void ReloadImage(string obj)
{
App.Current.Dispatcher.Invoke(() =>
{
InitImage();
});
}
private void InitImage()
{
try
{
BitmapImage image1 = new BitmapImage();
image1.BeginInit();
image1.CacheOption = BitmapCacheOption.OnLoad;
image1.StreamSource = new MemoryStream(File.ReadAllBytes(MyEnvironment.Root(Config.CPCMember1Path)));
image1.EndInit();
image1.Freeze();
Image1 = image1;
}
catch (Exception ex)
{
Image1 = null;
}
try
{
BitmapImage image2 = new BitmapImage();
image2.BeginInit();
image2.CacheOption = BitmapCacheOption.OnLoad;
image2.StreamSource = new MemoryStream(File.ReadAllBytes(MyEnvironment.Root(Config.CPCMember2Path)));
image2.EndInit();
image2.Freeze();
Image2 = image2;
}
catch (Exception ex)
{
Image2 = null;
}
try
{
BitmapImage image3 = new BitmapImage();
image3.BeginInit();
image3.CacheOption = BitmapCacheOption.OnLoad;
image3.StreamSource = new MemoryStream(File.ReadAllBytes(MyEnvironment.Root(Config.CPCMember3Path)));
image3.EndInit();
image3.Freeze();
Image3 = image3;
}
catch (Exception ex)
{
Image3 = null;
}
try
{
BitmapImage image4 = new BitmapImage();
image4.BeginInit();
image4.CacheOption = BitmapCacheOption.OnLoad;
image4.StreamSource = new MemoryStream(File.ReadAllBytes(MyEnvironment.Root(Config.CPCMember4Path)));
image4.EndInit();
image4.Freeze();
Image4 = image4;
}
catch (Exception ex)
{
Image4 = null;
}
}
} }
} }

View File

@@ -15,12 +15,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<!--<PackageReference Include="Costura.Fody" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>-->
</ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />