Skip to content
wpdev

.NET / C#

wpdev (Page 2)

Trace page views with Application Insights

2014-10-29
By: Kevin Gosse
On: October 29, 2014
Tagged: C#, wpdev

A few weeks ago, I’ve decided to test Application InsightsApplication Insights with one of my Windows Phone apps. Application Insights is a library provided by Microsoft that allows you to easily collect usage and performance traces from your app and display them on your Visual Studio Online portal. The integration in a Windows Phone app is quite easy: reference the NuGet package, and call a method in your application constructor to initialize the component: If you’re using Visual Studio 2013, you can also install the Application Insights Tools for Visual Studio extension, that will take care of those steps for you. A lot of usefulRead More →

Pushing Telerik controls a bit further: keeping the RadWindow open when navigating to another page

2014-09-12
By: Kevin Gosse
On: September 12, 2014
Tagged: .NET, C#, wpdev

The RadWindow is a nice control for Windows Phone provided by Telerik. It allows you to display a popup, along with some neat helpers, especially for the popup placement. Unfortunately, I just ran along one of the limitations of this control. My application displays a list of pictures. When tapping on a picture, I use the RadWindow to display some detailed information on the picture. In the popup, there’s also a “fullscreen” button. When pressed, the button navigates to a new page, where the user can view the picture in full screen, and zoom to his convenience. So far, so good. That’s when I noticedRead More →

Give that memory back!

2013-11-11
By: Kevin Gosse
On: November 11, 2013
Tagged: .NET, C#, wpdev

A weird behavior (one more) I noticed on Windows Phone, thanks to a question on StackOverflow (once more). First, let’s create a simple Windows Phone application. The first page will contain three buttons: the first one navigates to another page, the second one displays the amount of memory used (by calling Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage), and the last one will forcefully call the garbage collector, wait for the finalizers to execute, and collect the memory freed by those finalizers: In the second page, we simply create a few objects and bind them to a grid. The sole purpose is to simulate a page that would use a largeRead More →

Pushing Telerik controls a bit further: pull to refresh

2013-08-16
By: Kevin Gosse
On: August 16, 2013
Tagged: Silverlight, Telerik, wpdev

While working on a new version of my ImageBoard Browser app (warning: shameless self-placement), I decided to try and use the pull-to-refresh feature integrated to the Telerik’s RadDataBoundListBox control. The pull-to-refresh is about automatically refreshing a list when the user scrolls to its end. It’s a feature a bit lacking in terms of discoverability, and it’s therefore recommended to add a few UI hints to help the user understand he can still scroll after reaching the end of the list. However, it’s a gesture that feels great at usage, bends into the UI flow, and saves a few precious pixels of screen space. Enabling theRead More →

Storage bug in MediaLibrary.SavePicture

2013-05-26
By: Kevin Gosse
On: May 26, 2013
Tagged: .NET, C#, Windows Phone 7, Windows Phone 8, wpdev

I’ve received many reports lately of users complaining of abnormal storage usage from one of my apps, Imageboard Browser.The application was in some cases storing hundreds of megabytes! I thought at first that it was just the “other storage” issue, but I did some further investigation just in case. After some trial and error and a bit of luck, I’ve discovered that the bug lies in the methods MediaLibrary.SavePicture and MediaLibrary.SavePictureToCameraRoll. As their name indicate, they are used to save a picture to the phone’s picture hub, and they do their job pretty well. Except that ever time you use them, a copy of yourRead More →

Memory leak with BitmapImage

2013-02-17
By: Kevin Gosse
On: February 17, 2013
Tagged: .NET, C#, Memory, profiling, Silverlight, Windows Phone 7, Windows Phone 8, wpdev

There’s a memory leak that has been bothering me for a while in my Imageboard Browser app. The scenario is simple: a slideshow feature, where a new picture is loaded from an url every few seconds. After a while, the app crashes with an OutOfMemory exception. I’ve never been able to find the source of the leak, so I settled for a dirty workaround consisting in loading a fake picture in the BitmapImage instance to force it to release the memory: It fixed the issue, but I didn’t dig much further. However, over the last few weeks I’ve seen many similar leaks reported on StackOverflow,Read More →

