System Tray ProgressIndicator in Windows Phone 7.5 or Mango phone

Windows Phone 7.5 (Mango) provides a Progress Indicator on System Tray to show progress of async operation.

clip_image001

ProgressIndicator is a dependency object and can be data bind to the System Tray. ProgressIndicator class is defined as below,

clip_image002

Using ProgressIndicator

To use ProgressIndicator, first you need to add the namespace,

clip_image003

And then create it as below,

clip_image004

On the async operation status you can set visibility to false.

clip_image005

Finally you need to set it to the System Tray or Status Bar as below,

clip_image006

Putting all together below listed source code will give you output shown earlier in the post.


using System.Windows.Media;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace PhoneApp2
{
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
SystemTray.SetIsVisible(this, true);
SystemTray.SetOpacity(this, 0.5);
SystemTray.SetBackgroundColor(this, Colors.Black);
SystemTray.SetForegroundColor(this, Colors.Blue);
ProgressIndicator progressIndicator = new ProgressIndicator();
progressIndicator.IsVisible = true;
progressIndicator.IsIndeterminate = true;
progressIndicator.Text = "Hey I am Progress Indicator";
SystemTray.SetProgressIndicator(this, progressIndicator);

}
}
}

 

In this way you can use system tray progress indicator. I hope this post was useful. Thanks for reading  Smile

If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.

About these ads

Check Windows Azure Roles instance running in Emulator?

SDK :  Windows Azure SDK 1.5

In Build Windows Azure SDK 1.5 got announced. Windows Azure SDK 1.5 allows us to check whether Roles are running in emulator or not?

Static method IsEmulated returns Boolean value after checking whether Role instance is running in emulator or not.

clip_image001

Signature of IsEmulated is as below and it is part of the class RoleEnvironment

image

You can check running instance is in emulator or not as below,


bool isRunningInEmulator = RoleEnvironment.IsEmulated;
if (isRunningInEmulator)
Label1.Text = "Running in Emulator";
else
Label1.Text = "Hey you are on Cloud";

 

I hope this post was useful. Thanks for reading  Smile

If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.

F Sharp for beginners: Modules in F #

List of articles of F Sharp beginner series

All the codes you write in F Sharp are by default in a MODULE, regardless of the fact that whether you explicitly define a module or not.

Anonymous Module

clip_image001

Anonymous module has the same name as of file name with first letter in upper case.

Let us say,

  1. you are writing codes inside a file called myfile.fs
  2. You have explicitly not given a module name.
  3. Inside the file myfile.fs, you have code as below

 

clip_image002

4. By default module for above code would be Myfile (same as the file name of the code with first letter in upper case)

image

Creating Module

Explicitly Module name can be given by using the keyword “Module” .

clip_image004

Now if you want to access variable myNumber in some other module then you will access as below,

clip_image005

Creating Nested Modules

You can create nested modules by using equal to (=) sign with the module name.

clip_image006

In above code we have defined nested modules. You can access myNumber1 variable as below,

clip_image008

In other module you will find inellisense also working,

clip_image009

This was all about Modules in F sharp.

I hope this post was useful. Thanks for reading Smile

List of articles of F Sharp beginner series

 

If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.