diff --git a/C-S软件系统模版.sln b/C-S软件系统模版.sln index 3650120..1c281d8 100644 --- a/C-S软件系统模版.sln +++ b/C-S软件系统模版.sln @@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "软件系统客户端模版 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "软件系统服务端模版", "软件系统服务端模版\软件系统服务端模版.csproj", "{2AFB749C-A6CE-4B2A-B02D-4FC7BB8ADA30}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "软件系统服务端Wpf", "软件系统服务端Wpf\软件系统服务端Wpf.csproj", "{9B5A13FF-8483-4BB8-B0E7-2CF9A8E01C45}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "软件系统客户端Wpf", "软件系统客户端Wpf\软件系统客户端Wpf.csproj", "{DB8977DD-F909-449D-B58E-08B8A6A78F2F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -29,10 +29,10 @@ Global {2AFB749C-A6CE-4B2A-B02D-4FC7BB8ADA30}.Debug|Any CPU.Build.0 = Debug|Any CPU {2AFB749C-A6CE-4B2A-B02D-4FC7BB8ADA30}.Release|Any CPU.ActiveCfg = Release|Any CPU {2AFB749C-A6CE-4B2A-B02D-4FC7BB8ADA30}.Release|Any CPU.Build.0 = Release|Any CPU - {9B5A13FF-8483-4BB8-B0E7-2CF9A8E01C45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9B5A13FF-8483-4BB8-B0E7-2CF9A8E01C45}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B5A13FF-8483-4BB8-B0E7-2CF9A8E01C45}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9B5A13FF-8483-4BB8-B0E7-2CF9A8E01C45}.Release|Any CPU.Build.0 = Release|Any CPU + {DB8977DD-F909-449D-B58E-08B8A6A78F2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB8977DD-F909-449D-B58E-08B8A6A78F2F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB8977DD-F909-449D-B58E-08B8A6A78F2F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB8977DD-F909-449D-B58E-08B8A6A78F2F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/软件系统客户端Wpf/App.config b/软件系统客户端Wpf/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/软件系统客户端Wpf/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/软件系统客户端Wpf/App.xaml b/软件系统客户端Wpf/App.xaml new file mode 100644 index 0000000..22a17c7 --- /dev/null +++ b/软件系统客户端Wpf/App.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/软件系统客户端Wpf/App.xaml.cs b/软件系统客户端Wpf/App.xaml.cs new file mode 100644 index 0000000..b20c988 --- /dev/null +++ b/软件系统客户端Wpf/App.xaml.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; + +namespace 软件系统客户端Wpf +{ + /// + /// App.xaml 的交互逻辑 + /// + public partial class App : Application + { + /// + /// 指示了应用程序退出时的代码 + /// + public static int QuitCode { get; set; } = 0; + + + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + //捕获未处理的异常 + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + + Process process = Process.GetCurrentProcess(); + //遍历应用程序的同名进程组 + foreach (Process p in Process.GetProcessesByName(process.ProcessName)) + { + //不是同一进程则关闭刚刚创建的进程 + if (p.Id != process.Id) + { + //此处显示原先的窗口需要一定的时间,不然无法显示 + ShowWindowAsync(p.MainWindowHandle, 9); + SetForegroundWindow(p.MainWindowHandle); + Thread.Sleep(10); + Current.Shutdown();//关闭当前的应用程序 + return; + } + } + + + P1: + LoginWindow lw = new LoginWindow(); + bool? result = lw.ShowDialog(); + if (result.Value == true) + { + MainWindow mw = new MainWindow(); + MainWindow = mw; + + mw.ShowDialog(); + if (QuitCode == 1) + { + //继续显示登录窗口 + QuitCode = 0; + goto P1; + } + else + { + Current.Shutdown();//关闭当前的应用程序 + } + } + else + { + Environment.Exit(0); + } + + } + + private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + + } + + [DllImport("User32.dll")] + private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow); + + [DllImport("User32.dll")] + private static extern bool SetForegroundWindow(IntPtr hWnd); + } +} diff --git a/软件系统客户端Wpf/BasicSupport/UserClient.cs b/软件系统客户端Wpf/BasicSupport/UserClient.cs new file mode 100644 index 0000000..9f7f3ba --- /dev/null +++ b/软件系统客户端Wpf/BasicSupport/UserClient.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using HslCommunication.Enthernet; +using HslCommunication.BasicFramework; +using CommonLibrary; + +namespace 软件系统客户端Wpf +{ + + //==================================================================================================== + // 模版说明: + //==================================================================================================== + + + public class UserClient + { + public static JsonSettings JsonSettings = new JsonSettings(); + /// + /// 本软件的当前版本,用来验证更新的关键依据 + /// + public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0"); + + /// + /// 服务器的IP地址,默认为127.0.0.1,可用于单机调试 + /// + public static string ServerIp { get; } = "127.0.0.1"; + + /// + /// 所有版本更新信息的对象 + /// + public static List HistoryVersions { get; } = new List + { + //写入所有的历史版本信息,这样就能在更新日志的界面查看到信息 + new VersionInfo() + { + VersionNum=new SystemVersion("1.0.0"), + ReleaseDate=new DateTime(2017,1,1),//该版本发布的日期 + UpdateDetails=new StringBuilder("1.本系统第一版本正式发布使用。"+Environment.NewLine+ + "2.提供了多客户端用时在线的功能。"+Environment.NewLine+ + "3.需要用户自行添加"), + }, + }; + + + + + /// + /// 设置或获取系统的公告 + /// + public static string Announcement { get; set; } = ""; + /// + /// 当前系统的登录账户 + /// + public static UserAccount UserAccount { get; set; } = new UserAccount(); + + /// + /// 服务器的时间,该时间与服务器同步,每隔10秒钟,防止客户端串改单机时间,可以作为各种时间条件判定 + /// + public static DateTime DateTimeServer { get; set; } = DateTime.Now; + + + /// + /// 用于访问服务器数据的网络对象类,必须修改这个端口参数,否则运行失败 + /// + public static Net_Simplify_Client Net_simplify_client = new Net_Simplify_Client( + new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp), + CommonLibrary.CommonLibrary.Port_Second_Net)) + { + KeyToken = CommonHeadCode.KeyToken, + ConnectTimeout = 5000, + }; + + /// + /// 用于使用udp向服务器进行发送即时可丢失数据的对象 + /// + public static Net_Udp_Client Net_Udp_Client = new Net_Udp_Client( + new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp), + CommonLibrary.CommonLibrary.Port_Udp_Server)) + { + KeyToken = CommonHeadCode.KeyToken, + }; + } +} diff --git a/软件系统客户端Wpf/LoginWindow.xaml b/软件系统客户端Wpf/LoginWindow.xaml new file mode 100644 index 0000000..2a1ffdf --- /dev/null +++ b/软件系统客户端Wpf/LoginWindow.xaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + [您的软件系统] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 是否记住密码 + + + 正在连接服务器... + + + + + + + + + + + + + + 版本号: + V1.0.0 + 本软件著作权归某某所有 + + + diff --git a/软件系统客户端Wpf/LoginWindow.xaml.cs b/软件系统客户端Wpf/LoginWindow.xaml.cs new file mode 100644 index 0000000..21e6e56 --- /dev/null +++ b/软件系统客户端Wpf/LoginWindow.xaml.cs @@ -0,0 +1,49 @@ +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.Shapes; + +namespace 软件系统客户端Wpf +{ + /// + /// LoginWindow.xaml 的交互逻辑 + /// + public partial class LoginWindow : Window + { + public LoginWindow() + { + InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + this.DialogResult = true; + } + + private void ToggleButton_Checked(object sender, RoutedEventArgs e) + { + + } + + private void ToggleButton_Unchecked(object sender, RoutedEventArgs e) + { + + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + TextBlockSoftName.Text = CommonLibrary.Resource.StringResouce.SoftName; + TextBlockSoftVersion.Text = UserClient.CurrentVersion.ToString(); + TextBlockSoftCopyright.Text = $"本软件著作权归{CommonLibrary.Resource.StringResouce.SoftCopyRight}所有"; + } + } +} diff --git a/软件系统客户端Wpf/MainWindow.xaml b/软件系统客户端Wpf/MainWindow.xaml new file mode 100644 index 0000000..525ec98 --- /dev/null +++ b/软件系统客户端Wpf/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/软件系统客户端Wpf/MainWindow.xaml.cs b/软件系统客户端Wpf/MainWindow.xaml.cs new file mode 100644 index 0000000..3283e87 --- /dev/null +++ b/软件系统客户端Wpf/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 软件系统客户端Wpf +{ + /// + /// MainWindow.xaml 的交互逻辑 + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/软件系统客户端Wpf/Properties/AssemblyInfo.cs b/软件系统客户端Wpf/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..efdf67c --- /dev/null +++ b/软件系统客户端Wpf/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("软件系统客户端Wpf")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("软件系统客户端Wpf")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[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.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/软件系统客户端Wpf/Properties/Resources.Designer.cs b/软件系统客户端Wpf/Properties/Resources.Designer.cs new file mode 100644 index 0000000..14a7cbc --- /dev/null +++ b/软件系统客户端Wpf/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace 软件系统客户端Wpf.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("软件系统客户端Wpf.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/软件系统客户端Wpf/Properties/Resources.resx b/软件系统客户端Wpf/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/软件系统客户端Wpf/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/软件系统客户端Wpf/Properties/Settings.Designer.cs b/软件系统客户端Wpf/Properties/Settings.Designer.cs new file mode 100644 index 0000000..831b858 --- /dev/null +++ b/软件系统客户端Wpf/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 软件系统客户端Wpf.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/软件系统客户端Wpf/Properties/Settings.settings b/软件系统客户端Wpf/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/软件系统客户端Wpf/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/软件系统客户端Wpf/packages.config b/软件系统客户端Wpf/packages.config new file mode 100644 index 0000000..4a7a500 --- /dev/null +++ b/软件系统客户端Wpf/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/软件系统客户端Wpf/软件系统客户端Wpf.csproj b/软件系统客户端Wpf/软件系统客户端Wpf.csproj new file mode 100644 index 0000000..d246826 --- /dev/null +++ b/软件系统客户端Wpf/软件系统客户端Wpf.csproj @@ -0,0 +1,120 @@ + + + + + Debug + AnyCPU + {DB8977DD-F909-449D-B58E-08B8A6A78F2F} + WinExe + 软件系统客户端Wpf + 软件系统客户端Wpf + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\CommonLibrary\bin\Debug\CommonLibrary.dll + + + ..\Public\HslCommunication.dll + + + ..\packages\MaterialDesignColors.1.1.3\lib\net45\MaterialDesignColors.dll + + + ..\packages\MaterialDesignThemes.2.3.0.823\lib\net45\MaterialDesignThemes.Wpf.dll + + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + LoginWindow.xaml + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/软件系统服务端Wpf/App.xaml b/软件系统服务端Wpf/App.xaml index f61c445..22a17c7 100644 --- a/软件系统服务端Wpf/App.xaml +++ b/软件系统服务端Wpf/App.xaml @@ -1,7 +1,8 @@ - + xmlns:local="clr-namespace:软件系统客户端Wpf" + ShutdownMode="OnExplicitShutdown"> diff --git a/软件系统服务端Wpf/App.xaml.cs b/软件系统服务端Wpf/App.xaml.cs index 6b951f2..d92adfa 100644 --- a/软件系统服务端Wpf/App.xaml.cs +++ b/软件系统服务端Wpf/App.xaml.cs @@ -9,7 +9,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; -namespace 软件系统服务端Wpf +namespace 软件系统客户端Wpf { /// /// App.xaml 的交互逻辑 @@ -46,12 +46,13 @@ namespace 软件系统服务端Wpf P1: - LoginWindow lw = new LoginWindow(); - if (lw.ShowDialog().Value == true) + bool? result = lw.ShowDialog(); + if (result.Value == true) { - MainWindow mw=new MainWindow(); + MainWindow mw = new MainWindow(); MainWindow = mw; + mw.ShowDialog(); if (QuitCode == 1) { @@ -59,6 +60,10 @@ namespace 软件系统服务端Wpf QuitCode = 0; goto P1; } + else + { + Current.Shutdown();//关闭当前的应用程序 + } } else { @@ -66,6 +71,8 @@ namespace 软件系统服务端Wpf } } + + private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { diff --git a/软件系统服务端Wpf/BasicSupport/UserClient.cs b/软件系统服务端Wpf/BasicSupport/UserClient.cs new file mode 100644 index 0000000..9109981 --- /dev/null +++ b/软件系统服务端Wpf/BasicSupport/UserClient.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using HslCommunication.Enthernet; +using HslCommunication.BasicFramework; +using CommonLibrary; + +namespace 软件系统客户端wpf +{ + + //==================================================================================================== + // 模版说明: + //==================================================================================================== + + + public class UserClient + { + public static JsonSettings JsonSettings = new JsonSettings(); + /// + /// 本软件的当前版本,用来验证更新的关键依据 + /// + public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0"); + + /// + /// 服务器的IP地址,默认为127.0.0.1,可用于单机调试 + /// + public static string ServerIp { get; } = "127.0.0.1"; + + /// + /// 所有版本更新信息的对象 + /// + public static List HistoryVersions { get; } = new List + { + //写入所有的历史版本信息,这样就能在更新日志的界面查看到信息 + new VersionInfo() + { + VersionNum=new SystemVersion("1.0.0"), + ReleaseDate=new DateTime(2017,1,1),//该版本发布的日期 + UpdateDetails=new StringBuilder("1.本系统第一版本正式发布使用。"+Environment.NewLine+ + "2.提供了多客户端用时在线的功能。"+Environment.NewLine+ + "3.需要用户自行添加"), + }, + }; + + + + + /// + /// 设置或获取系统的公告 + /// + public static string Announcement { get; set; } = ""; + /// + /// 当前系统的登录账户 + /// + public static UserAccount UserAccount { get; set; } = new UserAccount(); + + /// + /// 服务器的时间,该时间与服务器同步,每隔10秒钟,防止客户端串改单机时间,可以作为各种时间条件判定 + /// + public static DateTime DateTimeServer { get; set; } = DateTime.Now; + + + /// + /// 用于访问服务器数据的网络对象类,必须修改这个端口参数,否则运行失败 + /// + public static Net_Simplify_Client Net_simplify_client = new Net_Simplify_Client( + new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp), + CommonLibrary.CommonLibrary.Port_Second_Net)) + { + KeyToken = CommonHeadCode.KeyToken, + ConnectTimeout = 5000, + }; + + /// + /// 用于使用udp向服务器进行发送即时可丢失数据的对象 + /// + public static Net_Udp_Client Net_Udp_Client = new Net_Udp_Client( + new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp), + CommonLibrary.CommonLibrary.Port_Udp_Server)) + { + KeyToken = CommonHeadCode.KeyToken, + }; + } +} diff --git a/软件系统服务端Wpf/LoginWindow.xaml b/软件系统服务端Wpf/LoginWindow.xaml index d405d4d..2a1ffdf 100644 --- a/软件系统服务端Wpf/LoginWindow.xaml +++ b/软件系统服务端Wpf/LoginWindow.xaml @@ -1,10 +1,11 @@ - + Title="系统登录" Height="300" Width="500" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Loaded="Window_Loaded"> @@ -16,14 +17,76 @@ + + + + + - + 登录系统 + + + + + + + + 是否记住密码 + + + 正在连接服务器... + + + + + + + + + + + + + 版本号: + V1.0.0 + 本软件著作权归某某所有 + diff --git a/软件系统服务端Wpf/LoginWindow.xaml.cs b/软件系统服务端Wpf/LoginWindow.xaml.cs index 1046ece..cd28aa1 100644 --- a/软件系统服务端Wpf/LoginWindow.xaml.cs +++ b/软件系统服务端Wpf/LoginWindow.xaml.cs @@ -12,7 +12,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; -namespace 软件系统服务端Wpf +namespace 软件系统客户端Wpf { /// /// LoginWindow.xaml 的交互逻辑 @@ -28,5 +28,21 @@ namespace 软件系统服务端Wpf { this.DialogResult = true; } + + private void ToggleButton_Checked(object sender, RoutedEventArgs e) + { + + } + + private void ToggleButton_Unchecked(object sender, RoutedEventArgs e) + { + + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + TextBlockSoftName.Text = CommonLibrary.Resource.StringResouce.SoftName; + TextBlockSoftVersion.Text= + } } } diff --git a/软件系统服务端Wpf/MainWindow.xaml b/软件系统服务端Wpf/MainWindow.xaml index 41fa416..525ec98 100644 --- a/软件系统服务端Wpf/MainWindow.xaml +++ b/软件系统服务端Wpf/MainWindow.xaml @@ -1,11 +1,11 @@ - + Title="MainWindow" Height="350" Width="525" WindowState="Maximized"> diff --git a/软件系统服务端Wpf/MainWindow.xaml.cs b/软件系统服务端Wpf/MainWindow.xaml.cs index 50eddf1..3283e87 100644 --- a/软件系统服务端Wpf/MainWindow.xaml.cs +++ b/软件系统服务端Wpf/MainWindow.xaml.cs @@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace 软件系统服务端Wpf +namespace 软件系统客户端Wpf { /// /// MainWindow.xaml 的交互逻辑 diff --git a/软件系统服务端Wpf/Properties/AssemblyInfo.cs b/软件系统服务端Wpf/Properties/AssemblyInfo.cs index bd3d588..efdf67c 100644 --- a/软件系统服务端Wpf/Properties/AssemblyInfo.cs +++ b/软件系统服务端Wpf/Properties/AssemblyInfo.cs @@ -7,11 +7,11 @@ using System.Windows; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 -[assembly: AssemblyTitle("软件系统服务端Wpf")] +[assembly: AssemblyTitle("软件系统客户端Wpf")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("软件系统服务端Wpf")] +[assembly: AssemblyProduct("软件系统客户端Wpf")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/软件系统服务端Wpf/Properties/Resources.Designer.cs b/软件系统服务端Wpf/Properties/Resources.Designer.cs index f330286..2bdec7c 100644 --- a/软件系统服务端Wpf/Properties/Resources.Designer.cs +++ b/软件系统服务端Wpf/Properties/Resources.Designer.cs @@ -1,69 +1,61 @@ //------------------------------------------------------------------------------ // // 此代码由工具生成。 -// 运行时版本: 4.0.30319.42000 +// 运行时版本:4.0.30319.42000 // -// 对此文件的更改可能导致不正确的行为,如果 -// 重新生成代码,则所做更改将丢失。 +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ -namespace 软件系统服务端Wpf.Properties -{ - - +namespace 软件系统客户端Wpf.Properties { + using System; + + /// - /// 强类型资源类,用于查找本地化字符串等。 + /// 一个强类型的资源类,用于查找本地化的字符串等。 /// // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // 若要添加或移除成员,请编辑 .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 - { - + 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() - { + internal Resources() { } - + /// - /// 返回此类使用的缓存 ResourceManager 实例。 + /// 返回此类使用的缓存的 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("软件系统服务端Wpf.Properties.Resources", typeof(Resources).Assembly); + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("软件系统客户端Wpf.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// - /// 覆盖当前线程的 CurrentUICulture 属性 - /// 使用此强类型的资源类的资源查找。 + /// 使用此强类型资源类,为所有资源查找 + /// 重写当前线程的 CurrentUICulture 属性。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/软件系统服务端Wpf/Properties/Settings.Designer.cs b/软件系统服务端Wpf/Properties/Settings.Designer.cs index e8be44f..c30a085 100644 --- a/软件系统服务端Wpf/Properties/Settings.Designer.cs +++ b/软件系统服务端Wpf/Properties/Settings.Designer.cs @@ -1,28 +1,24 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ -namespace 软件系统服务端Wpf.Properties -{ - - +namespace 软件系统客户端Wpf.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 - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.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 - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/软件系统服务端Wpf/软件系统服务端Wpf.csproj b/软件系统服务端Wpf/软件系统服务端Wpf.csproj index a87bef1..4f5018c 100644 --- a/软件系统服务端Wpf/软件系统服务端Wpf.csproj +++ b/软件系统服务端Wpf/软件系统服务端Wpf.csproj @@ -6,8 +6,8 @@ AnyCPU {9B5A13FF-8483-4BB8-B0E7-2CF9A8E01C45} WinExe - 软件系统服务端Wpf - 软件系统服务端Wpf + 软件系统客户端Wpf + 软件系统客户端Wpf v4.5 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -33,12 +33,21 @@ 4 + + ..\CommonLibrary\bin\Debug\CommonLibrary.dll + + + ..\Public\HslCommunication.dll + ..\packages\MaterialDesignColors.1.1.3\lib\net45\MaterialDesignColors.dll ..\packages\MaterialDesignThemes.2.3.0.823\lib\net45\MaterialDesignThemes.Wpf.dll + + ..\Public\Newtonsoft.Json.dll + @@ -71,6 +80,7 @@ App.xaml Code + LoginWindow.xaml @@ -104,7 +114,10 @@ - + + Designer + + \ No newline at end of file