Skip to content

What to do if OnOrientationChanged is not fired on windows phone 7 emulator?

If you debug your windows phone application, and the OnOrientationChanged event is not fired, just press Page Up or Page Down. Those keys are used to activate/deactivate the phone keyboard. If the phone keyboard is active, the following code will be executed. Strange thing...

protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{ 
   base.OnOrientationChanged(e);
}

Found(after some time) on the microsoft forum.

Todo for the next version of MySmug

This is the list of issues/features i have in mind. I'm not sure whether i will solve all of those, or even when. It's just to keep them in mind. Write me a comment if you have anything in mind which should be changed/fixed.

  • Save single pictures to the phone
  • Save album to the phone
  • Upload pictures from phone
  • Better panning/zooming
  • Change the image orientation based on the phone orientation.
  • Bing Map integration based on the GPS data .
  • Performance optimization(Album data caching)

Feature list Version 1.1. In submission process This was just a little bugfix release. Submission sent 06.01.2012

  • Bug fix: Album list was loaded more than once after some time.

Feature list Version 1.0. Release date: 06.01.2012

  • Authentication via oAuth
  • Album browsing
  • Pictures browsing
  • Picture details

Authenticate to smugmug with oAuth and c#

Some weeks ago, i tried to create a windows phone 7 smugmug app(photo browser). I had some problems with oAuth at the beginning, First, I tried the google oAuth implementation in c# with the result that the first request(AcquireRequestToken) worked, but the second request(AcquireAccessToken) failed with an invalid signature. Then i tried to implement it myself with the same result.

Even with the smugmug oAuth documentation, i found it quite hard to get it done. Some parts like the authorize parameters(public/full/read/modify) i had to figure out myself.

After some time, i found an c# oAuth class written for twitter access for cropperplugins.codeplex. With this code, i was at least able to get a proper AccessToken for smugmug. I've written a little demo application if someone else has the same problems.

To get this sample working, you only have to set you apiKey and secret. This sample will do: 1. Get a request token and a request token secret 2. Authorize the request token 3. With the request token secret, acquire a access token 4. This access token and access token secret are used for all further authentication, and should not expire until the user revokes them.

        private void AuthenticateSmugmug()
        {
            const string apiKey = "YOURAPIKEY";//apikey from your smugmug account
            const string secret = "YOUR_SECRET";//secret from your smugmug account

        Console.WriteLine("Create new instance of OAuth Manager");
        Manager manager = new Manager(apiKey, secret);

        Console.WriteLine("Aquire a request token from smugmug");
        OAuthResponse requestToken = manager.AcquireRequestToken("http://api.smugmug.com/services/oauth/getRequestToken.mg", "GET");

        string oauthToken = requestToken["oauth_token"];
        Console.WriteLine(string.Format("oauthToken: {0}", oauthToken));
        string oauthTokenSecret = requestToken["oauth_token_secret"];
        Console.WriteLine(string.Format("oauthTokenSecret: {0}", oauthTokenSecret));

        //Opens your default browser and authorize your request token
        //Parameters: Access=[Public|Full], Permissions=[Read|Add|Modify]
        System.Diagnostics.Process.Start(string.Format("http://api.smugmug.com/services/oauth/authorize.mg?oauth_token={0}&Access=Full&Permissions=Modify", oauthToken));

        Console.WriteLine("Please enter you credentials into the browser before continuing");
        Console.WriteLine("Press any key to continue...");
        Console.ReadLine();

        OAuthResponse accessToken = manager.AcquireAccessToken("http://api.smugmug.com/services/oauth/getAccessToken.mg", "GET", oauthTokenSecret);

        Console.WriteLine(string.Format("accessToken: {0}", accessToken["oauth_token"]));
        Console.WriteLine(string.Format("accessTokenSecret: {0}", accessToken["oauth_token_secret"]));
        Console.WriteLine("Press any key to quit the application");
        Console.ReadLine();
    }

This is the complete source code for the oAuth sample. It's c# written in Visual Studio 10: To get this sample working, just enter your Api Key and Secret. SmugmugOAuthSample.zip