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