Click here to Skip to main content
15,885,782 members
Articles / Hosted Services / Azure

Azure Service Bus Tester

Rate me:
Please Sign up or sign in to vote.
4.96/5 (16 votes)
27 Dec 2014CPOL28 min read 89.9K   2.9K   24  
This article describes the design and implementation of the small tool, tester for Windows Azure Service Bus Messaging.
//*****************************************************************************
//    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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions