Skip to content

Commit

Permalink
细节修复。第一个release
Browse files Browse the repository at this point in the history
  • Loading branch information
imengyu committed Feb 15, 2019
1 parent 5a882b1 commit 13b2ca2
Show file tree
Hide file tree
Showing 39 changed files with 1,625 additions and 870 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ obj/
bin/
Debug/
Debug_64/
Release/
Release_64/
depends.exe - 快捷方式.lnk
*.pdb
*.cache
Expand All @@ -25,5 +27,3 @@ depends.exe - 快捷方式.lnk
*.ipdb
*.enc
*.ini
Release_x86_1.2.rar
Release_x64_1.2.rar
2 changes: 1 addition & 1 deletion PCMgrLoader/PCMgrLoader.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerDebuggerType>Mixed</LocalDebuggerDebuggerType>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>select perf</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>select apphistory</LocalDebuggerCommandArguments>
<RemoteDebuggerWorkingDirectory>C:\Users\a\Desktop\Debug\</RemoteDebuggerWorkingDirectory>
<RemoteDebuggerConnection>RemoteWithoutAuthentication</RemoteDebuggerConnection>
<RemoteDebuggerDebuggerType>NativeOnly</RemoteDebuggerDebuggerType>
Expand Down
Binary file modified Release/Release_x86_1.3.2.6.zip
Binary file not shown.
Binary file modified Release_64/Release_x64_1.3.2.6.zip
Binary file not shown.
19 changes: 11 additions & 8 deletions TaskMgr/Ctls/PerformanceGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ public int DataAverage
/// </summary>
public int MaxValue {
get {
if (maxValue <= 0) maxValue = 100;
return maxValue;
}
set
{
maxValue = value;
if (maxValue <= 0) maxValue = 100;
}
}

Expand Down Expand Up @@ -208,10 +208,9 @@ protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
//g.SmoothingMode = SmoothingMode.AntiAlias;
bool hasOverflow = false;

if (LeftText != "") g.DrawString(LeftText, Font, TextBrush, 0, 0);
if (RightText != "") g.DrawString(RightText, Font, TextBrush, new Rectangle(0, 0, Width, TopTextHeight), stringFormatRight);
g.SmoothingMode = SmoothingMode.AntiAlias;

float single = 1.0F * Width / (60 - 1);
float division = 1.0F * (Height - TopTextHeight - BottomTextHeight) / MaxValue;
Expand Down Expand Up @@ -253,7 +252,7 @@ protected override void OnPaint(PaintEventArgs e)

pts[i + 1].X = offset + i * single;
pts[i + 1].Y = Height - BottomTextHeight - dataIem[i] * division - 1;
if (pts[i + 1].Y < TopTextHeight) pts[i + 1].Y = TopTextHeight;
if (pts[i + 1].Y < TopTextHeight) { hasOverflow = true; }
}
if (lastDataAverage1_zeroCount != dataIem.Count) lastDataAverage1 /= dataIem.Count - lastDataAverage1_zeroCount;

Expand All @@ -276,7 +275,7 @@ protected override void OnPaint(PaintEventArgs e)

pts[i + 1].X = offset + i * single;
pts[i + 1].Y = Height - BottomTextHeight - dataIem2[i] * division - 1;
if (pts[i + 1].Y < TopTextHeight) pts[i + 1].Y = TopTextHeight;
if (pts[i + 1].Y < TopTextHeight) { hasOverflow = true; }
}
if(dataIem2.Count != lastDataAverage2_zeroCount) lastDataAverage2 /= dataIem2.Count - lastDataAverage2_zeroCount;

Expand All @@ -294,12 +293,16 @@ protected override void OnPaint(PaintEventArgs e)
if (MaxScaleText != "")
g.DrawString(MaxScaleText, Font, TextBrush, new Rectangle(Width - 90, y + 2, 90, 20), stringFormatRight);
}
if (hasOverflow)
g.FillRectangle(Brushes.White, 0, 0, Width, TopTextHeight - 1);

if (LeftText != "") g.DrawString(LeftText, Font, TextBrush, 0, 0);
if (RightText != "") g.DrawString(RightText, Font, TextBrush, new Rectangle(0, 0, Width, TopTextHeight), stringFormatRight);

