public void ChangeOrientation(string mode)
 {
     // Need to rotate the device to the landscape mode.
     if (mode == "Landscape")
     {
         UIApplication.SharedApplication.SetStatusBarOrientation(UIInterfaceOrientation.LandscapeLeft, false);
         UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.LandscapeLeft), new NSString("orientation"));
         UINavigationController.AttemptRotationToDeviceOrientation();
     }
     else
     {
         UIApplication.SharedApplication.SetStatusBarOrientation(UIInterfaceOrientation.Portrait, false);
         UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.Portrait), new NSString("orientation"));
         UINavigationController.AttemptRotationToDeviceOrientation();
     }
 }