David

  • About Me
  • GoGetter for Windows Phone 7
  • My Etsy Shop
  • Random
  • Archive
  • RSS
  • Ask me anything
David is bringing it! #teambringit
Pop-upView Separately

David is bringing it! #teambringit

  • 9 hours ago
  • Comments
  • Permalink
  • Share
Nokia Lumia 800 as my new emulator for Windows Phone development.
Pop-upView Separately

Nokia Lumia 800 as my new emulator for Windows Phone development.

    • #WP7
    • #wp7dev
    • #windows phone
    • #Windows Phone 7
    • #windowsphone
  • 1 day ago
  • Comments
  • Permalink
  • Share

Tango to feature Google and Skype integrations?

I am patiently NOT waiting. Come on! Give me Tango!

  • 1 day ago
  • Comments
  • Permalink
  • Share
Don’t disturb. David is thinking.
Pop-upView Separately

Don’t disturb. David is thinking.

    • #gpoy
    • #gpoys
    • #me
  • 4 days ago
  • Comments
  • Permalink
  • Share

Exiting a Windows Phone Application Programatically

This is just a helpful tip for those who do Windows Phone development. I had issues on trying to figure out what the best way was to exit my app from the app’s main root page. For a while I just threw an exception such as this:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)

        {

            base.OnBackKeyPress(e);

            throw new Exception(“Exit Main”);           

        }

It irked me to do this, but it worked and passed Marketplace certification. Well, I was needing to perform some code on the App.xaml.cs level when exiting my app:

private void Application_Closing(object sender, ClosingEventArgs e)

        {

            // Do stuff here

        }

Well, this code was never called due to the exception being thrown from my main page when the back button was pressed. So, I dug in a bit to the NavigationService class and realized I could actually remove all back entries that were on the back stack. Joy! So, this is what I came up with for the OnBackKeyPress event:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)

        {

            base.OnBackKeyPress(e);

            if (NavigationService.CanGoBack)

                {

                    while (NavigationService.RemoveBackEntry() != null)

                    {

                        NavigationService.RemoveBackEntry();

                    }

                }          

        }

And voila! It worked. The app exited properly and the Application_Closing event was called from App.xaml.cs which allowed me to do some background processing of my app’s data.

Hope this can help any of you.

    • #c
    • #windowsphone
    • #windows phone
    • #Windows Phone 7
    • #silverlight
  • 4 days ago
  • Comments
  • Permalink
  • Share

Abstract modifiers

I learned a new thing today, while talking to my friend through G+. Too lazy to be original on my thoughts on it cause I have to code now. But here is what an abstract modifier is.

“The abstract modifier indicates that the thing being modified has a missing or incomplete implementation. The abstract modifier can be used with classes, methods, properties, indexers, and events. Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes. Members marked as abstract, or included in an abstract class, must be implemented by classes that derive from the abstract class.”

http://msdn.microsoft.com/en-us/library/sf985hc5.aspx

Easy peasy.

    • #c
    • #.net
    • #csharp
  • 4 days ago
  • Comments
  • Permalink
  • Share

Fresh Comics: Putting the ‘Metro’ back in Superman’s ‘Metropolis’

Nice!

  • 4 days ago
  • Comments
  • Permalink
  • Share
Cute.
Pop-upView Separately

Cute.

  • 1 week ago > eatsleepdraw
  • 1612
  • Comments
  • Permalink
  • Share
Blocking my sites for the day to protest PIPA. Calling my Senator today to make a stand. What are you doing about it?
Pop-upView Separately

Blocking my sites for the day to protest PIPA. Calling my Senator today to make a stand. What are you doing about it?

  • 1 week ago
  • Comments
  • Permalink
  • Share

Snippets: String to enumerated values

Useful code I use to convert string values to its enumerated counter parts.       

public static T StringToEnum<T>(string name)

        {

            return (T)Enum.Parse(typeof(T), name, false);

        }

        public static T NumToEnum<T>(int number)

        {

            return (T)Enum.ToObject(typeof(T), number);

        }

    • #c
    • #code
    • #programming
    • #snippets
    • #.net
    • #asp.net
    • #wp7
    • #windows phone
    • #Windows Phone 7
    • #windowsphone
    • #wp7dev
  • 2 weeks ago
  • Comments
  • Permalink
  • Share
← Newer • Older →
Page 1 of 15

Logo

Portrait/Logo

I created an awesome "Getting Things Done" app and I make awesome art.

GoGetter for Windows Phone 7: www.gogetterapp.com
Etsy Shop: davidrodriguez.etsy.com

Me, Elsewhere

  • @davidrodriguez on Twitter
  • Facebook Profile
  • davidarodriguez on Flickr
  • iimmerse on Last.fm
  • My Skype Info
  • Linkedin Profile

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

© 2011 David A. Rodriguez. Effector Theme by Carlo Franco.

Powered by Tumblr