if (LeftBottomText != "") g.DrawString(LeftBottomText, Font, TextBrush, 0, Height - BottomTextHeight + 2);
if (RightBottomText != "") g.DrawString(RightBottomText, Font, TextBrush, new Rectangle(20, Height - BottomTextHeight + 2, Width - 20, BottomTextHeight), stringFormatRight);


g.DrawRectangle(DrawPen, new Rectangle(0, TopTextHeight, Width - 1, Height - 1 - TopTextHeight - BottomTextHeight));
g.DrawRectangle(DrawPen, 0, TopTextHeight, Width - 1, Height - 1 - TopTextHeight - BottomTextHeight);
}

}
Expand Down
64 changes: 46 additions & 18 deletions TaskMgr/Ctls/PerformanceList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void Items_ItemAdd(PerformanceListItem obj)

private void LoadAllFonts()
{
hugeTextFont = new Font(Font.FontFamily, 10.5f);
hugeTextFont = new Font(Font.FontFamily, 11.5f);
smallTextFont = new Font(Font.FontFamily, 9f);
}

Expand Down Expand Up @@ -161,27 +161,28 @@ private void DrawItem(Graphics g, PerformanceListItem it, int y)
g.ReleaseHdc();
}

g.DrawString(it.Name, hugeTextFont, Brushes.Black, drawDataGrid ? 80 : 35, y + 10);
g.DrawString(it.SmallText, smallTextFont, Brushes.Black, drawDataGrid ? 80 : 35, y + 30);
g.DrawString(it.Name, hugeTextFont, Brushes.Black, drawDataGrid ? 80 : 35, y + 8);
g.DrawString(it.SmallText, smallTextFont, Brushes.Black, drawDataGrid ? 80 : 35, y + 33);

