性能组件移动到公共组件中,在服务器端和客户端提供一致的呈现。

This commit is contained in:
dathlin
2017-07-02 18:48:35 +08:00
parent 0f84aef54c
commit 5afc21e054
8 changed files with 63 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
namespace
namespace CommonLibrary
{
partial class FormSuper
{
@@ -36,18 +36,18 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(298, 18);
this.label1.Location = new System.Drawing.Point(12, 11);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 17);
this.label1.Size = new System.Drawing.Size(92, 17);
this.label1.TabIndex = 0;
this.label1.Text = "对象内存图形";
this.label1.Text = "对象内存图形";
//
// pictureBox1
//
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Location = new System.Drawing.Point(301, 38);
this.pictureBox1.Location = new System.Drawing.Point(15, 38);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(503, 380);
this.pictureBox1.Size = new System.Drawing.Size(789, 380);
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
//

View File

@@ -7,13 +7,14 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace
namespace CommonLibrary
{
public partial class FormSuper : Form
{
public FormSuper()
public FormSuper(Func<int[]> getDataFunction)
{
InitializeComponent();
GetDataFunction = getDataFunction;
}
private void FormSuper_Load(object sender, EventArgs e)
@@ -37,25 +38,22 @@ namespace 软件系统客户端模版
IsWindowShow = false;
}
private Func<int[]> GetDataFunction = null;
private bool IsWindowShow { get; set; }
private void Timer_Tick(object sender, EventArgs e)
{
HslCommunication.OperateResultBytes result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode., new byte[0]);
//解析
if (result.IsSuccess)
if (GetDataFunction != null)
{
int[] data = new int[result.Content.Length / 4];
for (int i = 0; i < data.Length; i++)
int[] data = GetDataFunction();
if (data != null)
{
data[i] = BitConverter.ToInt32(result.Content, i * 4);
}
if (IsWindowShow)
{
pictureBox1.Image?.Dispose();
pictureBox1.Image = HslCommunication.BasicFramework.SoftPainting.GetGraphicFromArray(data, pictureBox1.Width - 2, pictureBox1.Height - 2, 7, Color.Blue);
if (IsWindowShow)
{
pictureBox1.Image?.Dispose();
pictureBox1.Image = HslCommunication.BasicFramework.SoftPainting.GetGraphicFromArray(data, pictureBox1.Width - 2, pictureBox1.Height - 2, 7, Color.Blue);
}
}
}
}

View File

@@ -67,6 +67,12 @@
</Compile>
<Compile Include="AccountSupport\ServerAccount.cs" />
<Compile Include="AccountSupport\UserAccount.cs" />
<Compile Include="BasicSupport\FormSuper.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BasicSupport\FormSuper.Designer.cs">
<DependentUpon>FormSuper.cs</DependentUpon>
</Compile>
<Compile Include="BasicSupport\FormUpdateLog.cs">
<SubType>Form</SubType>
</Compile>
@@ -97,6 +103,9 @@
<EmbeddedResource Include="AccountSupport\FormPasswordModify.resx">
<DependentUpon>FormPasswordModify.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BasicSupport\FormSuper.resx">
<DependentUpon>FormSuper.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BasicSupport\FormUpdateLog.resx">
<DependentUpon>FormUpdateLog.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -270,7 +270,25 @@ namespace 软件系统客户端模版
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
using (FormSuper fs = new FormSuper())
using (FormSuper fs = new FormSuper(() =>
{
OperateResultBytes result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode., new byte[0]);
//解析
if (result.IsSuccess)
{
int[] data = new int[result.Content.Length / 4];
for (int i = 0; i < data.Length; i++)
{
data[i] = BitConverter.ToInt32(result.Content, i * 4);
}
return data;
}
else
{
return null;
}
}))
{
fs.ShowDialog();
}

View File

@@ -83,12 +83,6 @@
<Compile Include="FormRegisterAccount.Designer.cs">
<DependentUpon>FormRegisterAccount.cs</DependentUpon>
</Compile>
<Compile Include="FormSuper.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormSuper.Designer.cs">
<DependentUpon>FormSuper.cs</DependentUpon>
</Compile>
<Compile Include="FormUpdateRemote.cs">
<SubType>Form</SubType>
</Compile>
@@ -125,9 +119,6 @@
<EmbeddedResource Include="FormRegisterAccount.resx">
<DependentUpon>FormRegisterAccount.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FormSuper.resx">
<DependentUpon>FormSuper.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FormUpdateRemote.resx">
<DependentUpon>FormUpdateRemote.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -304,12 +304,14 @@
//
this.label_GC_Memery.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label_GC_Memery.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label_GC_Memery.Cursor = System.Windows.Forms.Cursors.Hand;
this.label_GC_Memery.Location = new System.Drawing.Point(629, 37);
this.label_GC_Memery.Name = "label_GC_Memery";
this.label_GC_Memery.Size = new System.Drawing.Size(125, 17);
this.label_GC_Memery.TabIndex = 16;
this.label_GC_Memery.Text = "0";
this.label_GC_Memery.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.label_GC_Memery.Click += new System.EventHandler(this.label_GC_Memery_Click);
//
// label_Pm_Memery
//

View File

@@ -316,6 +316,18 @@ namespace 软件系统服务端模版
}
private void label_GC_Memery_Click(object sender, EventArgs e)
{
//点击了性能组件
using (FormSuper fs = new FormSuper(() =>
{
return SoftCachePerfomance.GetIntArray();
}))
{
fs.ShowDialog();
}
}
#endregion
#region
@@ -890,7 +902,7 @@ namespace 软件系统服务端模版
#region
private SoftCacheArrayInt SoftCachePerfomance = new SoftCacheArrayInt(400, 0);
private SoftCacheArrayInt SoftCachePerfomance = new SoftCacheArrayInt(500, 0);
private void AddPerfomace(long value)
{
@@ -1196,5 +1208,7 @@ namespace 软件系统服务端模版
}
#endregion
}
}