提交 0a7ace0c 编写于 作者: Richard__Hu's avatar Richard__Hu

代码调整,重构,v1.6.10

上级 1a85ef85
......@@ -320,7 +320,6 @@
this.Controls.Add(this.userButton1);
this.Controls.Add(this.userButton_login);
this.Name = "FormLogView";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "日志查看器";
this.Load += new System.EventHandler(this.FormLogView_Load);
......
......@@ -14,6 +14,8 @@ namespace ClientsLibrary
{
public partial class FormLogView : Form
{
#region Constructor
public FormLogView()
{
InitializeComponent();
......@@ -23,13 +25,26 @@ namespace ClientsLibrary
net_simplify_client = UserClient.Net_simplify_client;
}
#endregion
#region Window Load
private void FormLogView_Load(object sender, EventArgs e)
{
}
#endregion
#region Private Member
private NetSimplifyClient net_simplify_client = null;
#endregion
#region Button Click
private void ReadFromServer(int head_code)
{
OperateResultString result = net_simplify_client.ReadFromServer(head_code);
......@@ -129,19 +144,8 @@ namespace ClientsLibrary
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.客户端日志清空);
}
//private void userButton17_Click(object sender, EventArgs e)
//{
// ReadFromServer(CommonHeadCode.SimplifyHeadCode.头像日志查看);
//}
//private void userButton16_Click(object sender, EventArgs e)
//{
// ClearFromServer(CommonHeadCode.SimplifyHeadCode.头像日志清空);
//}
private void logNetAnalysisControl1_Load(object sender, EventArgs e)
{
#endregion
}
}
}
......@@ -14,17 +14,20 @@ using ClientsLibrary.FileSupport;
namespace ClientsLibrary
{
//=====================================================================================
//
// 用途: 本窗口用于实现对本系统的客户端进行全面的远程更新的操作。
// 第一步: 先将新版本的所有客户端传送到服务器端进行覆盖。
// 第二步: 再将版本号传送到服务器进行更新,这样所有的客户端登录后就会自动更新新的版本了
//
//=====================================================================================
/************************************************************************************************
*
* 用途: 本窗口用于实现对本系统的客户端进行全面的远程更新的操作。
* 第一步: 先将新版本的所有客户端传送到服务器端进行覆盖。
* 第二步: 再将版本号传送到服务器进行更新,这样所有的客户端登录后就会自动更新新的版本了
*
**************************************************************************************************/
public partial class FormUpdateRemote : Form
{
#region Constructor
public FormUpdateRemote()
{
InitializeComponent();
......@@ -32,6 +35,11 @@ namespace ClientsLibrary
Icon = UserClient.GetFormWindowIcon();
}
#endregion
#region Select File And Upload
private void userButton_file_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
......@@ -53,6 +61,12 @@ namespace ClientsLibrary
}
}
#endregion
#region Update Version
private void userButton_version_Click(object sender, EventArgs e)
{
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.更新版本, textBox1.Text);
......@@ -66,9 +80,16 @@ namespace ClientsLibrary
}
}
#endregion
#region Form Load
private void FormUpdateRemote_Load(object sender, EventArgs e)
{
textBox1.Text = UserClient.CurrentVersion.ToString();
}
#endregion
}
}
<UserControl x:Class="软件系统客户端Wpf.Views.Palette"
<UserControl x:Class="软件系统客户端Wpf.Views.Controls.Palette"
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"
......
......@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace 软件系统客户端Wpf.Views
namespace 软件系统客户端Wpf.Views.Controls
{
/// <summary>
/// Palette.xaml 的交互逻辑
......
......@@ -23,12 +23,20 @@ namespace 软件系统客户端Wpf.Views.Controls
/// </summary>
public partial class UserClientRenderItem : UserControl
{
#region Constructor
public UserClientRenderItem()
{
InitializeComponent();
}
#endregion
#region Public Property
/// <summary>
/// 当前会话的唯一ID
/// </summary>
public string UniqueId
{
get
......@@ -37,6 +45,9 @@ namespace 软件系统客户端Wpf.Views.Controls
}
}
#endregion
#region Show Client Information
public void SetClientRender(NetAccount account)
{
......@@ -47,17 +58,18 @@ namespace 软件系统客户端Wpf.Views.Controls
Factory.Text = $"({account.Factory})";
Roles.Children.Clear();
if(account.Roles?.Length>0)
if (account.Roles?.Length > 0)
{
foreach(var m in account.Roles)
foreach (var m in account.Roles)
{
TextBlock block = new TextBlock();
block.Background = Brushes.LightSkyBlue;
block.Foreground = Brushes.Blue;
block.Margin = new Thickness(0, 0, 4, 0);
block.Text = m;
TextBlock block = new TextBlock
{
Background = Brushes.LightSkyBlue,
Foreground = Brushes.Blue,
Margin = new Thickness(0, 0, 4, 0),
Text = m
};
Roles.Children.Add(block);
}
}
......@@ -66,11 +78,14 @@ namespace 软件系统客户端Wpf.Views.Controls
Roles.Children.Add(new TextBlock());
}
// 启动线程池去显示头像
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(ThreadPoolLoadPortrait), account);
}
}
#endregion
#region Update Portrait
public void UpdatePortrait(string userName)
{
......@@ -79,6 +94,7 @@ namespace 软件系统客户端Wpf.Views.Controls
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(ThreadPoolLoadPortrait), netAccount);
}
}
private void ThreadPoolLoadPortrait(object obj)
{
// 向服务器请求小头像
......@@ -102,12 +118,17 @@ namespace 软件系统客户端Wpf.Views.Controls
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
UserClient.LogNet?.WriteException("Thread Download Portrait Failed", ex);
}
}
}
#endregion
#region Pricvate Member
private NetAccount netAccount = null;
#endregion
}
}
<UserControl x:Class="软件系统客户端Wpf.Views.UserFileRenderItem"
<UserControl x:Class="软件系统客户端Wpf.Views.Controls.UserFileRenderItem"
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"
......
......@@ -20,7 +20,7 @@ using System.IO;
using System.Net;
using ClientsLibrary.FileSupport;
namespace 软件系统客户端Wpf.Views
namespace 软件系统客户端Wpf.Views.Controls
{
/// <summary>
/// UserFileRenderItem.xaml 的交互逻辑
......
......@@ -21,14 +21,18 @@ namespace 软件系统客户端Wpf.Views
/// </summary>
public partial class UserChat : UserControl
{
#region Constructor
public UserChat(Action<string> send)
{
InitializeComponent();
SendString = send;
}
#endregion
#region Add Chat Show
private Action<string> SendString = null;
public void DealwithReceive(string str)
{
......@@ -41,6 +45,7 @@ namespace 软件系统客户端Wpf.Views
}
ScrollToDown();
}
/// <summary>
/// 新增聊天的历史记录
/// </summary>
......@@ -62,11 +67,31 @@ namespace 软件系统客户端Wpf.Views
ScrollToDown();
}
#endregion
#region Chat Focus Scroll
public void InputFocus()
{
//textBox1.Focus();
}
/// <summary>
/// 光标滚动到最底端
/// </summary>
public void ScrollToDown()
{
TextBox_ChatHistory.ScrollToEnd();
}
#endregion
#region Text Send
private void Button_Click(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(TextBox_Send.Text))
......@@ -76,27 +101,22 @@ namespace 软件系统客户端Wpf.Views
}
}
private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
//按下Enter键后进行发送数据到服务器
if (!string.IsNullOrEmpty(TextBox_Send.Text))
if (e.Key == Key.Enter)
{
if (e.Key == Key.Enter)
{
SendString?.Invoke(TextBox_Send.Text);
TextBox_Send.Text = "";
}
Button_Click(sender, new RoutedEventArgs());
}
}
#endregion
#region Private Member
/// <summary>
/// 光标滚动到最底端
/// </summary>
public void ScrollToDown()
{
TextBox_ChatHistory.ScrollToEnd();
}
private Action<string> SendString = null;
#endregion
}
}
......@@ -18,6 +18,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using 软件系统客户端Wpf.Views.Controls;
namespace 软件系统客户端Wpf.Views
{
......
......@@ -6,6 +6,7 @@
xmlns:materialDesignColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
xmlns:local="clr-namespace:软件系统客户端Wpf.Views"
xmlns:local1="clr-namespace:软件系统客户端Wpf.Views.Controls"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="400" Loaded="UserControl_Loaded">
<UserControl.Resources>
......@@ -84,7 +85,7 @@
<DockPanel>
<wpf:Card DockPanel.Dock="Top" Margin="2,0,2,0">
<DockPanel>
<local:Palette DockPanel.Dock="Left" Width="200" />
<local1:Palette DockPanel.Dock="Left" Width="200" />
<TextBlock Margin="16" TextWrapping="Wrap" VerticalAlignment="Center">这是你当前的主题配色,可以在app.xaml中进行配置和初始化,
也可以在运行的时候进行更改。</TextBlock>
</DockPanel>
......
......@@ -78,23 +78,23 @@
<Compile Include="Views\Controls\UserClientRenderItem.xaml.cs">
<DependentUpon>UserClientRenderItem.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Palette.xaml.cs">
<Compile Include="Views\Controls\Palette.xaml.cs">
<DependentUpon>Palette.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PaletteSelectorViewModel.cs" />
<Compile Include="Views\UserChat.xaml.cs">
<Compile Include="Views\UIControls\UserChat.xaml.cs">
<DependentUpon>UserChat.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UserFileRender.xaml.cs">
<Compile Include="Views\UIControls\UserFileRender.xaml.cs">
<DependentUpon>UserFileRender.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UserFileRenderItem.xaml.cs">
<Compile Include="Views\Controls\UserFileRenderItem.xaml.cs">
<DependentUpon>UserFileRenderItem.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UserHome.xaml.cs">
<Compile Include="Views\UIControls\UserHome.xaml.cs">
<DependentUpon>UserHome.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UserPaletteSelector.xaml.cs">
<Compile Include="Views\UIControls\UserPaletteSelector.xaml.cs">
<DependentUpon>UserPaletteSelector.xaml</DependentUpon>
</Compile>
<Page Include="LoginWindow.xaml">
......@@ -120,27 +120,27 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Palette.xaml">
<Page Include="Views\Controls\Palette.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\UserChat.xaml">
<Page Include="Views\UIControls\UserChat.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\UserFileRender.xaml">
<Page Include="Views\UIControls\UserFileRender.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\UserFileRenderItem.xaml">
<Page Include="Views\Controls\UserFileRenderItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\UserHome.xaml">
<Page Include="Views\UIControls\UserHome.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\UserPaletteSelector.xaml">
<Page Include="Views\UIControls\UserPaletteSelector.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册