public override void ViewDidLoad() { base.ViewDidLoad (); this.NavigationItem.RightBarButtonItem = new UIBarButtonItem ("Search", UIBarButtonItemStyle.Bordered, delegate(object sender, EventArgs e) { var con = new Finder (); NavigationController.PushViewController (con, true); }); btnBack.Title = "back Reports"; btnBack.Clicked += delegate { this.NavigationController.PopViewControllerAnimated (true); }; btnBack.Title = ""; btnBack.Width = 0.1f; UIView v = View.Subviews [1]; v.RemoveFromSuperview (); //this.NavigationController.SetNavigationBarHidden (true, true); //-- hide the navigation bar this.NavigationController.SetToolbarHidden (true, false); //-- show the bottom toolbar this.NavigationController.ToolbarHidden = true; //pageControl.BackgroundColor = ColorHelper.GetGPLightPurple (); //btnBack.TintColor = ColorHelper.GetGPPurple (); //---- wire up our pager and scroll view event handlers this.pageControl.BackgroundColor = UIColor.Cyan; this.pageControl.ValueChanged += HandlePgrMainValueChanged; this.scrollView.Scrolled += HandleScrlMainScrolled; this.scrollView.Frame = new RectangleF (0, 0, 320, 480); LoadControllers (); Title = "Page " + (pageNumber + 1) + " of " + this._controllers.Count; //setCurrentPage (); // Perform any additional setup after loading the view, typically from a nib. }
// CLLocationManager PhoneLocationManager = null; // LocationDelegate locationDelegate = null; // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); //####################################################### //TODO - remove and test the real new user auth mechanism //RemoveProperties (); //SetManualProperties (); var provDialog = new ProvisioningDialog (); var matterDialog = new Finder (); if (isDeviceProvisioned ()) { navigationController = new UINavigationController (matterDialog); } else { navigationController = new UINavigationController (provDialog); } navigationController.Toolbar.TintColor = ColorHelper.GetGPPurple (); window.RootViewController = navigationController; //---- initialize our location manager and callback handler // this.PhoneLocationManager = new CLLocationManager (); // this.locationDelegate = new LocationDelegate (this); // this.PhoneLocationManager.Delegate = this.locationDelegate; // // //---- start updating our location, et. al. // this.PhoneLocationManager.StartUpdatingLocation (); // //this._iPhoneLocationManager.StartUpdatingHeading (); // // make the window visible window.MakeKeyAndVisible (); return true; }
void ProvisioningDownloaded(IAsyncResult result) { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; end = DateTime.Now; isBusy = false; var request = result.AsyncState as HttpWebRequest; WebServiceResponseDTO dto; try { HttpWebResponse response = (HttpWebResponse)request.EndGetResponse (result); Stream receiveStream = response.GetResponseStream (); StreamReader readStream = new StreamReader (receiveStream, Encoding.UTF8); string resp = readStream.ReadToEnd (); Console.WriteLine ("## ASYNCResponse stream received.\n" + resp); response.Close (); readStream.Close (); // dto = (WebServiceResponseDTO)JsonConvert.DeserializeObject (resp, typeof(WebServiceResponseDTO)); if (dto != null) { Tools.SendElapsedTime (start, end, dto.activityID); } InvokeOnMainThread (delegate { if (dto.responseCode == 0) { //save user in properties if (dto.user.cellphone != null) { NSUserDefaults.StandardUserDefaults.SetString (dto.user.cellphone, "cellphone"); } NSUserDefaults.StandardUserDefaults.SetInt (dto.user.company.companyID, "companyID"); NSUserDefaults.StandardUserDefaults.SetInt (dto.user.userID, "userID"); if (dto.user.userName != null) { NSUserDefaults.StandardUserDefaults.SetString (dto.user.userName, "userName"); } if (dto.user.email != null) { NSUserDefaults.StandardUserDefaults.SetString (dto.user.email, "email"); } if (dto.deviceID != null) { NSUserDefaults.StandardUserDefaults.SetString (dto.deviceID, "deviceID"); } if (dto.user.company != null) { NSUserDefaults.StandardUserDefaults.SetString (dto.user.company.companyName, "companyName"); } var cont = new Finder (); this.NavigationController.PushViewController (cont, true); } else { new UIAlertView ( "Device Provisioning", dto.responseMessage + "\n\nPlease contact GhostPractice Support for assistance.", null, "OK").Show (); } } ); } catch (Exception ex) { Console.WriteLine ("### ERROR: " + ex.Message); InvokeOnMainThread (delegate { new UIAlertView ( "Network Error", "Problem communicating with server.\nPlease try later or call GhostPractice Support", null, "Close" ).Show (); isBusy = false; } ); } }