mirror of
https://github.com/farcasclaudiu/SmartThreadPool.git
synced 2026-06-22 09:01:19 +03:00
Added refactorings suggested by Simon Cropp
This commit is contained in:
+7
-12
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Amib.Threading;
|
||||
using System.Threading;
|
||||
@@ -26,11 +21,11 @@ namespace STPCEDemo
|
||||
|
||||
uiTimer = new System.Windows.Forms.Timer();
|
||||
uiTimer.Interval = 1000;
|
||||
uiTimer.Tick += new EventHandler(uiTimer_Tick);
|
||||
uiTimer.Tick += uiTimer_Tick;
|
||||
|
||||
wiTimer = new System.Windows.Forms.Timer();
|
||||
wiTimer.Interval = 1000;
|
||||
wiTimer.Tick += new EventHandler(wiTimer_Tick);
|
||||
wiTimer.Tick += wiTimer_Tick;
|
||||
//Debug.WriteLine("Form Thread Priority is " + (int)GetCurrentThreadPriority());
|
||||
}
|
||||
|
||||
@@ -50,11 +45,11 @@ namespace STPCEDemo
|
||||
int inUse = _stp.InUseThreads;
|
||||
int inPool = _stp.ActiveThreads;
|
||||
|
||||
this.usageHistoryControl1.AddValues(inUse, inPool);
|
||||
this.usageControl1.Value1 = inUse;
|
||||
this.usageControl1.Value2 = inPool;
|
||||
this.lblThreadsInUse.Text = inUse.ToString();
|
||||
this.lblThreadsInPool.Text = inPool.ToString();
|
||||
usageHistoryControl1.AddValues(inUse, inPool);
|
||||
usageControl1.Value1 = inUse;
|
||||
usageControl1.Value2 = inPool;
|
||||
lblThreadsInUse.Text = inUse.ToString();
|
||||
lblThreadsInPool.Text = inPool.ToString();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
|
||||
namespace STPCEDemo
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace STPCEDemo
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
|
||||
+12
-16
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using STPCEDemo;
|
||||
|
||||
@@ -12,7 +8,7 @@ namespace UsageControl
|
||||
/// <summary>
|
||||
/// Summary description for UsageControl.
|
||||
/// </summary>
|
||||
public class UsageControl : System.Windows.Forms.UserControl
|
||||
public class UsageControl : UserControl
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
@@ -83,7 +79,7 @@ namespace UsageControl
|
||||
Width = fixedWidth;
|
||||
rows = (ClientRectangle.Height / 4) - 1;
|
||||
// Invalidate the control to get a repaint.
|
||||
this.Invalidate();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
@@ -99,7 +95,7 @@ namespace UsageControl
|
||||
|
||||
int emptyCount = rows - Math.Max(filledCount1, filledCount2);
|
||||
|
||||
int i = 0;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < filledCount1; ++i)
|
||||
{
|
||||
@@ -176,7 +172,7 @@ namespace UsageControl
|
||||
}
|
||||
|
||||
// Invalidate the control to get a repaint.
|
||||
this.Invalidate();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,17 +306,17 @@ namespace UsageControl
|
||||
int PenWidth = (int)Pens.White.Width;
|
||||
|
||||
g.DrawLine(Pens.DarkGray,
|
||||
this.ClientRectangle.Left, this.ClientRectangle.Top,
|
||||
this.ClientRectangle.Width - PenWidth, this.ClientRectangle.Top);
|
||||
ClientRectangle.Left, ClientRectangle.Top,
|
||||
ClientRectangle.Width - PenWidth, ClientRectangle.Top);
|
||||
g.DrawLine(Pens.DarkGray,
|
||||
this.ClientRectangle.Left, this.ClientRectangle.Top,
|
||||
this.ClientRectangle.Left, this.ClientRectangle.Height - PenWidth);
|
||||
ClientRectangle.Left, ClientRectangle.Top,
|
||||
ClientRectangle.Left, ClientRectangle.Height - PenWidth);
|
||||
g.DrawLine(Pens.White,
|
||||
this.ClientRectangle.Left, this.ClientRectangle.Height - PenWidth,
|
||||
this.ClientRectangle.Width - PenWidth, this.ClientRectangle.Height - PenWidth);
|
||||
ClientRectangle.Left, ClientRectangle.Height - PenWidth,
|
||||
ClientRectangle.Width - PenWidth, ClientRectangle.Height - PenWidth);
|
||||
g.DrawLine(Pens.White,
|
||||
this.ClientRectangle.Width - PenWidth, this.ClientRectangle.Top,
|
||||
this.ClientRectangle.Width - PenWidth, this.ClientRectangle.Height - PenWidth);
|
||||
ClientRectangle.Width - PenWidth, ClientRectangle.Top,
|
||||
ClientRectangle.Width - PenWidth, ClientRectangle.Height - PenWidth);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using STPCEDemo;
|
||||
|
||||
@@ -11,7 +8,7 @@ namespace UsageControl
|
||||
/// <summary>
|
||||
/// Summary description for UsageHistoryControl.
|
||||
/// </summary>
|
||||
public class UsageHistoryControl : System.Windows.Forms.UserControl
|
||||
public class UsageHistoryControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -94,7 +91,7 @@ namespace UsageControl
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
// Invalidate the control to get a repaint.
|
||||
this.Invalidate();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
@@ -184,7 +181,7 @@ namespace UsageControl
|
||||
max = value;
|
||||
|
||||
// Invalidate the control to get a repaint.
|
||||
this.Invalidate();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user