Category: WP7 Dev Tips&Tricks

Uploading files to remote server (with multiple parameters) – RestSharp

In this post I will explain how to, in an easy way, upload files to remote server using “POST” http method.

To accomplish uploading file to remote server, without additional parameters, we can use WebClient class, which is fairly easy to use, but for POST request where we send file and additional parameters we will have to use HttpWebRequest class which is quite complicated for this purpose, or, as in our case, use third-party libraries.

Some of the available libraries:

In this example we will use RestSharp. Continue reading

Detect Dark/Light theme

In this post I will show how to detect which theme (dark/light) user selected in system settings. When designing your application, as long as you don’t change the default brushes, it is possible that you wont need this at all, because operating system will automatically adjust your application colors to match the colors defined by the Dark or Light theme.

With that said, there are times you may need this, either you made some custom control and you want to be theme-aware or you want to your app to look different depending on the theme selection. Continue reading

Built-in Progress Indicator in System Tray

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. Continue reading