In this post I will show how to use built-in progress indicator which will be shown on top of the page (in system tray). Like I said it is built-in, all we have to do is call it when we need it. It is Mango only feature, so if you are developing for earlier versions, Progress Indicator will be unavailable.
Using Progress Indicator
Displaying Progress Indicator is fairly simple. All we have to do is create an instance of ProgressIndicator object and add it to system tray.
We can show Progress Indicator in two different modes: Indeterminate and Determinate. Indeterminate mode is when Progress Indicator is indicating that app is doing something in the background, but there is no progress shown (progress indicator is looping). Determinate mode is when progress is displayed.
To be able to use Progress indicator first thing to do is to add a using:
Show Indeterminate Progress Indicator
ProgressIndicator progInd = new ProgressIndicator(); progInd.IsIndeterminate = true; progInd.Text = "Indeterminate progress indicator sample"; progInd.IsVisible = true; SystemTray.SetProgressIndicator(this, progInd);
Hide Progress Indicator:
Showing progress indicator in tray with zero progress
progInd.IsIndeterminate = false; progInd.Text = "Determinate progress indicator sample"; progInd.Value = 0; progInd.IsVisible = true; SystemTray.SetProgressIndicator(this, progInd);
Adding progress value (value is in range: 0-1)
progInd.Value = progInd.Value + 0.1;
Hide progress indicator
Download source here.