DrawItemDataGrid(g, it, y);
}
private void DrawItemDataGridData(Graphics g, PerformanceListItem it, List<PointF> ps, Pen p, Rectangle rect, float single, float division, float offset, int i, bool is2 = false)
{
float ypos = rect.Top + rect.Height - (((float)(is2 ? it.Data2[i] : it.Data[i]) / (float)it.MaxValue) * 100) * division;
if (ypos < rect.Top) ypos = rect.Top;
else if (ypos > rect.Bottom) ypos = rect.Bottom;
if (ypos > rect.Bottom) ypos = rect.Bottom;
ps.Add(new PointF(rect.Left + offset + i * single, ypos));
g.DrawLine(p, ps[ps.Count - 2], ps[ps.Count - 1]);
}
private void DrawItemDataGrid(Graphics g, PerformanceListItem it, int y)
{
Rectangle rect = new Rectangle(10, y + 10, 60, 40);
if (it.Gray && drawDataGrid) g.DrawRectangle(Pens.Gray, rect);
if (it.Gray && drawDataGrid) g.DrawRectangle(Pens.Gray, new Rectangle(10, y + 10, 60, 40));
else if (drawDataGrid)
{
g.FillRectangle(Brushes.White, rect);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Rectangle rect = new Rectangle(0, 0, 60, 40);

Graphics gx = Graphics.FromImage(it.DataGridCache);
gx.FillRectangle(Brushes.White, rect);
gx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

float single = 1.0F * rect.Width / (max_small_data_count - 1);
float division = 1.0F * rect.Height / 100;
Expand All @@ -196,12 +197,12 @@ private void DrawItemDataGrid(Graphics g, PerformanceListItem it, int y)
for (int i = 0; i < it.Data.Count; i++)
{
it.DataAvg1 += it.Data[i];
DrawItemDataGridData(g, it, ps, it.BasePen, rect, single, division, offset, i, false);
DrawItemDataGridData(gx, it, ps, it.BasePen, rect, single, division, offset, i, false);
}
it.DataAvg1 /= it.Data.Count;

ps.Add(new PointF(rect.Left + rect.Width, rect.Top + rect.Height));
g.FillClosedCurve(it.BgBrush, ps.ToArray(), System.Drawing.Drawing2D.FillMode.Alternate, 0f);
gx.FillClosedCurve(it.BgBrush, ps.ToArray(), System.Drawing.Drawing2D.FillMode.Alternate, 0f);

if (it.EnableData2)
{
Expand All @@ -211,15 +212,15 @@ private void DrawItemDataGrid(Graphics g, PerformanceListItem it, int y)
for (int i = 0; i < it.Data2.Count; i++)
{
it.DataAvg2 += it.Data2[i];
DrawItemDataGridData(g, it, ps, it.BasePen2, rect, single, division, offset, i, true);
DrawItemDataGridData(gx, it, ps, it.BasePen2, rect, single, division, offset, i, true);
}
it.DataAvg2 /= it.Data2.Count;
it.DataAvg = (it.DataAvg1 + it.DataAvg2) / 2;

if (it.BgBrush2 != Brushes.White)
{
ps.Add(new PointF(rect.Left + rect.Width, rect.Top + rect.Height));
g.FillClosedCurve(it.BgBrush2, ps.ToArray(), System.Drawing.Drawing2D.FillMode.Alternate, 0f);
gx.FillClosedCurve(it.BgBrush2, ps.ToArray(), System.Drawing.Drawing2D.FillMode.Alternate, 0f);
}
}
else it.DataAvg = it.DataAvg1;
Expand All @@ -230,7 +231,7 @@ private void DrawItemDataGrid(Graphics g, PerformanceListItem it, int y)
for (int i = 0; i < it.Data.Count; i++)
{
it.DataAvg1 += it.Data[i];
DrawItemDataGridData(g, it, ps, it.BasePen, rect, single, division, offset, i, false);
DrawItemDataGridData(gx, it, ps, it.BasePen, rect, single, division, offset, i, false);
}
it.DataAvg1 /= it.Data.Count;

Expand All @@ -242,7 +243,7 @@ private void DrawItemDataGrid(Graphics g, PerformanceListItem it, int y)
for (int i = 0; i < it.Data2.Count; i++)
{
it.DataAvg2 += it.Data2[i];
DrawItemDataGridData(g, it, ps, it.BasePen2, rect, single, division, offset, i, true);
DrawItemDataGridData(gx, it, ps, it.BasePen2, rect, single, division, offset, i, true);
}
it.DataAvg2 /= it.Data2.Count;
it.DataAvg = (it.DataAvg1 + it.DataAvg2) / 2;
Expand All @@ -254,7 +255,10 @@ private void DrawItemDataGrid(Graphics g, PerformanceListItem it, int y)
it.MaxValue = (int)it.AutoMaxCallback(it.DataAvg);

ps.Clear();
g.DrawRectangle(it.BorderPen, rect);
gx.DrawRectangle(it.BorderPen, 0, 0, rect.Width - 1, rect.Height - 1);
gx.Dispose();

g.DrawImage(it.DataGridCache, 10, y + 10);
}
else
{
Expand Down Expand Up @@ -491,7 +495,7 @@ protected override void OnPaint(PaintEventArgs e)
}

}
public class PerformanceListItem
public class PerformanceListItem : IDisposable
{
public delegate int GetMaxValCallback(int avg);

Expand All @@ -505,8 +509,11 @@ public PerformanceListItem()
Data2.Add(0);
Gray = false;
NoGridImage = Properties.Resources.pointCpu;
DataGridCache = new Bitmap(60, 40, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
}

public Bitmap DataGridCache { get; set; }

public Pen BorderPen { get; set; }
public Brush BgBrush { get; set; }
public Pen BasePen
Expand Down Expand Up @@ -572,7 +579,14 @@ public void AddData2(int d)
public bool Gray { get; set; }
public bool EnableData2 { get; set; } = false;
public bool EnableAutoMax { get; set; } = false;
public int MaxValue { get; set; } = 100;
public int MaxValue {
get { return maxValue; }
set
{
maxValue = value;
if (maxValue <= 0) maxValue = 100;
}
}
public int ItemY { get; set; }
public int ItemHeight { get { return 60; } }
public string SmallText { get; set; }
Expand All @@ -584,8 +598,22 @@ public override string ToString()
{
return Name;
}

void IDisposable.Dispose()
{
DataGridCache.Dispose();
BorderPen.Dispose();
BgBrush.Dispose();
BasePen.Dispose();
BgBrush2.Dispose();
BasePen2.Dispose();
dataIem.Clear();
dataIem2.Clear();
}

private bool b2 = false;
private bool b = false;
private int maxValue = 100;
private Pen basePen = null;
private Pen basePen2 = null;
private List<int> dataIem = null;
Expand Down
2 changes: 1 addition & 1 deletion TaskMgr/Ctls/PerformancePageDisk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void PageUpdate()
performanceGridSpeed.AddData(writeKB);

//刷新速度标尺
lastMaxSpeed = (int)(performanceGridSpeed.DataAverage * 0.7 + performanceGridSpeed.MaxData * 0.3) / 2;
lastMaxSpeed = (int)(performanceGridSpeed.DataAverage * 0.9 + performanceGridSpeed.MaxData * 0.1) / 2;

//刷新最大单位
if (lastMaxSpeed > performanceGridSpeed.MaxValue)
Expand Down
9 changes: 7 additions & 2 deletions TaskMgr/Ctls/PerformancePageNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public PerformancePageNet(IntPtr netadapter, bool isWifi, string name)
public UInt64 physicalMaxSpeed = 100000000;
private string currNetName = "";
private IntPtr currNet = IntPtr.Zero;
private int lastMaxSpeed = 100;
private int lastMaxSpeed = 0;
private int lastMaxSpeedUpload = 0;
private int lastMaxSpeedDownload = 0;
private uint maxSpeedOverflow = 100;
private uint maxpySpeed = 100;
private int outLinkQuality = 0;
Expand Down Expand Up @@ -71,7 +73,10 @@ public void PageUpdate()
performanceGrid.AddData((int)(receive / 1024 * 8));

//刷新速度标尺
lastMaxSpeed = (int)(performanceGrid.DataAverage * 0.7 + performanceGrid.MaxData * 0.3) / 2;
lastMaxSpeedDownload = (int)(performanceGrid.DataAverage1) / 2;
lastMaxSpeedUpload = (int)(performanceGrid.DataAverage2) / 2;
lastMaxSpeed = lastMaxSpeedDownload > lastMaxSpeedUpload ? lastMaxSpeedDownload : lastMaxSpeedUpload;

//刷新最大单位
if (lastMaxSpeed > performanceGrid.MaxValue)
{
Expand Down
24 changes: 13 additions & 11 deletions TaskMgr/Ctls/TaskMgrListHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,17 +517,18 @@ protected override void OnMouseLeave(EventArgs e)
{
if (enteredItem != null)
{
if (lastTooltipItem != null)
{
tipToolTip.Hide(this);
lastTooltipItem = null;
}
enteredItem.MouseEntered = false;
enteredItem = null;
Invalidate();
}
tipToolTip.Hide(this);
base.OnMouseLeave(e);
}
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
ShowToolTip();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Expand Down Expand Up @@ -598,6 +599,7 @@ protected override void OnPaint(PaintEventArgs e)

}


internal void RebulidColumnsIndexForInsert(int insertIndex, TaskMgrListHeaderItem insertItem)
{
insertItem.SetDisplayIndex(insertIndex);
Expand Down Expand Up @@ -651,9 +653,14 @@ private void ShowToolTip()
lastTooltipItem = enteredItem;
}
}
else if (enteredItem == null && lastTooltipItem != null)
{
tipToolTip.Hide(this);
lastTooltipItem = null;
}
else if (enteredItem != lastTooltipItem)
{
if (enteredItem!=null && !string.IsNullOrEmpty(enteredItem.ToolTip))
if (enteredItem != null && !string.IsNullOrEmpty(enteredItem.ToolTip))
{
tipToolTip.Show(enteredItem.ToolTip, this, enteredItem.X - xOffiest, Height + 5);
lastTooltipItem = enteredItem;
Expand All @@ -664,11 +671,6 @@ private void ShowToolTip()
lastTooltipItem = null;
}
}
else
{
tipToolTip.Hide(this);
lastTooltipItem = null;
}
}

public bool Vsitem(bool b = false)
Expand Down
Loading

0 comments on commit 13b2ca2

Please sign in to comment.