Friday, April 5, 2013

Value cannot be null.Parameter name: parentContext in Windows Phone 7


Today morning I am just open Visual Studio 2010 and create a new Windows phone project and came across an issue with windows phone xaml page with the following error in design view.

Value cannot be null.Parameter
name: parentContext in Windows Phone 7

To rectify this issue I did two worked around and both are worked.
1) Build your project and close the page windows and then open.
2) Close the Visual Studio IDE and re-launch it.

Hope it helps.

Sunday, February 3, 2013

Windows Phone Emulator - Keyboard Shortcuts

Keyboard shortcuts are very useful while developing your Windows Phone applications, that basically allows to reduce the development and testing time. The following keyboard shortcuts substitute the physical buttons on a Windows Phone Emulator.

 F1 = Back arrow button. Escape key can also be used.
 F2 = Windows Start button
 F3 = Search button
 F6 = Camera button that is pressed halfway
 F7 = Camera button that is fully pressed
 F9 = Volume up
 F10 = Volume down
 F12 = Lock device/Power button. Press it twice to see the lock screen.
 PAGE DOWN = When text box is highlight, moves visual keyboard down, and you can use your physical keyboard for input
 PAGE UP = When text box is highlight, moves visual keyboard up.
 PAUSE/BREAK = Toggle keyboard

~~ Happy Coding ~~

Thursday, January 24, 2013

Windows Phone SDK Update for Windows Phone 7.8

Windows Phone SDKUpdate for Windows Phone 7.8





It’s time to cheer with new update of Windows Phone 7.8, now time to update your windows phone 7.5 apps to Windows Phone 7.8. It’s an optional update that allows you to add two new Windows Phone 7.8 emulator images to your existing windows phone SDK installation.

The Windows Phone 7.8 has to offer *New* Live Tiles, the SDK including the new Emulators is now available.

Direct download : Windows Phone SDKUpdate for Windows Phone 7.8

Official Blog Post : Windows Phone 7.8 SDK Update

*Happy Programming*

Cheer

Tuesday, October 30, 2012

Windows Phone 8.0 SDK Download


Today, Microsoft has been launched the Windows Phone 8 Software Development Kit (SDK), which allows developers to developed applications for Windows Phone 8, over the Win RT OS.



Here is dowanloads available.

1) Microsoft online installer for Windows Phopne 8

2) Microsoft offline installer for Windows Phopne 8 (ISO Format)

Cheer development with new Windows Phone 8 SDK :)

Thank you!

Wednesday, August 1, 2012

Windows Phone Tasks - Launchers and Choosers

 

In this part we are going to discussed about the Windows Phone Tasks - Launchers and Choosers.

image

Windows Phone tasks API allows you to invoke native tasks (phone’s applications) form your application using managed API, such as PhoneCallTask, EmailComposeTask, SmsComposeTask and MarketplaceSearchTask and so on.

Launchers and Choosers are straightforward to associate with your application.

