diff --git a/App.config b/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/App.xaml b/App.xaml
new file mode 100644
index 0000000..6de78f6
--- /dev/null
+++ b/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/App.xaml.cs b/App.xaml.cs
new file mode 100644
index 0000000..9a185f0
--- /dev/null
+++ b/App.xaml.cs
@@ -0,0 +1,181 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace SunlightCentralizedControlManagement_SCCM_
+{
+ ///
+ /// App.xaml 的交互逻辑
+ ///
+ public partial class App : Application
+ {
+ private static Assembly OnResolveAssembly(object sender, ResolveEventArgs args)
+ {
+ Assembly executingAssembly = Assembly.GetExecutingAssembly();
+ var executingAssemblyName = executingAssembly.GetName();
+ var resName = executingAssemblyName.Name + ".resources";
+
+ AssemblyName assemblyName = new AssemblyName(args.Name); string path = "";
+ if (resName == assemblyName.Name)
+ {
+ path = executingAssemblyName.Name + ".g.resources"; ;
+ }
+ else
+ {
+ path = assemblyName.Name + ".dll";
+ if (assemblyName.CultureInfo.Equals(CultureInfo.InvariantCulture) == false)
+ {
+ path = String.Format(@"{0}\{1}", assemblyName.CultureInfo, path);
+ }
+ }
+
+ using (Stream stream = executingAssembly.GetManifestResourceStream(path))
+ {
+ if (stream == null)
+ return null;
+
+ byte[] assemblyRawBytes = new byte[stream.Length];
+ stream.Read(assemblyRawBytes, 0, assemblyRawBytes.Length);
+ return Assembly.Load(assemblyRawBytes);
+ }
+ }
+ 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"));//设定语言
+ }
+
+ System.Threading.Mutex mutex;
+ void App_Startup(object sender, StartupEventArgs e)
+ {
+ bool ret;
+ mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);//程序只允许启动一次
+ if (!ret)
+ {
+ // LogGing.LogGingDATA("800_The program has been launched");
+ MessageBox.Show("The program has been launched");
+ Environment.Exit(0);
+ }
+ // LogGing.LogGingDATA("800_Start");
+
+ SystemSleepTool.PreventSleep();
+
+ //return Container.Resolve();
+ }
+
+ // protected override void OnStartup(StartupEventArgs e) //跟踪报错信息
+ // {
+ // base.OnStartup(e);
+ // //UI线程的异常捕捉
+ // this.DispatcherUnhandledException += App_DispatcherUnhandledException;
+ // }
+
+ private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
+ {
+ e.Handled = true;
+ if (e.Exception.InnerException == null)
+ {
+ MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!"
+ + "(1)错误" + Environment.NewLine
+ + "(2)错误源:" + e.Exception.Source + Environment.NewLine
+ // + (3)详细信息:" + e.Exception.Message + Environment.NewLine
+ // + "(4)报错区域:" + e.Exception.StackTrace
+ );
+ }
+ else
+ {
+ MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!"
+ + "(1)错误" + Environment.NewLine
+ // + "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine
+ + "(3)错误信息:" + e.Exception.Message + Environment.NewLine
+ // + "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine
+ // + "(5)报错区域:" + e.Exception.InnerException.StackTrace
+ );
+ }
+
+ string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
+ string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
+ //string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件
+ // System.IO.DirectoryInfo log = new System.IO.DirectoryInfo();//生成日志文件目录
+ string log_path = logpath + "\\ERR" + Log_time + ".txt";
+ string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ if (Directory.Exists(logpath))//检查日志路径
+ {
+ if (!File.Exists(log_path))//检查文件并写入
+ {
+ FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建文件
+ StreamWriter wr = new StreamWriter(fs);//创建文件
+ wr.Close();
+ FileStream fil = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
+ StreamWriter wfil = new StreamWriter(fil);//创建文件
+ wfil.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
+ wfil.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
+ wfil.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
+ wfil.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
+ wfil.Close();
+ }
+ else
+ {
+ FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
+ StreamWriter wr = new StreamWriter(fs);//创建文件
+ wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
+ wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
+ wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
+ wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
+ wr.Close();
+ }
+ }
+ else
+ {
+ DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
+ directoryInfo.Create();
+ }
+ }
+ ///
+ /// 启动初始页面
+ ///
+ private void Application_Startup(object sender, StartupEventArgs e)
+ {
+ Application.Current.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);//和MainWindwo同一目录
+ }
+
+ public static class SystemSleepTool
+ {
+ //定义API函数
+ [DllImport("kernel32.dll")]
+ static extern uint SetThreadExecutionState(ExecutionFlag flags);
+
+ [Flags]
+ enum ExecutionFlag : uint
+ {
+ ES_SYSTEM_REQUIRED = 0x00000001,
+ ES_DISPLAY_REQUIRED = 0x00000002,
+ ES_CONTINUOUS = 0x80000000,
+ }
+ ///
+ ///阻止系统休眠
+ ///
+ public static void PreventSleep()
+ {
+ SetThreadExecutionState(ExecutionFlag.ES_SYSTEM_REQUIRED | ExecutionFlag.ES_DISPLAY_REQUIRED | ExecutionFlag.ES_CONTINUOUS);
+ }
+ ///
+ ///恢复系统休眠
+ ///
+ public static void RestoreSleep()
+ {
+ SetThreadExecutionState(ExecutionFlag.ES_CONTINUOUS);
+ }
+ }
+ }
+}
diff --git a/MainWindow.xaml b/MainWindow.xaml
new file mode 100644
index 0000000..1d33fc3
--- /dev/null
+++ b/MainWindow.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
new file mode 100644
index 0000000..13af38c
--- /dev/null
+++ b/MainWindow.xaml.cs
@@ -0,0 +1,28 @@
+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_
+{
+ ///
+ /// MainWindow.xaml 的交互逻辑
+ ///
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..a3061d5
--- /dev/null
+++ b/Properties/AssemblyInfo.cs
@@ -0,0 +1,52 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("SunlightCentralizedControlManagement(SCCM)")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SunlightCentralizedControlManagement(SCCM)")]
+[assembly: AssemblyCopyright("Copyright © 2024")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+//若要开始生成可本地化的应用程序,请设置
+//.csproj 文件中的 CultureYouAreCodingWith
+//在 中。例如,如果你使用的是美国英语。
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(未在页面中找到资源时使用,
+ //或应用程序资源字典中找到时使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(未在页面中找到资源时使用,
+ //、应用程序或任何主题专用资源字典中找到时使用)
+)]
+
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..88f3852
--- /dev/null
+++ b/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本: 4.0.30319.42000
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace SunlightCentralizedControlManagement_SCCM_.Properties
+{
+
+
+ ///
+ /// 强类型资源类,用于查找本地化字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// 返回此类使用的缓存 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SunlightCentralizedControlManagement_SCCM_.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..61c01c6
--- /dev/null
+++ b/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SunlightCentralizedControlManagement_SCCM_.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SunlightCentralizedControlManagement(SCCM).csproj b/SunlightCentralizedControlManagement(SCCM).csproj
new file mode 100644
index 0000000..1e29787
--- /dev/null
+++ b/SunlightCentralizedControlManagement(SCCM).csproj
@@ -0,0 +1,110 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}
+ WinExe
+ SunlightCentralizedControlManagement_SCCM_
+ SunlightCentralizedControlManagement%28SCCM%29
+ v4.7.2
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+ MainWindow.xaml
+ Code
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+ 1.0.2895-prerelease
+
+
+
+
+
+
+ %(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)
+
+
+
+
\ No newline at end of file
diff --git a/SunlightCentralizedControlManagement(SCCM).sln b/SunlightCentralizedControlManagement(SCCM).sln
new file mode 100644
index 0000000..733a895
--- /dev/null
+++ b/SunlightCentralizedControlManagement(SCCM).sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.11.35312.102
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SunlightCentralizedControlManagement(SCCM)", "SunlightCentralizedControlManagement(SCCM).csproj", "{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {4B2F79A9-FD88-4230-886B-D5FC0BFE8254}
+ EndGlobalSection
+EndGlobal