Progress ring not activating before slow function call
@crclayton You can do something like this:
private void DoSomething_Click(object sender, RoutedEventArgs e)
{
//Make Progress Ring Visible/active
Wait.IsActive = true;
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += worker_DoWork;
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
worker.RunWorkerAsync();
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
doSomething();
}
protected void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//Make Progress Ring inActive/hidden
Wait.IsActive = false;
}
Hi I followed the same process ! I got 1 Issue Stating that "the-calling-thread-cannot-access-this-object-because-a-different-thread-owns-it"
So I placed the Below Code
this.Dispatcher.Invoke((Action)(() =>
{
...// your code here.
}));
I set the Property of the Progress ring to visibility to Visibility.True
It was not showing the Progress Ring (It was not Activating ).
Again By default I set the property of Progress Ring to Visibility.True on Page Load itself
This Time doWorkerAsync() Method closes the Progress Ring
I can't reproduce it. What is your actual code?
Hi
I tried to show the Progress ring when my Background work continues. And I need to show it when my process start and need to close when my process end
I tried to achieve it by calling the method asynchronously by using the BackgroundWorker process
But Here when I call the method asynchronously (I had activated the progress ring (or) set the visibility property of the progress ring to True
(Main Issue is I am unable to show the Progress ring when My Background work is running)
In DoSomething_Click you shoud set IsActive = true; and in worker_RunWorkerCompleted you should set IsActive = false; and everything works. You should not set IsActive in worker_DoWork because that method must only do work.
@akshithrajesh290 Is this still a problem for you? It seems that this is not MahApps related...