mirror of
https://github.com/farcasclaudiu/SmartThreadPool.git
synced 2026-06-22 09:01:19 +03:00
v2.0
SmartThreadPool v2.0
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace UsageControl.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UsageControl.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
namespace UsageControl
|
||||
{
|
||||
partial class QueueUsageControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Enabled = true;
|
||||
this.timer1.Interval = 500;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// QueueUsageControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.Name = "QueueUsageControl";
|
||||
this.Size = new System.Drawing.Size(167, 247);
|
||||
this.Resize += new System.EventHandler(this.QueueUsageControl_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
|
||||
namespace UsageControl
|
||||
{
|
||||
public partial class QueueUsageControl : UserControl
|
||||
{
|
||||
private List<QueueUsageEntry> _queuedItems;
|
||||
private int _maxItemsVisible = 0;
|
||||
private int _lastVisibleItemIndex = 0;
|
||||
private int _itemHeight = 0;
|
||||
private Dictionary<Color, Bitmap> _imagesCache = new Dictionary<Color, Bitmap>();
|
||||
private GraphicsPath _pathBorder;
|
||||
private RectangleF [] _slots;
|
||||
private bool _invalidate = true;
|
||||
|
||||
public QueueUsageControl()
|
||||
{
|
||||
//Debug.WriteLine("QueueUsageControl");
|
||||
|
||||
EnableDoubleBuffering();
|
||||
|
||||
Reset();
|
||||
|
||||
InitializeComponent();
|
||||
ControlRezised();
|
||||
}
|
||||
|
||||
public static Bitmap GenerateItemImage(string text, Color color, int width, int height, Font font)
|
||||
{
|
||||
//Debug.WriteLine("GenerateItemImage");
|
||||
|
||||
Bitmap itemImage = null;
|
||||
Rectangle rc = new Rectangle(0, 0, width, height);
|
||||
itemImage = new Bitmap(rc.Width, rc.Height);
|
||||
|
||||
/// Create button
|
||||
rc.Inflate(-3, -3);
|
||||
GraphicsPath path1 = GetPath(rc, 10);
|
||||
rc.Inflate(0, 6);
|
||||
LinearGradientBrush br1 = new LinearGradientBrush(rc, color, Color.White, LinearGradientMode.Vertical);
|
||||
rc.Inflate(0, -6);
|
||||
|
||||
/// Create shadow
|
||||
Rectangle rc2 = rc;
|
||||
rc2.Offset(8, 8);
|
||||
GraphicsPath path2 = GetPath(rc2, 20);
|
||||
PathGradientBrush br2 = new PathGradientBrush(path2);
|
||||
br2.CenterColor = ControlPaint.DarkDark(Color.Silver);
|
||||
br2.SurroundColors = new Color[] { Color.White };
|
||||
|
||||
/// Create bubble
|
||||
Rectangle rc3 = rc;
|
||||
rc3.Inflate(-15, -rc.Height / 3);
|
||||
rc3.Y = rc3.Y - 2;
|
||||
//rc3.Height = rc3.Height;
|
||||
GraphicsPath path3 = GetPath(rc3, rc3.Height);
|
||||
LinearGradientBrush br3 = new LinearGradientBrush(rc3, Color.FromArgb(255, Color.White), Color.FromArgb(0, Color.White), LinearGradientMode.Vertical);
|
||||
|
||||
itemImage = new Bitmap(width - 2, height);
|
||||
Graphics g = Graphics.FromImage(itemImage);
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.FillPath(br2, path2);
|
||||
g.FillPath(br1, path1);
|
||||
g.FillPath(br3, path3);
|
||||
|
||||
//SizeF size = g.MeasureString(text, font);
|
||||
//int fontHeight = (int)size.Height + 5;
|
||||
|
||||
//g.DrawString(
|
||||
// text,
|
||||
// font,
|
||||
// Brushes.Black,
|
||||
// new RectangleF((rc.Width - size.Width) / 2, 2, width, fontHeight));
|
||||
|
||||
return itemImage;
|
||||
}
|
||||
|
||||
private Bitmap GetItemsImage(Color color)
|
||||
{
|
||||
//Debug.WriteLine("GetItemsImage");
|
||||
|
||||
Bitmap itemImage = null;
|
||||
|
||||
if (!_imagesCache.ContainsKey(color))
|
||||
{
|
||||
Rectangle rc = new Rectangle(0, 0, this.Width, _itemHeight);
|
||||
itemImage = new Bitmap(rc.Width, rc.Height);
|
||||
|
||||
/// Create button
|
||||
rc.Inflate(-3, -3);
|
||||
GraphicsPath path1 = GetPath(rc, 10);
|
||||
rc.Inflate(0, 6);
|
||||
LinearGradientBrush br1 = new LinearGradientBrush(rc, color, Color.White, LinearGradientMode.Vertical);
|
||||
rc.Inflate(0, -6);
|
||||
|
||||
/// Create shadow
|
||||
Rectangle rc2 = rc;
|
||||
rc2.Offset(8, 8);
|
||||
GraphicsPath path2 = GetPath(rc2, 20);
|
||||
PathGradientBrush br2 = new PathGradientBrush(path2);
|
||||
br2.CenterColor = ControlPaint.DarkDark(Color.Silver);
|
||||
br2.SurroundColors = new Color[] { Color.White };
|
||||
|
||||
/// Create bubble
|
||||
Rectangle rc3 = rc;
|
||||
rc3.Inflate(-15, -rc.Height / 3);
|
||||
rc3.Y = rc3.Y - 2;
|
||||
//rc3.Height = rc3.Height;
|
||||
GraphicsPath path3 = GetPath(rc3, rc3.Height);
|
||||
LinearGradientBrush br3 = new LinearGradientBrush(rc3, Color.FromArgb(255, Color.White), Color.FromArgb(0, Color.White), LinearGradientMode.Vertical);
|
||||
|
||||
itemImage = new Bitmap(this.Width - 2, _itemHeight);
|
||||
Graphics g = Graphics.FromImage(itemImage);
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.FillPath(br2, path2);
|
||||
g.FillPath(br1, path1);
|
||||
g.FillPath(br3, path3);
|
||||
|
||||
_imagesCache[color] = itemImage;
|
||||
}
|
||||
|
||||
itemImage = _imagesCache[color];
|
||||
|
||||
return itemImage;
|
||||
}
|
||||
|
||||
private void EnableDoubleBuffering()
|
||||
{
|
||||
//Debug.WriteLine("EnableDoubleBuffering");
|
||||
|
||||
// Set the value of the double-buffering style bits to true.
|
||||
this.SetStyle(ControlStyles.DoubleBuffer |
|
||||
ControlStyles.UserPaint |
|
||||
ControlStyles.AllPaintingInWmPaint |
|
||||
ControlStyles.SupportsTransparentBackColor,
|
||||
true);
|
||||
this.UpdateStyles();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
//Debug.WriteLine("Reset");
|
||||
_queuedItems = new List<QueueUsageEntry>();
|
||||
}
|
||||
|
||||
//public void Queue(string text, Color color, bool blink)
|
||||
//{
|
||||
// //Debug.WriteLine("Queue");
|
||||
// _queuedItems.Add(new QueueUsageEntry(text, color, blink));
|
||||
// //this.Invalidate();
|
||||
//}
|
||||
|
||||
public void SetQueue(List<QueueUsageEntry> list)
|
||||
{
|
||||
//Debug.WriteLine("SetQueue");
|
||||
bool invalidate = false;
|
||||
|
||||
if (_queuedItems.Count != list.Count)
|
||||
{
|
||||
invalidate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int counter = Math.Min(list.Count, _maxItemsVisible);
|
||||
for (int i = 0; i < counter; i++)
|
||||
{
|
||||
if (_queuedItems[i] != list[i])
|
||||
{
|
||||
invalidate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidate)
|
||||
{
|
||||
//Debug.WriteLine("_invalidate = true");
|
||||
_queuedItems = list;
|
||||
_invalidate = invalidate;
|
||||
}
|
||||
|
||||
//_queuedItems = list;
|
||||
//_queuedItems.Clear();
|
||||
//foreach (QueueUsageEntry entry in list)
|
||||
//{
|
||||
// _queuedItems.Add(entry);
|
||||
//}
|
||||
//_invalidate = true;
|
||||
//this.Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
//Debug.WriteLine("OnPaint");
|
||||
|
||||
Bitmap bitmap = new Bitmap(Width, Height);
|
||||
Graphics g = Graphics.FromImage(bitmap);
|
||||
|
||||
g.FillPath(Brushes.White, _pathBorder);
|
||||
|
||||
int counter = Math.Min(_maxItemsVisible, _queuedItems.Count);
|
||||
|
||||
int i = 0;
|
||||
foreach (QueueUsageEntry entry in _queuedItems)
|
||||
{
|
||||
if (i > counter)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//int top = 0;
|
||||
//int bottom = 0;
|
||||
//if (topdown)
|
||||
//{
|
||||
// bottom = 1;
|
||||
// top = bottom;
|
||||
// top += i * _itemHeight;
|
||||
// bottom += (i + 1) * _itemHeight;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// bottom = this.Height - 1;
|
||||
// top = bottom;
|
||||
// bottom -= i * _itemHeight;
|
||||
// top -= (i + 1) * _itemHeight;
|
||||
//}
|
||||
|
||||
//g.DrawLine(Pens.Black, 0, top, this.Width, top);
|
||||
|
||||
|
||||
string text = (entry.IsExecuting ? ">" : "") + entry.Text;
|
||||
if (i == _lastVisibleItemIndex)
|
||||
{
|
||||
text = "(" + (_queuedItems.Count - _maxItemsVisible) + ")...";
|
||||
}
|
||||
|
||||
SizeF size = g.MeasureString(entry.Text, this.Font);
|
||||
//Debug.WriteLine(size.Width);
|
||||
|
||||
Bitmap itemImage = GetItemsImage(entry.Color);
|
||||
|
||||
RectangleF slot = _slots[i];
|
||||
|
||||
//g.DrawImage(itemImage, -1, top);
|
||||
g.DrawImage(itemImage, -1, slot.Top-2);
|
||||
|
||||
//g.DrawString(text, this.Font, Brushes.Black, new RectangleF((this.Width - size.Width) / 2, top + 2, this.Width, bottom));
|
||||
g.DrawString(text, this.Font, Brushes.Black, slot);
|
||||
++i;
|
||||
}
|
||||
|
||||
g.DrawPath(Pens.Black, _pathBorder);
|
||||
//g.DrawRectangle(Pens.Black, border);
|
||||
|
||||
e.Graphics.DrawImage(bitmap, 0, 0);
|
||||
}
|
||||
|
||||
private static GraphicsPath GetPath(Rectangle rc, int r)
|
||||
{
|
||||
//Debug.WriteLine("GetPath");
|
||||
int x = rc.X, y = rc.Y, w = rc.Width, h = rc.Height;
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddArc(x, y, r, r, 180, 90); //Upper left corner
|
||||
path.AddArc(x + w - r, y, r, r, 270, 90); //Upper right corner
|
||||
path.AddArc(x + w - r, y + h - r, r, r, 0, 90); //Lower right corner
|
||||
path.AddArc(x, y + h - r, r, r, 90, 90); //Lower left corner
|
||||
path.CloseFigure();
|
||||
return path;
|
||||
}
|
||||
|
||||
private void ControlRezised()
|
||||
{
|
||||
//Debug.WriteLine("ControlRezised");
|
||||
Graphics g = Graphics.FromHwnd(this.Handle);
|
||||
SizeF size = g.MeasureString("X", this.Font);
|
||||
g.Dispose();
|
||||
_itemHeight = (int)size.Height + 5;
|
||||
_maxItemsVisible = this.Height / _itemHeight - 1;
|
||||
_lastVisibleItemIndex = _maxItemsVisible;
|
||||
_imagesCache = new Dictionary<Color, Bitmap>();
|
||||
|
||||
Rectangle border = new Rectangle(0, 0, this.ClientRectangle.Width - 1, this.ClientRectangle.Height - 1);
|
||||
_pathBorder = GetPath(border, 20);
|
||||
|
||||
PrepareSlots();
|
||||
|
||||
}
|
||||
|
||||
private void PrepareSlots()
|
||||
{
|
||||
bool topdown = true;
|
||||
_slots = new RectangleF[_maxItemsVisible+5];
|
||||
for (int i = 0; i < _slots.Length; i++)
|
||||
{
|
||||
int top = 0;
|
||||
int bottom = 0;
|
||||
if (topdown)
|
||||
{
|
||||
bottom = 1;
|
||||
top = bottom;
|
||||
top += i * _itemHeight;
|
||||
bottom += (i + 1) * _itemHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
bottom = this.Height - 1;
|
||||
top = bottom;
|
||||
bottom -= i * _itemHeight;
|
||||
top -= (i + 1) * _itemHeight;
|
||||
}
|
||||
|
||||
_slots[i] = new RectangleF((this.Width - 55) / 2, top + 2, this.Width, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
private void QueueUsageControl_Resize(object sender, EventArgs e)
|
||||
{
|
||||
//Debug.WriteLine("QueueUsageControl_Resize");
|
||||
ControlRezised();
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (_invalidate)
|
||||
{
|
||||
_invalidate = false;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace UsageControl
|
||||
{
|
||||
public partial class QueueUsageControl
|
||||
{
|
||||
public class QueueUsageEntry
|
||||
{
|
||||
private string _text;
|
||||
private Color _color;
|
||||
private bool _isExecuting;
|
||||
|
||||
public QueueUsageEntry(
|
||||
string text,
|
||||
Color color) : this (text, color, false)
|
||||
{
|
||||
}
|
||||
|
||||
public QueueUsageEntry(
|
||||
string text,
|
||||
Color color,
|
||||
bool blink)
|
||||
{
|
||||
_text = text;
|
||||
_color = color;
|
||||
_isExecuting = blink;
|
||||
}
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return _text; }
|
||||
}
|
||||
|
||||
public bool IsExecuting
|
||||
{
|
||||
get { return _isExecuting; }
|
||||
set { _isExecuting = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,16 @@
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseCE|AnyCPU' ">
|
||||
<OutputPath>bin\ReleaseCE\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>
|
||||
</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
@@ -94,12 +104,35 @@
|
||||
<Compile Include="AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="QueueUsageControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="QueueUsageControl.Designer.cs">
|
||||
<DependentUpon>QueueUsageControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="QueueUsageEntry.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UsageControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UsageHistoryControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="QueueUsageControl.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>QueueUsageControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UsageControl.resx">
|
||||
<DependentUpon>UsageControl.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
Reference in New Issue
Block a user