diff --git a/ClientsLibrary/FormRegisterAccount.Designer.cs b/ClientsLibrary/AccountSupport/FormRegisterAccount.Designer.cs similarity index 100% rename from ClientsLibrary/FormRegisterAccount.Designer.cs rename to ClientsLibrary/AccountSupport/FormRegisterAccount.Designer.cs diff --git a/ClientsLibrary/FormRegisterAccount.cs b/ClientsLibrary/AccountSupport/FormRegisterAccount.cs similarity index 100% rename from ClientsLibrary/FormRegisterAccount.cs rename to ClientsLibrary/AccountSupport/FormRegisterAccount.cs diff --git a/ClientsLibrary/FormRegisterAccount.resx b/ClientsLibrary/AccountSupport/FormRegisterAccount.resx similarity index 100% rename from ClientsLibrary/FormRegisterAccount.resx rename to ClientsLibrary/AccountSupport/FormRegisterAccount.resx diff --git a/ClientsLibrary/ClientsLibrary.csproj b/ClientsLibrary/ClientsLibrary.csproj index 840d289..61116c8 100644 --- a/ClientsLibrary/ClientsLibrary.csproj +++ b/ClientsLibrary/ClientsLibrary.csproj @@ -55,22 +55,22 @@ FormDownloading.cs - + Form - + FormLogView.cs - + Form - + FormRegisterAccount.cs - + Form - + FormUpdateRemote.cs @@ -81,15 +81,16 @@ FormDownloading.cs - + FormLogView.cs - + FormRegisterAccount.cs - + FormUpdateRemote.cs + \ No newline at end of file diff --git a/ClientsLibrary/FormLogView.Designer.cs b/ClientsLibrary/LogsSupport/FormLogView.Designer.cs similarity index 100% rename from ClientsLibrary/FormLogView.Designer.cs rename to ClientsLibrary/LogsSupport/FormLogView.Designer.cs diff --git a/ClientsLibrary/FormLogView.cs b/ClientsLibrary/LogsSupport/FormLogView.cs similarity index 100% rename from ClientsLibrary/FormLogView.cs rename to ClientsLibrary/LogsSupport/FormLogView.cs diff --git a/ClientsLibrary/FormLogView.resx b/ClientsLibrary/LogsSupport/FormLogView.resx similarity index 100% rename from ClientsLibrary/FormLogView.resx rename to ClientsLibrary/LogsSupport/FormLogView.resx diff --git a/ClientsLibrary/FormUpdateRemote.Designer.cs b/ClientsLibrary/SoftUpdateSupport/FormUpdateRemote.Designer.cs similarity index 100% rename from ClientsLibrary/FormUpdateRemote.Designer.cs rename to ClientsLibrary/SoftUpdateSupport/FormUpdateRemote.Designer.cs diff --git a/ClientsLibrary/FormUpdateRemote.cs b/ClientsLibrary/SoftUpdateSupport/FormUpdateRemote.cs similarity index 100% rename from ClientsLibrary/FormUpdateRemote.cs rename to ClientsLibrary/SoftUpdateSupport/FormUpdateRemote.cs diff --git a/ClientsLibrary/FormUpdateRemote.resx b/ClientsLibrary/SoftUpdateSupport/FormUpdateRemote.resx similarity index 100% rename from ClientsLibrary/FormUpdateRemote.resx rename to ClientsLibrary/SoftUpdateSupport/FormUpdateRemote.resx diff --git a/ClientsLibrary/UserClient.cs b/ClientsLibrary/UserClient.cs index 6a0c024..d625cbe 100644 --- a/ClientsLibrary/UserClient.cs +++ b/ClientsLibrary/UserClient.cs @@ -19,34 +19,33 @@ namespace ClientsLibrary /// - /// 一个通用的用户客户端类 + /// 一个通用的用户客户端类, 包含了一些静态的资源 /// public class UserClient { + /// + /// 客户端需要进行本地存储的信息日志 + /// public static JsonSettings JsonSettings = new JsonSettings(); - - + /// /// 本软件的当前版本,用来验证更新的关键依据 /// public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.170914"); - - + /// /// 服务器的IP地址,默认为127.0.0.1,可用于单机调试,云服务器端:117.48.203.204 /// public static string ServerIp { get; } = "127.0.0.1";//用于测试的云服务器地址 - - + /// /// 系统的分厂信息 /// public static List SystemFactories { get; set; } = new List(); - - + /// @@ -54,7 +53,7 @@ namespace ClientsLibrary /// public static List HistoryVersions { get; } = new List { - //写入所有的历史版本信息,这样就能在更新日志的界面查看到信息 + // 写入所有的历史版本信息,这样就能在更新日志的界面查看到信息 new VersionInfo() { VersionNum=new SystemVersion("1.0.0"), @@ -65,9 +64,7 @@ namespace ClientsLibrary "3.需要用户自行添加"), }, }; - - - + /// /// 设置或获取系统的公告 @@ -120,7 +117,7 @@ namespace ClientsLibrary { if (e.ExceptionObject is Exception ex) { - //使用UDP方法传送会服务器 + // 使用TCP方法传送会服务器 string info = HslCommunication.LogNet.LogNetManagment.GetSaveStringFromException(null, ex); Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.异常消息, info); } diff --git a/ClientsLibrary/UserPortrait.cs b/ClientsLibrary/UserPortrait.cs index fccef57..4855fb6 100644 --- a/ClientsLibrary/UserPortrait.cs +++ b/ClientsLibrary/UserPortrait.cs @@ -17,6 +17,14 @@ namespace ClientsLibrary /// public class UserPortrait { + #region Constructor + + /// + /// 实例化一个新的头像管理类对象 + /// + /// 头像存储的文件夹路径 + /// 加载图片的方法 + /// 加载前的操作 public UserPortrait(string filePath, Action loadPic, Action disPic) { if (!System.IO.Directory.Exists(filePath)) @@ -28,11 +36,13 @@ namespace ClientsLibrary DisPic = disPic; } - private string FileSavePath { get; set; } - - private Action LoadPic = null; - private Action DisPic = null; + #endregion + + #region Change Portrait + /// + /// 点击更改头像后的操作,打开头像选择对话框,获取到2种分辨率的头像,然后进行上传 + /// public void ChangePortrait() { using (FormPortraitSelect fps = new FormPortraitSelect()) @@ -68,7 +78,13 @@ namespace ClientsLibrary } + #endregion + #region Download Portraint + + /// + /// 加载头像信息,检查本地是否有相应的文件,没有则向服务器请求下载新的头像,然后加载,应放到线程池中执行 + /// public void DownloadUserPortraint() { string path = FileSavePath; @@ -109,6 +125,10 @@ namespace ClientsLibrary } } + /// + /// 下载小尺寸的头像并使用委托加载它 + /// + /// public void DownloadUserPortraint(string path) { OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.下载小头, UserClient.UserAccount.UserName); @@ -124,6 +144,9 @@ namespace ClientsLibrary } } + /// + /// 下载大尺寸的头像并打开它,该方法适合线程池 + /// public void ThreadPoolDownloadSizeLarge() { string path = FileSavePath; @@ -136,11 +159,31 @@ namespace ClientsLibrary string path32 = path + @"\" + PortraitSupport.LargePortrait; System.IO.File.WriteAllBytes(path32, data); System.Diagnostics.Process.Start(path32); + data = null; } } Thread.Sleep(1000); } + #endregion + + #region Private Members + + /// + /// 文件的路径 + /// + private string FileSavePath { get; set; } + /// + /// 加载图片的操作 + /// + private Action LoadPic = null; + /// + /// 加载图片前的操作 + /// + private Action DisPic = null; + + + #endregion } } diff --git a/CommonLibrary/AccountSupport/UserAccount.cs b/CommonLibrary/AccountSupport/UserAccount.cs index bb6425f..72c254f 100644 --- a/CommonLibrary/AccountSupport/UserAccount.cs +++ b/CommonLibrary/AccountSupport/UserAccount.cs @@ -11,6 +11,8 @@ namespace CommonLibrary /// public class UserAccount { + #region Public Members + /// /// 用户名称,该名称唯一 /// @@ -63,6 +65,11 @@ namespace CommonLibrary /// 上次登录系统的方式,有winform版,wpf版,web版 /// public string LastLoginWay { get; set; } = string.Empty; + + #endregion + + #region Static Members + /// /// 用于存储和传送的名称 /// @@ -76,22 +83,14 @@ namespace CommonLibrary /// public static string LoginWayText { get { return "LoginWay"; } } /// - /// 深度拷贝当前的账户信息 + /// 登录系统的唯一设备ID /// - /// 返回的类型,应该为继承后的类型 - /// 新的对象 - public T DeepCopy() where T : UserAccount - { - return JObject.FromObject(this).ToObject(); - } - /// - /// 获取账号的用户名 - /// - /// - public override string ToString() - { - return UserName; - } + public static string DeviceUniqueID { get { return "DeviceUniqueID"; } } + + #endregion + + #region Public Method + /// /// 获取本账号的JSON字符串,用于在网络中数据传输 /// @@ -100,10 +99,34 @@ namespace CommonLibrary { return JObject.FromObject(this).ToString(); } + + /// + /// 深度拷贝当前的账户信息 + /// + /// 返回的类型,应该为继承后的类型 + /// 新的对象 + public T DeepCopy() where T : UserAccount + { + return JObject.FromObject(this).ToObject(); + } + + #endregion + + #region Override Method + + /// + /// 获取账号的用户名 + /// + /// + public override string ToString() + { + return UserName; + } + + #endregion + } - - - + /// /// 账户的等级 /// diff --git a/CommonLibrary/PortraitSupport/PortraitSupport.cs b/CommonLibrary/PortraitSupport/PortraitSupport.cs index 99614a9..51c120b 100644 --- a/CommonLibrary/PortraitSupport/PortraitSupport.cs +++ b/CommonLibrary/PortraitSupport/PortraitSupport.cs @@ -17,7 +17,11 @@ namespace CommonLibrary /// public const string LargePortrait = "Size_300_.png"; - + /// + /// 获取小尺寸的头像文件 + /// + /// 目录 + /// 文件的完整路径 public static string GetSmallPortraitFileName(string dirPath) { string[] files = Directory.GetFiles(dirPath); @@ -30,6 +34,12 @@ namespace CommonLibrary } return string.Empty; } + + /// + /// 获取大尺寸的头像文件 + /// + /// 目录 + /// 文件的完整路径 public static string GetLargePortraitFileName(string dirPath) { string[] files = Directory.GetFiles(dirPath); diff --git a/软件系统客户端模版/FormLogin.cs b/软件系统客户端模版/FormLogin.cs index dd5caa5..947305a 100644 --- a/软件系统客户端模版/FormLogin.cs +++ b/软件系统客户端模版/FormLogin.cs @@ -211,7 +211,8 @@ namespace 软件系统客户端模版 { { UserAccount.UserNameText, new JValue(textBox_userName.Text) }, { UserAccount.PasswordText, new JValue(textBox_password.Text) }, - { UserAccount.LoginWayText, new JValue("winform") } + { UserAccount.LoginWayText, new JValue("winform") }, + { UserAccount.DeviceUniqueID, new JValue(UserClient.JsonSettings.SystemInfo) } }; result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.账户检查, json.ToString()); if (result.IsSuccess)