public override void ViewDidLoad() { base.ViewDidLoad(); // 1000= 1 second , the timer will run every second timer.Interval = 300000; timer.Enabled = true; timer.Elapsed += Timer_Elapsed; timer.Start(); var manager = new CLLocationManager(); manager.AuthorizationChanged += (sender, args) => { var popup_size = new CoreGraphics.CGSize(this.View.Frame.Width, this.View.Frame.Height + TabBarController.TabBar.Frame.Height + NavigationController.NavigationBar.Frame.Height); Console.WriteLine("Authorization changed to: {0}", args.Status); switch (args.Status) { case CLAuthorizationStatus.AuthorizedWhenInUse: LocationView.Close(); //getLocation(); break; case CLAuthorizationStatus.Denied: LocationView = new TurnOnLocalitationView(popup_size); LocationView.PopUp(true, delegate { Console.WriteLine("cpuv will close"); }); Console.WriteLine("No Access"); break; default: break; } }; if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { manager.RequestWhenInUseAuthorization(); } profile_view.Layer.BorderColor = UIColor.White.CGColor; profile_view.Layer.BorderWidth = 4f; var EyeTapped = new UITapGestureRecognizer(() => { ViewModel.ShowProfile(); }); eye_view.AddGestureRecognizer(EyeTapped); eye_view.UserInteractionEnabled = true; next_button.TouchUpInside += delegate { profile_view.Image = null; GetLocation(); ViewModel.GetProfilesDetails(); }; back_button.TouchUpInside += delegate { profile_view.Image = null; GetLocation(); ViewModel.GetProfilesDetails(); }; //all_points_image.SendSubviewToBack(this.View); //TabBarController.TabBar.RemoveFromSuperview(); }
public override void ViewDidLoad() { base.ViewDidLoad(); //getLocation(); home_page.TouchUpInside += delegate { ViewModel.ShowProfile(); }; var manager = new CLLocationManager(); manager.AuthorizationChanged += (sender, args) => { var popup_size = new CoreGraphics.CGSize(this.View.Frame.Width, this.View.Frame.Height); Console.WriteLine("Authorization changed to: {0}", args.Status); switch (args.Status) { case CLAuthorizationStatus.AuthorizedWhenInUse: LocationView.Close(); getLocation(); break; case CLAuthorizationStatus.Denied: LocationView = new TurnOnLocalitationView(popup_size); ViewModel.allprofiles.Clear(); LocationView.PopUp(true, delegate { Console.WriteLine("OPEN SETTINGS"); }); Console.WriteLine("No Access"); break; default: break; } }; if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { manager.RequestWhenInUseAuthorization(); } /*switch (CLLocationManager.Status) * { * case CLAuthorizationStatus.Authorized | CLAuthorizationStatus.AuthorizedAlways | CLAuthorizationStatus.AuthorizedWhenInUse: * Console.WriteLine("Access"); * break; * case CLAuthorizationStatus.Denied | CLAuthorizationStatus.NotDetermined | CLAuthorizationStatus.Restricted: * Console.WriteLine("No Access"); * break; * default: * Console.WriteLine("No Access"); * break; * }*/ var ShowProfile1 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[0].id)) { ViewModel.profile_image = ViewModel.AllProfiles[0].image_url; ViewModel.profile_id = ViewModel.AllProfiles[0].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile2 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[1].id)) { ViewModel.profile_image = ViewModel.AllProfiles[1].image_url; ViewModel.profile_id = ViewModel.AllProfiles[1].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile3 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[2].id)) { ViewModel.profile_image = ViewModel.AllProfiles[2].image_url; ViewModel.profile_id = ViewModel.AllProfiles[2].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile4 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[3].id)) { ViewModel.profile_image = ViewModel.AllProfiles[3].image_url; ViewModel.profile_id = ViewModel.AllProfiles[3].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile5 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[4].id)) { ViewModel.profile_image = ViewModel.AllProfiles[4].image_url; ViewModel.profile_id = ViewModel.AllProfiles[4].id; ViewModel.ShowProfile(); } }catch (Exception ex) { } }); var ShowProfile6 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[5].id)) { ViewModel.profile_image = ViewModel.AllProfiles[5].image_url; ViewModel.profile_id = ViewModel.AllProfiles[5].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile7 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[6].id)) { ViewModel.profile_image = ViewModel.AllProfiles[6].image_url; ViewModel.profile_id = ViewModel.AllProfiles[6].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile8 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[7].id)) { ViewModel.profile_image = ViewModel.AllProfiles[7].image_url; ViewModel.profile_id = ViewModel.AllProfiles[7].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile9 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[8].id)) { ViewModel.profile_image = ViewModel.AllProfiles[8].image_url; ViewModel.profile_id = ViewModel.AllProfiles[8].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); //ViewModel.GetProfiles(); all_points_image.SendSubviewToBack(this.View); image_profile_1.AddGestureRecognizer(ShowProfile1); image_profile_2.AddGestureRecognizer(ShowProfile2); image_profile_3.AddGestureRecognizer(ShowProfile3); image_profile_4.AddGestureRecognizer(ShowProfile4); image_profile_5.AddGestureRecognizer(ShowProfile5); image_profile_6.AddGestureRecognizer(ShowProfile6); image_profile_7.AddGestureRecognizer(ShowProfile7); image_profile_8.AddGestureRecognizer(ShowProfile8); image_profile_9.AddGestureRecognizer(ShowProfile9); }