See the following code snippet for Launchers

  1:  private void btnEmailComposeTask_Click(object sender, RoutedEventArgs e)
  2:         {
  3:             EmailComposeTask oEct = new EmailComposeTask();
  4:             oEct.To = "pavan.pareta@gmail.com";
  5:             oEct.Show();
  6:         }
  7: 
  8:         private void btnMarketplaceDetailTask_Click(object sender, RoutedEventArgs e)
  9:         {
 10:             MarketplaceDetailTask oMdt = new MarketplaceDetailTask();
 11:             oMdt.ContentType = MarketplaceContentType.Applications;
 12:             oMdt.ContentIdentifier = "1fa6b3b1-11f0-4265-ab3d-ac70df5edabc";
 13:             oMdt.Show();
 14:         }
 15: 
 16:         private void btnMarketplaceHubTask_Click(object sender, RoutedEventArgs e)
 17:         {
 18:             MarketplaceHubTask oMht = new MarketplaceHubTask();
 19:             oMht.ContentType = MarketplaceContentType.Music;
 20:             oMht.Show();
 21:         }
 22: 
 23:         private void btnMarketplaceReviewTask_Click(object sender, RoutedEventArgs e)
 24:         {
 25:             MarketplaceReviewTask oMrt = new MarketplaceReviewTask();
 26:             oMrt.Show();
 27:         }
 28: 
 29:         private void btnMarketplaceSearchTask_Click(object sender, RoutedEventArgs e)
 30:         {
 31:             MarketplaceSearchTask oMst = new MarketplaceSearchTask();
 32:             oMst.ContentType = MarketplaceContentType.Applications;
 33:             oMst.SearchTerms = "Games";
 34:             oMst.Show();
 35:         }
 36: 
 37:         private void btnMediaPlayerLauncher_Click(object sender, RoutedEventArgs e)
 38:         {
 39:             MediaPlayerLauncher oMpl = new MediaPlayerLauncher();
 40:             oMpl.Controls = MediaPlaybackControls.All;
 41:             oMpl.Media = new Uri("http://ecn.channel9.msdn.com/o9/ch9/1be6/d5819645-cf1e-4542-bb9d-9e10015a1be6/day01part1_ch9.wmv");
 42:             oMpl.Show();
 43:         }
 44: 
 45:         private void btnPhoneCallTask_Click(object sender, RoutedEventArgs e)
 46:         {
 47:             PhoneCallTask oPct = new PhoneCallTask();
 48:             oPct.PhoneNumber = "1234567890";
 49:             oPct.Show();
 50:         }
 51: 
 52:         private void btnSearchTask_Click(object sender, RoutedEventArgs e)
 53:         {
 54:             SearchTask oSt = new SearchTask();
 55:             oSt.SearchQuery = "Game";
 56:             oSt.Show();
 57:         }
 58: 
 59:         private void btnSmsComposeTask_Click(object sender, RoutedEventArgs e)
 60:         {
 61:             SmsComposeTask oSct = new SmsComposeTask();
 62:             oSct.To = "12345";
 63:             oSct.Body = "Hi! This Windows Phone";
 64:             oSct.Show();
 65:         }
 66: 
 67:         private void btnWebBrowserTask_Click(object sender, RoutedEventArgs e)
 68:         {
 69:             WebBrowserTask oWbt = new WebBrowserTask();
 70:             oWbt.Uri = new Uri("http://www.http://windows-mobile-dev.blogspot.in/");
 71:             oWbt.Show();
 72:         }


Code snippet for.Choosers

  1: private void btnCameraCaptureTask_Click(object sender, RoutedEventArgs e)
  2:         {
  3:             CameraCaptureTask oCct = new CameraCaptureTask();
  4:             oCct.Completed += (s, evnt) =>
  5:             {
  6:                 if (evnt.Error == null && evnt.TaskResult == TaskResult.OK)
  7:                 {
  8:                     BitmapImage bmpImage = new BitmapImage();
  9:                     bmpImage.SetSource(evnt.ChosenPhoto);
 10:                     ImageBrush imb = new ImageBrush();
 11:                     imb.ImageSource = bmpImage;
 12:                     LayoutRoot.Background = imb;
 13:                 }
 14:             };
 15:             oCct.Show();
 16:         }
 17: 
 18:         private void btnEmailId_Click(object sender, RoutedEventArgs e)
 19:         {
 20:             EmailAddressChooserTask oEact = new EmailAddressChooserTask();
 21:             oEact.Completed += (s, evnt) =>
 22:                 {
 23:                     if (evnt.Error == null && evnt.TaskResult == TaskResult.OK)
 24:                     {
 25:                         MessageBox.Show("Name:" + evnt.DisplayName + "\nEmail Id:" + evnt.Email);
 26:                     }
 27: 
 28:                 };
 29:             oEact.Show();
 30:         }
 31: 
 32:         private void btnPhoneNumberChooserTask_Click(object sender, RoutedEventArgs e)
 33:         {
 34:             PhoneNumberChooserTask oPnct = new PhoneNumberChooserTask();
 35:             oPnct.Completed += (s, evnt) =>
 36:             {
 37:                 if (evnt.Error == null && evnt.TaskResult == TaskResult.OK)
 38:                 {
 39:                     MessageBox.Show("Name:" + evnt.DisplayName + "\nPhone Number:" + evnt.PhoneNumber);
 40:                 }
 41: 
 42:             };
 43:             oPnct.Show();
 44:         }
 45: 
 46:         private void btnPhotoChooserTask_Click(object sender, RoutedEventArgs e)
 47:         {
 48:             PhotoChooserTask oPct = new PhotoChooserTask();
 49:             oPct.Completed += (s, evnt) =>
 50:             {
 51:                 if (evnt.Error == null && evnt.TaskResult == TaskResult.OK)
 52:                 {
 53:                     BitmapImage bmpImage = new BitmapImage();
 54:                     bmpImage.SetSource(evnt.ChosenPhoto);
 55:                     ImageBrush imb = new ImageBrush();
 56:                     imb.ImageSource = bmpImage;
 57:                     LayoutRoot.Background = imb;
 58:                 }
 59:             };
 60:             oPct.Show();
 61:         }
 62: 
 63:         private void btnSaveEmailAddressTask_Click(object sender, RoutedEventArgs e)
 64:         {
 65:             SaveEmailAddressTask oSeat = new SaveEmailAddressTask();
 66:             oSeat.Completed += (s, evnt) =>
 67:             {
 68:                 if (evnt.Error == null && evnt.TaskResult == TaskResult.OK)
 69:                 {
 70:                     MessageBox.Show("TaskResult is:" + evnt.TaskResult);
 71:                 }
 72:             };
 73:             oSeat.Show();
 74:         }
 75: 
 76:         private void btnSavePhoneNumberTask_Click(object sender, RoutedEventArgs e)
 77:         {
 78:             SavePhoneNumberTask oSeat = new SavePhoneNumberTask();
 79:             oSeat.Completed += (s, evnt) =>
 80:             {
 81:                 if (evnt.Error == null && evnt.TaskResult == TaskResult.OK)
 82:                 {
 83:                     MessageBox.Show("TaskResult is:" + evnt.TaskResult);
 84:                 }
 85:             };
 86:             oSeat.Show();
 87:         }

 