Programmatically terminate a Silverlight app

2012-10-31
By: Kevin Gosse
On: October 31, 2012
Tagged: .NET, C#, Silverlight, Windows Phone 8, wpdev

Exiting programmatically as always been an issue for Silverlight applications on Windows Phone 7. A few workaround existed, from throwing an exception to referencing a XNA assembly and using the ‘Game.Exit()’ method. Windows Phone 8 brings a new API, that can be used from Silverlight applications: ‘Application.Terminate()’ Using it is really straightforward: A word of advice though: calling this method will immediately kill your app. It means that the ‘Application.Closing’ event won’t be triggered, and the contents of the ‘IsolatedStorageSettings.ApplicationSettings’ dictionary won’t be automatically saved to the isolated storage. Therefore, if needed, don’t forget to save that dictionary before calling the ‘Terminate’ method:Read More →

Programmatically change the lock screen picture

2012-10-30
By: Kevin Gosse
On: October 30, 2012
Tagged: .NET, C#, Silverlight, Windows Phone 8, wpdev

Windows Phone 8 introduces a new API to allow apps to change the background picture displayed on the lock screen. The displayed picture can be picked from the application’s resources or from the isolated storage. To use this feature, you need first to declare it in the application’s manifest. Just add the following extension in the “Extensions” node: If you don’t already have an “Extensions” node in the manifest, you’ll have to add it at the same level as the “Capabilities” and “Tasks” nodes: Once the manifest is updated, there’s one remaining step before being able to change the wallpaper: the application must first askRead More →

Dynamically toggle PanoramaItem visibility

2012-07-01
By: Kevin Gosse
On: July 1, 2012
Tagged: .NET, C#, Silverlight, Windows Phone 7, wpdev

A strange issue with the Panorama control, that has been brought to my attention by @lancewmccarthy, and which has also been encountered by some people on StackOverflow. The original scenario was a bit too complex for a blog post, but we can reproduce it in a much simpler way. Create a new page, and add a panorama control called ‘Panorama’. Then add two PanoramaItem, and put a button in the first one: In the click event handler of the button, we toggle the visibility of the second item of the panorama: Start the application, try tapping on the button, and the visibility of the PanoramaItemRead More →

IsolatedStorageException when opening a file played by a MediaElement

2012-05-06
By: Kevin Gosse
On: May 6, 2012
Tagged: .NET, C#, Silverlight, Windows Phone 7, wpdev

Today we’ll dig a little into Windows Phone’s base class library, thanks to a question I found on stack overflow. The problem occurs with this simple code, used to load a music file from the isolated storage, and play it with a MediaElement: When executed for the first time, this code works fine. When executed a second time with the same file, it throws an IsolatedStorageException: “Operation not permitted on IsolatedStorageFileStream”. There isn’t many situations where opening a file from the isolated storage will throw an exception. The main two reasons are: an invalid filename, or a file sharing issue. Since the error only occursRead More →

Posts navigation

Previous 1 2 3 Next

Recent Posts

  • Uncovering a bug in Attribute.GetHashCode
  • [UWP] NavigationService with back button handler priority
  • [UWP] Bandwidth adaptive image control
  • [uwp] Animation orchestration using Caliburn.Micro coroutines
  • Should I await the last call in a method

Archives

  • March 2017 (1)
  • February 2016 (1)
  • January 2016 (1)
  • October 2015 (1)
  • September 2015 (2)
  • August 2015 (1)
  • May 2015 (1)
  • April 2015 (1)
  • March 2015 (3)
  • October 2014 (1)
  • September 2014 (1)
  • November 2013 (1)
  • August 2013 (1)
  • May 2013 (1)
  • February 2013 (1)
  • December 2012 (1)
  • October 2012 (2)
  • July 2012 (1)
  • May 2012 (1)
  • February 2012 (1)
  • January 2012 (4)

Follow me on Twitter

My Tweets

Designed using Dispatch. Powered by WordPress.