Skip to content
| Marketplace
Sign in
Visual Studio>Templates>RuProgressBar
RuProgressBar

RuProgressBar

Klaus Ruttkowski

|
25,975 installs
| (1) | Free
Help for using ProgressBar control
Download

RuProgressBar

Insert reverence to

using RuFramework;  // Insert reference to RuFramework

Insert new Item

RuProgressBar

Here's an example of how RuProgressBar is called

private void Button1_Click(object sender, EventArgs e)
{
    Run_RuProgressBar();
}

Call your function


/// summary>
/// This function run a processing and display the progress with RuProgressBar
/// </summary>
public void Run_RuProgressBar()
{
    try
    {
        // Init RuProgressBar with message text in RuProgressBar
        RuProgressBar ruProgressBar = new RuProgressBar(Text = "RuProgressBar in 
              operation");
    // Just one example of an MyObject handed over (Dummy)
    object MyObject = null;

    // Handed down dummy object, number of passes and step(divisor)
    MyFunctionality myFunctionality = new MyFunctionality(MyObject, 1000000, 10);

    // Run application with RuProgressBar
    // In the example, a whole object containing the function is passed
    System.Threading.ThreadPool.QueueUserWorkItem(new 
         System.Threading.WaitCallback(myFunctionality.MyFunction), ruProgressBar);
    ruProgressBar.ShowDialog();
}
catch (Exception e)
{
    Console.WriteLine("An error occurred: '{0}'", e);
}

}

Here's the example of your functional object

public class MyFunctionality
{
    private int max = 0;
    private int divisor = 1;
    public MyFunctionality(object MyObject = null, int Max = 0, int Divisor = 1)
    {
        // Just one example of an MyObject handed over (Dummy)
        object myObject = MyObject;
    // Initiate the RuProgressBar with the maximum possible number of runs
    max = Max;

    // Only every n change should be displayed
    divisor = Divisor;
}
/// summary&gt;
/// Function of progress should appear 
/// &lt;/summary&gt;
public void MyFunction(object status)
{
    try
    {
        IProgressCallback callback = status as IProgressCallback;
        // Start the progressbar
        callback.Begin(0, max / divisor);
        // *******************************************
        // Here you enter what your function should do
        // *******************************************
        // Here is the handling for the myObject
        //
        // Process for example in a loop
        for (int i = 0; i &lt; max; i++)
        {
            if (i % divisor == 0 &amp; i &gt; 0)
            {
                // Change Progressbar
                callback.StepTo(i / divisor);
            }
        }
        // End process
        callback.End();
    }
    catch (System.FormatException)
    {
    }
}

}

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft