How can I display a loading control while a process is waiting for be finished?

Viewed 61390

I decided to use this third-party component to make a simple loading control in my windows form.

http://www.codeproject.com/Articles/14841/How-to-write-a-loading-circle-animation-in-NET

This works fine when turns on and off changing the property "Active" to true or false in a single request (one per time). The problem is when a process is waiting to be served, and I pretend to Active the loadingControl before the process starts and turn off when I "think" that the process has to be finished. When I do it, the image loading is shown as a static image. (Without animation).

I'm sorry for this question, I'm new in C#. But I think that I need to use Threads or something similar.

So my general code is this:

using [libraries here]...;
namespace [namespace here]
{
    Public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.loadingCircle1.Visible = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Thread t = new Thread(new ThreadStart(showLoading));
            this.loadingCircle1.Visible = true;
            t.Start();

            //Import an Excel

            t.Abort();
        }

        public void showLoading()
        {
            loadingCircle1.Active = true;
            loadingCircle1.RotationSpeed = 10;
        }
    }
}

But Always the Loading shows as a static image without the animation.

2 Answers
Related