|
//*****************************************************************************
// Description.....Service Bus Tester
//
// Author..........Roman Kiss, rkiss@pathcom.com
// Copyright © 2011 ATZ Consulting Inc. (see included license.rtf file)
//
// Date Created: 11/11/11
//
// Date Modified By Description
//-----------------------------------------------------------------------------
// 11/11/11 Roman Kiss Initial Revision
//
//*****************************************************************************
//
#region Namespaces
using System;
using System.Windows.Forms;
#endregion
namespace RKiss.Tools.ServiceBusTester
{
public class ProgressNode : System.Timers.Timer, IDisposable
{
Form control;
System.Windows.Forms.TreeNode node;
int counter = 0;
public int EndImageIndex { get; set; }
public ProgressNode(Form control, System.Windows.Forms.TreeNode selectedNode, int baseImageIndex, int endImageIndex)
{
this.node = selectedNode;
this.control = control;
this.EndImageIndex = endImageIndex;
this.Elapsed += delegate(object sender, System.Timers.ElapsedEventArgs e)
{
int index = baseImageIndex + (counter & 7);
control.InvokeEx(() => node.SelectedImageIndex = node.ImageIndex = index);
counter++;
};
this.Interval = 300;
this.Start();
this.Enabled = true;
}
void IDisposable.Dispose()
{
this.Stop();
this.Enabled = false;
control.InvokeEx(() => node.SelectedImageIndex = node.ImageIndex = this.EndImageIndex);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.