sc 12 months ago
parent
commit
6e7b279807
  1. 4
      App.xaml.cs
  2. 6
      MainWindow.xaml
  3. 5
      MainWindow.xaml.cs
  4. 7
      SunlightCentralizedControlManagement_SCCM_.csproj
  5. 2
      UserClass/IniFile.cs
  6. 19
      View/EngineerSetView.xaml
  7. 56
      View/EngineerSetView.xaml.cs
  8. 10
      View/Whole.xaml.cs

4
App.xaml.cs

@ -47,12 +47,14 @@ namespace SunlightCentralizedControlManagement_SCCM_
return Assembly.Load(assemblyRawBytes);
}
}
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
public App()
{
this.Startup += new StartupEventHandler(App_Startup);
this.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
// SunlightCentralizedControlManagement_SCCM_.Properties.Resources.Culture = new System.Globalization.CultureInfo(Configini.IniReadvalue("SYS", "Language"));//设定语言
SunlightCentralizedControlManagement_SCCM_.Properties.Resources.Culture = new System.Globalization.CultureInfo(Configini.IniReadvalue("SYS", "Language"));//设定语言
}
System.Threading.Mutex mutex;

6
MainWindow.xaml

@ -45,11 +45,11 @@
<materialDesign:PopupBox Foreground="White" Margin="10" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
<StackPanel Width="150">
<Button Content="账号"/>
<Button Content="{x:Static lang:Resources.SysSet}"/>
<Button Content="{x:Static lang:Resources.SysSet}" Click="ButtonSYS_Click"/>
<Button Content="{x:Static lang:Resources.Help}" Click="Buttonhelp_Click"/>
<Separator/>
<Button x:Name="ButtonMinimize" Content="最小化" Click="ButtonMinimize_Click"/>
<Button x:Name="ButtonMaximize" Content="最大化" Click="ButtonMaximize_Click"/>
<Button x:Name="ButtonMinimize" Content="{x:Static lang:Resources.Minimize}" Click="ButtonMinimize_Click"/>
<Button x:Name="ButtonMaximize" Content="{x:Static lang:Resources.Maximize}" Click="ButtonMaximize_Click"/>
<Button x:Name="ButtonPopUpLogout" Content="{x:Static lang:Resources.PopUpLogout}" Click="ButtonPopUpLogout_Click"/>
</StackPanel>
</materialDesign:PopupBox>

5
MainWindow.xaml.cs

@ -89,6 +89,9 @@ namespace SunlightCentralizedControlManagement_SCCM_
help_page.Show();
}
private void ButtonSYS_Click(object sender, RoutedEventArgs e)
{
Picture.Content =new View.EngineerSetView();
}
}
}

7
SunlightCentralizedControlManagement_SCCM_.csproj

@ -96,6 +96,9 @@
<Compile Include="UserClass\UserControlMenuItem.cs" />
<Compile Include="ViewModel\MainWindowViewModel.cs" />
<Compile Include="ViewModel\ViewModelLocator.cs" />
<Compile Include="View\EngineerSetView.xaml.cs">
<DependentUpon>EngineerSetView.xaml</DependentUpon>
</Compile>
<Compile Include="View\info.xaml.cs">
<DependentUpon>info.xaml</DependentUpon>
</Compile>
@ -123,6 +126,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="View\EngineerSetView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\info.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

2
UserClass/IniFile.cs

@ -1,7 +1,7 @@
using System.Runtime.InteropServices;
using System.Text;
namespace DyeingComputer.UserClass
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{
internal class IniFile
{

19
View/EngineerSetView.xaml

@ -0,0 +1,19 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.EngineerSetView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
mc:Ignorable="d"
d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top">
<Grid>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxCOM0" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Port}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxCOM1" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,90,0,0" x:Name="comboBoxCOM2" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,130,0,0" x:Name="comboBoxLanguage" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxLanguage_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Language}" VerticalAlignment="Top" Width="120" FontSize="25"/>
</Grid>
</UserControl>

56
View/EngineerSetView.xaml.cs

@ -0,0 +1,56 @@
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.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SunlightCentralizedControlManagement_SCCM_.View
{
/// <summary>
/// EngineerSetView.xaml 的交互逻辑
/// </summary>
public partial class EngineerSetView : UserControl
{
public EngineerSetView()
{
InitializeComponent();
// 获取所有可用串口端口,并添加到comboBoxCOM
string[] ports = System.IO.Ports.SerialPort.GetPortNames();
comboBoxCOM0.ItemsSource = ports;
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM");
comboBoxCOM1.ItemsSource = ports;
comboBoxCOM1.Text = Configini.IniReadvalue("SYS", "COM");
comboBoxCOM2.ItemsSource = ports;
comboBoxCOM2.Text = Configini.IniReadvalue("SYS", "COM");
string[] Language = {"en-US","zh-CN","zh -TW" };
comboBoxLanguage.ItemsSource = Language;
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language");
}
//调用配置文件
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
private void comboBoxCOM_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Configini.IniWritevalue("SYS", "COM0", comboBoxCOM0.SelectedValue.ToString());
Configini.IniWritevalue("SYS", "COM1", comboBoxCOM1.SelectedValue.ToString());
Configini.IniWritevalue("SYS", "COM2", comboBoxCOM2.SelectedValue.ToString());
}
private void comboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Configini.IniWritevalue("SYS", "Language", comboBoxLanguage.SelectedValue.ToString());
}
}
}

10
View/Whole.xaml.cs

@ -37,15 +37,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
textBox.Margin = new Thickness( 5,5,0,0);
WholeView.Children.Add(textBox);
TextBox textBox1 = new TextBox();
textBox1.Text = "12431414";
textBox1.Margin = new Thickness(5,5,0,0);
// textBox1.HorizontalAlignment = HorizontalAlignment.Left;
// textBox1.VerticalAlignment = VerticalAlignment.Top;
textBox1.Background = new SolidColorBrush(Color.FromRgb(100, 100, 100));
textBox1.Width = 100;
textBox1.Height = 100;
WholeView.Children.Add(textBox1);

Loading…
Cancel
Save