Download source code here


Happy CodingThumbs up

Sunday, July 1, 2012

Awarded with Microsoft MVP Award: Second time in Row 2012

 

Once again It’s a fantastic day of my life, when I received a mail from Microsoft “Congratulations 2012 Microsoft MVP!”

I am happy to announce to all my readers that I have been awarded as Microsoft MVP 2nd Time in row. This time also I have been awarded in discipline Device Application Development.

 

MVP-Feature

 

I would like to give a special Thanks to Microsoft India MVP Lead Mr.Tanmay Kapoor for this recognition.

Thanks to Microsoft.

Saturday, June 23, 2012

How determine either location service is on or off?

 

In this post I am going to show how to determine programmatically location service, is on or off.

Why is it necessary in your application?

Let take an example while developing GPS based application for Windows Phone 7 and submitting app to market place, it is very important to get certified your application, user must know that your application going to use Windows Phone GPS service.

Here is the solution for the same case study.

Add the reference in your application.

0001

001

  1: using System.Device.Location; // for GPS Service 
  2: //And
  3: using Microsoft.Phone.Shell;  // for PhoneApplicationService  current status
  4: 

Initialization GeoCoordinateWatcher object for execute the GPS Service.

  1: void MainPage_Loaded(object sender, RoutedEventArgs e)
  2:         {
  3:             geoWatcher = new GeoCoordinateWatcher();
  4:             geoWatcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(geoWatcher_StatusChanged);
  5:             geoWatcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(geoWatcher_PositionChanged);
  6: 
  7: 
  8:             if (DoChk())
  9:             {
 10:                 geoWatcher.Start();
 11:             }
 12:         }
 13: 
 14:         void geoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 15:         {
 16:             textBlock1.Text = string.Format("Latitude:{0}\nLongitude:{1}", e.Position.Location.Latitude, e.Position.Location.Longitude);
 17:         }
 18: 
 19:         void geoWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
 20:         {
 21:             textBlock2.Text = string.Format("Status:{0}" , e.Status.ToString());
 22: 
 23:             if (DoChk())
 24:             {
 25:                 geoWatcher.Start();
 26:             }
 27:           
 28:         }
 29: 
 30:         public GeoCoordinateWatcher GeoWatcher
 31:         {
 32:             get
 33:             {
 34:                 return geoWatcher;
 35:             }
 36:             set
 37:             {
 38:                 if (geoWatcher != value)
 39:                 {
 40:                     geoWatcher = value;
 41:                 }
 42:                 if (geoWatcher.Status == GeoPositionStatus.Disabled)
 43:                 {
 44:                     geoWatcher.Stop();
 45:                 }
 46:             }
 47: 
 48:         }
 49: 
 50: 
 51:         private bool DoChk()
 52:         {
 53:             bool allow = false;
 54: 
 55: 
 56:             if (PhoneApplicationService.Current.State.ContainsKey("allow"))
 57:             {
 58:                 allow = (bool)PhoneApplicationService.Current.State["allow"];
 59:             }
 60: 
 61:             if (allow == false)
 62:             {            
 63:                 var result = MessageBox.Show(
 64:                                "Application uses your Phone location. Do you wish " +
 65:                                "to give it permission to use your location?",
 66:                                "User Location Data",
 67:                                MessageBoxButton.OKCancel);
 68: 
 69:                 // Save answer so you can access it on other pages 
 70:                 allow = (result == MessageBoxResult.OK);
 71:                 PhoneApplicationService.Current.State["allow"] = allow;
 72:             }
 73:             return allow;
 74:         }

002


003


Here is source code


thank you for your time.


Happy Coding