Esempio n. 1
0
        private void DeleteButton_TouchUpInside(object sender, EventArgs e)
        {
            UIAlertView alert = new UIAlertView();

            alert.Title = "Buptis";
            alert.AddButton("Evet");
            alert.AddButton("Hayır");
            alert.Message        = "Fotoğrafı silmek istediğinize emin misiniz?";
            alert.AlertViewStyle = UIAlertViewStyle.Default;
            alert.Clicked       += (object s, UIButtonEventArgs ev) =>
            {
                if (ev.ButtonIndex == 0)
                {
                    alert.Dispose();

                    WebService webService = new WebService();
                    var        Donus      = webService.ServisIslem("images/" + GelenDTO.id, "", Method: "DELETE");
                    if (Donus != "Hata")
                    {
                        BaseView.FotografSildiktenSonraGuncelle();
                    }
                }
                else
                {
                    alert.Dispose();
                }
            };
            alert.Show();
        }
Esempio n. 2
0
        private void FavoriEkleButton_TouchUpInside(object sender, EventArgs e)
        {
            var IsFollow = FollowListID.FindAll(item => item == SecilenKisi.SecilenKisiDTO.id.ToString());

            if (IsFollow.Count > 0)
            {
                UIAlertView alert = new UIAlertView();
                alert.Title = "Buptis";
                alert.AddButton("Evet");
                alert.AddButton("Hayýr");
                alert.Message        = SecilenKisi.SecilenKisiDTO.firstName + " adlı kullanıcıyı favorilerilerinden çıkartmak istediğinize emin misiniz?";
                alert.AlertViewStyle = UIAlertViewStyle.Default;
                alert.Clicked       += (object s, UIButtonEventArgs ev) =>
                {
                    if (ev.ButtonIndex == 0)
                    {
                        alert.Dispose();
                    }
                    else
                    {
                        alert.Dispose();
                        FavoriIslemleri(SecilenKisi.SecilenKisiDTO.firstName + " favorilerinden çıkartıldı.");
                    }
                };
                alert.Show();
            }
            else
            {
                FavoriIslemleri(SecilenKisi.SecilenKisiDTO.firstName + " favorilerine eklendi.");
            }
        }
Esempio n. 3
0
        public void UnBlockedUser(int id)
        {
            UIAlertView alert = new UIAlertView();

            alert.Title = "Buptis";
            alert.AddButton("Evet");
            alert.AddButton("Hayır");
            alert.Message        = "Kullanıcının engelini kaldırmak istediğinize emin misiniz ?";
            alert.AlertViewStyle = UIAlertViewStyle.Default;
            alert.Clicked       += (object s, UIButtonEventArgs ev) =>
            {
                if (ev.ButtonIndex == 0)
                {
                    alert.Dispose();
                    WebService webService = new WebService();
                    var        Donus      = webService.ServisIslem("blocked-users/" + id, "", Method: "DELETE");
                    if (Donus != "Hata")
                    {
                        GetBlockedUserList();
                        CustomAlert.GetCustomAlert(this, "Kullanıcının engeli kaldırılıyor.");
                    }
                }
                else
                {
                    alert.Dispose();
                }
            };
            alert.Show();
        }
Esempio n. 4
0
        private void CikisYapButton_TouchUpInside(object sender, EventArgs e)
        {
            var Confirm = new UIAlertView("Buptis", "Çıkmak istediğinize emin misiniz ?", null, "Evet", "Hayır");

            Confirm.Show();
            Confirm.Clicked += (object senders, UIButtonEventArgs es) =>
            {
                if (es.ButtonIndex == 0)
                {
                    //Evetse
                    string path;
                    path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                    File.Delete(System.IO.Path.Combine(path, "Buptis.db"));
                    InvokeOnMainThread(delegate() {
                        Confirm.Dispose();
                        //Thread.CurrentThread.Abort();
                        var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
                        appDelegate.SetRootSplashViewController();
                    });
                }
                else
                {
                    // hayırsa
                    Confirm.Dispose();
                }
            };
            Confirm.Show();
        }
Esempio n. 5
0
 void ShowAlertForPermission()
 {
     if (alert == null)
     {
         InvokeOnMainThread(delegate() {
             alert       = new UIAlertView();
             alert.Title = "Buptis";
             alert.AddButton("Tamam");
             alert.Message        = "Buptis konumunuzu kullanarak çevrenizde size yakın mekanları listelemektedir.";
             alert.AlertViewStyle = UIAlertViewStyle.Default;
             alert.Clicked       += (object s, UIButtonEventArgs ev) =>
             {
                 if ((bool)CheckLocationPermission())
                 {
                     SurekliKontrol();
                     alert.Dispose();
                 }
                 else
                 {
                     SurekliKontrol();
                     UIApplication.SharedApplication.OpenUrl(new NSUrl(UIApplication.OpenSettingsUrlString));
                     alert.Dispose();
                 }
             };
             alert.Show();
         });
     }
 }
Esempio n. 6
0
        private void HesabiSilButton_TouchUpInside(object sender, EventArgs e)
        {
            UIAlertView alert = new UIAlertView();

            alert.Title = "Buptis";
            alert.AddButton("Evet");
            alert.AddButton("Hayýr");
            alert.Message        = "Hesabınızı silerseniz bu kullanıcı ile Buptis'e bir daha giriş yapamazsınız.\nHesabı silmek istiyor musunuz?";
            alert.AlertViewStyle = UIAlertViewStyle.Default;
            alert.Clicked       += (object s, UIButtonEventArgs ev) =>
            {
                if (ev.ButtonIndex == 0)
                {
                    alert.Dispose();
                    if (HesabiSilApi())
                    {
                        string path;
                        path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                        File.Delete(System.IO.Path.Combine(path, "Buptis.db"));
                        InvokeOnMainThread(delegate() {
                            alert.Dispose();
                            var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
                            appDelegate.SetRootSplashViewController();
                        });
                    }
                }
                else
                {
                    alert.Dispose();
                }
            };
            alert.Show();
        }
Esempio n. 7
0
        private void MesajAtButton_TouchUpInside(object sender, EventArgs e)
        {
            if (!KisiBilgileriTammi())
            {
                UIAlertView alert = new UIAlertView();
                alert.Title = "Buptis";
                alert.AddButton("Evet");
                alert.AddButton("Hayır");
                alert.Message        = "Yaş ve Cinsiyet Bilgilerinizi Tamamlamadan Mesaj Gönderemezsiniz. Bilgilerini güncellemek ister misiniz?";
                alert.AlertViewStyle = UIAlertViewStyle.Default;
                alert.Clicked       += (object s, UIButtonEventArgs ev) =>
                {
                    if (ev.ButtonIndex == 0)
                    {
                        alert.Dispose();

                        var             AyarlarBaseVC1 = UIStoryboard.FromName("AyarlarBaseVC", NSBundle.MainBundle);
                        TemelBilgilerVC controller     = AyarlarBaseVC1.InstantiateViewController("TemelBilgilerVC") as TemelBilgilerVC;
                        controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
                        this.PresentViewController(controller, true, null);
                    }
                    else
                    {
                        alert.Dispose();
                    }
                };
                alert.Show();
            }
            else
            {
                MevcutMekandaChechInYapmismi();
            }
        }
Esempio n. 8
0
        private void EngelleButton_TouchUpInside(object sender, EventArgs e)
        {
            var engeldurum = GetBlockedFriends();

            if (engeldurum)
            {
                UIAlertView alert = new UIAlertView();
                alert.Title = "Buptis";
                alert.AddButton("Evet");
                alert.AddButton("Hayır");
                alert.Message        = "Kullanıcının engelini kaldırmak istediğinize emin misiniz ?";
                alert.AlertViewStyle = UIAlertViewStyle.Default;
                alert.Clicked       += (object s, UIButtonEventArgs ev) =>
                {
                    if (ev.ButtonIndex == 0)
                    {
                        alert.Dispose();
                        WebService webService = new WebService();
                        var        Donus      = webService.ServisIslem("blocked-users/" + SecilenKisi.SecilenKisiDTO.id, "", Method: "DELETE");
                        if (Donus != "Hata")
                        {
                            var engeldurum2 = GetBlockedFriends();
                            if (engeldurum2)
                            {
                                EngelleButton.SetTitle("Engeli Kaldır", UIControlState.Normal);
                            }
                            else
                            {
                                EngelleButton.SetTitle("Engelle, Þikayet Et", UIControlState.Normal);
                            }
                            CustomAlert.GetCustomAlert(this, "Kullanıcının engeli kaldırıldı");
                        }
                    }
                    else
                    {
                        alert.Dispose();
                    }
                };
                alert.Show();
            }
            else
            {
                var       PublicProfileBaseVC1 = UIStoryboard.FromName("PublicProfileBaseVC", NSBundle.MainBundle);
                EngelleVC controller           = PublicProfileBaseVC1.InstantiateViewController("EngelleVC") as EngelleVC;
                controller.BaseVC = this;
                controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
                this.PresentViewController(controller, true, null);
            }
        }
Esempio n. 9
0
        async Task <bool> SignIn()
        {
            var tcs   = new TaskCompletionSource <bool> ();
            var alert = new UIAlertView("Please sign in", "", null, "Cancel", "Ok");

            alert.AlertViewStyle = UIAlertViewStyle.SecureTextInput;
            var tb = alert.GetTextField(0);

            tb.ShouldReturn = (t) => {
                alert.DismissWithClickedButtonIndex(1, true);
                signIn(tcs, tb.Text);
                return(true);
            };

            alert.Clicked += async(object sender, UIButtonEventArgs e) => {
                if (e.ButtonIndex == 0)
                {
                    tcs.TrySetResult(false);
                    alert.Dispose();
                    return;
                }

                var id = tb.Text;
                signIn(tcs, id);
            };
            alert.Show();
            return(await tcs.Task);
        }
Esempio n. 10
0
        public Task <int> ShowThreeOptions(string title, string message, string cancelOption, string firstOption, string secondOption)
        {
            var tcs = new TaskCompletionSource <int>();

            UIApplication.SharedApplication.InvokeOnMainThread(new Action(() =>
            {
                if (CheckIfiOS8())
                {
                    UIAlertController alertViewController = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert);
                    UIAlertAction cancelAction            = UIAlertAction.Create(cancelOption, UIAlertActionStyle.Cancel, a => tcs.SetResult(0));
                    alertViewController.AddAction(cancelAction);

                    UIAlertAction firstlAction = UIAlertAction.Create(firstOption, UIAlertActionStyle.Default, a => tcs.SetResult(1));
                    alertViewController.AddAction(firstlAction);

                    UIAlertAction secondAction = UIAlertAction.Create(secondOption, UIAlertActionStyle.Default, a => tcs.SetResult(2));
                    alertViewController.AddAction(secondAction);

                    UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alertViewController, true, null);
                }
                else
                {
                    UIAlertView alert = new UIAlertView(title, message, null, cancelOption, firstOption, secondOption);
                    alert.Clicked    += (sender, buttonArgs) => tcs.TrySetResult((int)buttonArgs.ButtonIndex);
                    alert.Dismissed  += (sender, e) =>
                    {
                        alert.Dispose();
                        alert = null;
                    };
                    alert.Show();
                }
            }));

            return(tcs.Task);
        }
Esempio n. 11
0
 public void dispose()
 {
     // dismiss with button clicked so if invoked on another thread we don't die for some reason
     myAlert.DismissWithClickedButtonIndex(0, true);
     myAlert.Dispose();
     myAlert = null;
 }
Esempio n. 12
0
        /// <summary>
        /// Event when complete is pressed
        /// </summary>
        partial void Complete()
        {
            //Check if they signed
            if (assignmentViewModel.Signature == null)
            {
                new UIAlertView(string.Empty, "Signature is required.", null, "Ok").Show();
                return;
            }

            alertView            = new UIAlertView("Complete?", "Are you sure?", null, "Yes", "No");
            alertView.Dismissed += (sender, e) => {
                alertView.Dispose();
                alertView = null;

                if (e.ButtonIndex == 0)
                {
                    completeButton.Enabled = false;
                    assignment.Status      = AssignmentStatus.Complete;
                    assignmentViewModel
                    .SaveAssignmentAsync(assignment)
                    .ContinueWith(_ => {
                        BeginInvokeOnMainThread(() => {
                            tableView.ReloadData();

                            var detailsController = controller.ParentViewController as AssignmentDetailsController;
                            detailsController.UpdateAssignment();

                            var menuController = detailsController.ParentViewController.ChildViewControllers[1] as MenuController;
                            menuController.UpdateAssignment();
                        });
                    });
                }
            };
            alertView.Show();
        }
Esempio n. 13
0
		async Task<bool> SignIn()
		{
			var tcs = new TaskCompletionSource<bool> ();
			var alert = new UIAlertView ("Please sign in", "", null, "Cancel", "Ok");
			alert.AlertViewStyle = UIAlertViewStyle.SecureTextInput;
			var tb = alert.GetTextField(0);
			tb.ShouldReturn = (t)=>{

				alert.DismissWithClickedButtonIndex(1,true);
				signIn(tcs,tb.Text);
				return true;
			};

			alert.Clicked += async (object sender, UIButtonEventArgs e) => {
				if(e.ButtonIndex == 0)
				{
					tcs.TrySetResult(false);
					alert.Dispose();
					return;
				}

				var id = tb.Text;
				signIn(tcs,id);
			
			
			};
			alert.Show ();
			return await tcs.Task;
		}
Esempio n. 14
0
        public void Show(string title, string message)
        {
            UIApplication.SharedApplication.InvokeOnMainThread(new Action(() =>
            {
                if (CheckIfiOS8())
                {
                    UIAlertController alertViewController = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert);
                    UIAlertAction okAction = UIAlertAction.Create("OK", UIAlertActionStyle.Default, a =>
                    {
                    });
                    alertViewController.AddAction(okAction);

                    UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alertViewController, true, null);
                }
                else
                {
                    alertView = new UIAlertView(title, message, null, "OK", null);
                    alertView.Show();
                    alertView.Dismissed += (sender, e) =>
                    {
                        alertView.Dispose();
                        alertView = null;
                    };
                }
            }));
        }
Esempio n. 15
0
		/// <summary>
		/// Event when complete is pressed
		/// </summary>
		partial void Complete ()
		{
			//Check if they signed
			if (assignmentViewModel.Signature == null) {
				new UIAlertView(string.Empty, "Signature is required.", null, "Ok").Show ();
				return;
			}

			alertView = new UIAlertView("Complete?", "Are you sure?", null, "Yes", "No");
			alertView.Dismissed += (sender, e) => {
				alertView.Dispose ();
				alertView = null;

				if (e.ButtonIndex == 0) {
					completeButton.Enabled = false;
					assignment.Status = AssignmentStatus.Complete;
					assignmentViewModel
						.SaveAssignmentAsync (assignment)
						.ContinueWith (_ => {
							BeginInvokeOnMainThread (() => {
								tableView.ReloadData ();
								
								var detailsController = controller.ParentViewController as AssignmentDetailsController;
								detailsController.UpdateAssignment ();

								var menuController = detailsController.ParentViewController.ChildViewControllers[1] as MenuController;
								menuController.UpdateAssignment ();
							});
						});
				}
			};
			alertView.Show();
		}
Esempio n. 16
0
 public void Dispose()
 {
     alertController?.Dispose();
     alertView?.DismissWithClickedButtonIndex(alertView.CancelButtonIndex, true);
     alertView?.Dispose();
     tcs?.TrySetCanceled();
     tcs = null;
 }
Esempio n. 17
0
        public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);

            //don't clean up objects, if we want the controller to be kept alive
            if (keepScanViewControllerAlive)
            {
                return;
            }

            //we have to un-register the event handlers because else the whole viewcontroller will be kept in the garbage collector.
            if (meterTypeSegment != null)
            {
                meterTypeSegment.ValueChanged -= HandleSegmentChange;
            }

            if (meterTypeSegment != null)
            {
                meterTypeSegment.Dispose();
            }
            meterTypeSegment = null;

            if (selectionLabel != null)
            {
                selectionLabel.Dispose();
            }
            selectionLabel = null;

            if (infoLabel != null)
            {
                infoLabel.Dispose();
            }
            infoLabel = null;

            segmentItems = null;

            if (alert != null)
            {
                alert.Dispose();
            }
            alert = null;

            if (error != null)
            {
                error.Dispose();
            }
            error = null;

            //we have to erase the scan view so that there are no dependencies for the viewcontroller left.
            anylineEnergyView.RemoveFromSuperview();
            anylineEnergyView.Dispose();
            anylineEnergyView = null;

            base.Dispose();
        }
Esempio n. 18
0
            public override void Dismissed(UIAlertView alertview, int buttonIndex)
            {
                if (!_dismissed)
                {
                    _dismissed = true;
                    // if user uses gallery, camera, etc, application will crash, because UINavigationController does not presented
                    _tcs.SetResult(buttonIndex);

                    _alertViews.Remove(alertview);
                    alertview.Dispose();
                }
            }
Esempio n. 19
0
 private void DisposeAlert()
 {
     alert.Canceled  -= Canceled_Click;
     alert.Clicked   -= Clicked_Click;
     alert.Dismissed -= Dismissed_Click;
     alert.Dispose();
     alert = null;
     GC.Collect();
     if (IsAsync)
     {
         GetResult();
     }
 }
Esempio n. 20
0
        /// <summary>
        /// Event when the decline button is clicked
        /// </summary>
        partial void Decline()
        {
            alertView            = new UIAlertView("Decline Assignment", "Are you sure?", null, "Yes", "No");
            alertView.Dismissed += (sender, e) => {
                if (e.ButtonIndex == 0)
                {
                    assignment.Status = AssignmentStatus.Declined;
                    SaveAssignment();
                }

                alertView.Dispose();
                alertView = null;
            };
            alertView.Show();
        }
Esempio n. 21
0
 public override void HandleAddButtonClicked(object sender, EventArgs e)
 {
     #if LITE
     if(Contacts.GetAll().Count >= Settings.MaxGroupFreeVersion)
     {
         UIAlertView alert = new UIAlertView(Settings.GetLocalizedString("SMS Party Free", LocalizedKey),
                                             Settings.GetLocalizedString("SMS Party Free only allows a maximum of 5 groups to be created", LocalizedKey),
                                             null, "OK");
         alert.Show();
         alert.Dispose();
         return;
     }
     #endif
     CreateButtonTapped();
 }
Esempio n. 22
0
        public override void HandleAddButtonClicked(object sender, EventArgs e)
        {
#if LITE
            if (Contacts.GetAll().Count >= Settings.MaxGroupFreeVersion)
            {
                UIAlertView alert = new UIAlertView(Settings.GetLocalizedString("SMS Party Free", LocalizedKey),
                                                    Settings.GetLocalizedString("SMS Party Free only allows a maximum of 5 groups to be created", LocalizedKey),
                                                    null, "OK");
                alert.Show();
                alert.Dispose();
                return;
            }
#endif
            CreateButtonTapped();
        }
Esempio n. 23
0
        public void ShowDialog <T> (string title, IEnumerable <T> items, Func <T, string> displayNameSelector, Action <T> onItemSelected)
        {
            var enumerable  = items as T[] ?? items.ToArray();
            var displayList = enumerable.Select(displayNameSelector).ToArray();

            UIApplication.SharedApplication.InvokeOnMainThread(delegate {
                LoadingOverlay.StopAnimatingLoading();
                var av      = new UIAlertView(title, string.Empty, null, null, displayList);
                av.Clicked += (sender, e) => {
                    onItemSelected(enumerable[e.ButtonIndex]);
                    av.Dispose();
                };
                av.Show();
            });
        }
Esempio n. 24
0
        /// <summary>
        /// Event when the delete photo buttton is pressed
        /// </summary>
        partial void DeletePhoto(MonoTouch.UIKit.UIButton sender2)
        {
            alertView            = new UIAlertView("Delete?", "Are you sure?", null, "Yes", "No");
            alertView.Dismissed += (sender, e) => {
                if (e.ButtonIndex == 0)
                {
                    photoViewModel
                    .DeletePhotoAsync(assignmentViewModel.SelectedAssignment, photoViewModel.SelectedPhoto)
                    .ContinueWith(_ => {
                        BeginInvokeOnMainThread(() => DismissViewController(true, null));
                    });
                }

                alertView.Dispose();
                alertView = null;
            };
            alertView.Show();
        }
Esempio n. 25
0
        public static void ShowAlert(string title, string message, Action dismissed = null)
        {
            var alert = new UIAlertView {
                Title = title, Message = message
            };

            alert.DismissWithClickedButtonIndex(alert.AddButton("Ok"), true);
            if (dismissed != null)
            {
                alert.Dismissed += (sender, e) =>
                {
                    dismissed();
                    alert.Dispose();
                }
            }
            ;
            alert.Show();
        }
Esempio n. 26
0
            public override void Dismissed(UIAlertView alertview, int buttonIndex)
            {
                // if user uses gallery, camera, etc, application will crash, because UINavigationController does not presented
                if (buttonIndex == 0)
                {
                    _positive.Execute();
                }
                else if (buttonIndex == 1)
                {
                    _negative.Execute();
                }
                else if (buttonIndex == 2)
                {
                    _neutral.Execute();
                }

                _alertViews.Remove(alertview);
                alertview.Dispose();
            }
Esempio n. 27
0
        partial void Add(NSObject sender)
        {
            if (prompt != null)
            {
                prompt.Dispose();
            }

            prompt = new UIAlertView("Add Item", String.Empty, null, "Cancel", "Add");
            prompt.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
            prompt.Clicked       += (s, e) =>
            {
                if (e.ButtonIndex == 1)
                {
                    UITextField text = prompt.GetTextField(0);
                    todoTable.InsertAsync(new TodoItem {
                        Text = text.Text
                    })
                    .ContinueWith(t => itemController.RefreshAsync(), scheduler);
                }
            };

            prompt.Show();
        }
Esempio n. 28
0
 void BizeYazinGonder()
 {
     if (BosVarmi())
     {
         var        Me         = DataBase.MEMBER_DATA_GETIR()[0];
         WebService webService = new WebService();
         ContactDTO contactDTO = new ContactDTO()
         {
             text   = MesajTextView.Text,
             topic  = textField.Text,
             userId = Me.id
         };
         string jsonString = JsonConvert.SerializeObject(contactDTO);
         var    Donus      = webService.ServisIslem("contacts", jsonString);
         if (Donus != "Hata")
         {
             var alert = new UIAlertView();
             alert.Title = "Buptis";
             alert.AddButton("Tamam");
             alert.Message        = "Destek talebiniz iletildi. Teşekkürler...";
             alert.AlertViewStyle = UIAlertViewStyle.Default;
             alert.Clicked       += (object s, UIButtonEventArgs ev) =>
             {
                 alert.Dispose();
                 this.DismissViewController(true, null);
             };
             alert.Show();
             textField.Text     = "";
             MesajTextView.Text = "";
         }
         else
         {
             CustomAlert.GetCustomAlert(this, "Bir sorun oluştu...");
             return;
         }
     }
 }
        new void Dispose()
        {
            //we have to un-register the event handlers because else the whole viewcontroller will be kept in the garbage collector.
            if (_meterTypeSegment != null)
            {
                _meterTypeSegment.ValueChanged -= HandleSegmentChange;
            }

            _meterTypeSegment?.Dispose();

            _selectionLabel?.Dispose();

            _toggleBarcodeLabel.RemoveFromSuperview();
            _toggleBarcodeLabel?.Dispose();

            _toggleBarcodeSwitch.ValueChanged -= OnValueChanged;
            _toggleBarcodeSwitch.RemoveFromSuperview();
            _toggleBarcodeSwitch?.Dispose();

            _toggleBarcodeView.RemoveFromSuperview();
            _toggleBarcodeView?.Dispose();

            _segmentItems = null;

            _alert?.Dispose();
            _error?.Dispose();

            //we have to erase the scan view so that there are no dependencies for the viewcontroller left.
            _anylineEnergyView?.RemoveFromSuperview();
            _anylineEnergyView?.Dispose();
            _anylineEnergyView = null;

            GC.Collect(GC.MaxGeneration);

            base.Dispose();
        }
Esempio n. 30
0
        void BanaYakinLokasyonlariGetir()
        {
            if (locationManager.Location != null)
            {
                WebService webService = new WebService();
                var        x          = locationManager.Location.Coordinate.Latitude.ToString().Replace(",", ".");
                var        y          = locationManager.Location.Coordinate.Longitude.ToString().Replace(",", ".");
                InvokeOnMainThread(delegate { LokasyonlarTableCell.UserLastloc = locationManager.Location; });

                var Donus = webService.OkuGetir("locations/near?x=" + x + "&y=" + y);
                if (Donus != null)
                {
                    var aa = Donus.ToString();
                    Mekanlar_Locations = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Mekanlar_Location> >(Donus.ToString());
                    if (Mekanlar_Locations.Count > 0)
                    {
                        InvokeOnMainThread(delegate() {
                            Tablo.Source = new LokasyonlarCustomTableCellSoruce(Mekanlar_Locations, this);
                            Tablo.ReloadData();
                            Tablo.BackgroundColor = UIColor.Clear;
                            Tablo.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
                            CustomLoading.Hide();
                        });
                    }
                    else
                    {
                        CustomAlert.GetCustomAlert(GelenBase1, "Çevrenizde hiç lokasyon bulunamadı...");
                        InvokeOnMainThread(delegate() {
                            Tablo.BackgroundColor = UIColor.Clear;
                            Tablo.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
                            Tablo.TableFooterView = new UIView();
                            CustomLoading.Hide();
                        });
                    }
                }
                else
                {
                    CustomLoading.Hide();
                }
            }
            else
            {
                CustomLoading.Hide();
                CustomAlert.GetCustomAlert(GelenBase1, "Çevrenizde hiç lokasyon bulunamadı...");
                return;

                var durum = CheckLocationPermission();
                if (!(bool)durum)
                {
                    InvokeOnMainThread(delegate()
                    {
                        var alert   = new UIAlertView();
                        alert.Title = "Buptis";
                        alert.AddButton("Evet");
                        alert.AddButton("Hayır");
                        alert.Message        = "Buptis konumunuzu kullanarak çevrenizde size yakın mekanları listelemektedir.\nKonum ayarlarını açmak istiyor musunuz?";
                        alert.AlertViewStyle = UIAlertViewStyle.Default;
                        alert.Clicked       += (object s, UIButtonEventArgs ev) =>
                        {
                            if (ev.ButtonIndex == 0)
                            {
                                alert.Dispose();
                                UIApplication.SharedApplication.OpenUrl(new NSUrl(UIApplication.OpenSettingsUrlString));
                            }
                            else
                            {
                                alert.Dispose();
                            }
                        };
                        alert.Show();
                    });
                }
            }
        }
		/// <summary>
		/// Event when the delete photo buttton is pressed
		/// </summary>
		partial void DeletePhoto ()
		{
			alertView = new UIAlertView ("Delete?", "Are you sure?", null, "Yes", "No");
			alertView.Dismissed += (sender, e) => {

				if (e.ButtonIndex == 0) {
					photoViewModel
						.DeletePhotoAsync (assignmentViewModel.SelectedAssignment, photoViewModel.SelectedPhoto)
						.ContinueWith (_ => {
							BeginInvokeOnMainThread (() => DismissViewController (true, null));
						});
				}

				alertView.Dispose ();
				alertView = null;
			};
			alertView.Show ();
		}
Esempio n. 32
0
        public virtual void AuthorizationChanged(CLLocationManager manager, CLAuthorizationStatus status)
        {
            Console.WriteLine(status.ToString());
            if (status == CLAuthorizationStatus.NotDetermined)
            {
                if (locationManager != null)
                {
                    // Check for iOS 8. Without this guard the code will crash with "unknown selector" on iOS 7.
                    if (locationManager.RespondsToSelector(new ObjCRuntime.Selector("requestWhenInUseAuthorization")))
                    {
                        locationManager.RequestWhenInUseAuthorization();
                    }
                    return;
                }
            }

            if (status == CLAuthorizationStatus.AuthorizedAlways || status == CLAuthorizationStatus.Denied)
            {
                string title   = (status == CLAuthorizationStatus.Denied) ? "Location services are off" : "Location Service is not enabled";
                string message = "To use Location Service you must turn on 'While using the app' in the Location Services Settings";

                if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
                {
                    Mvx.Resolve <IMvxMessenger>().Publish(new ProgressMessage(this.ViewModel, false));

                    UIAlertView alertView = new UIAlertView(title, message, null, "Cancel", "Settings");

                    alertView.Clicked += (object sender, UIButtonEventArgs e) =>
                    {
                        if (e.ButtonIndex == alertView.CancelButtonIndex) //cancel
                        {
                            ViewModel.CloseViewModel();
                        }
                        else
                        {
                            //go to settings
                            UIApplication.SharedApplication.OpenUrl(new NSUrl(UIApplication.OpenSettingsUrlString));
                        }
                    };

                    alertView.Dismissed += (sender, e) =>
                    {
                        alertView.Dispose();
                        alertView = null;
                    };

                    alertView.Show();
                }
                else
                {
                    // ios 7 only has two CLAuthorizationStatus : Denied and AuthorizedAlways
                    if (status == CLAuthorizationStatus.AuthorizedAlways)
                    {
                        return;
                    }

                    Mvx.Resolve <IMvxMessenger>().Publish(new ProgressMessage(this.ViewModel, false));

                    UIAlertView alertView = new UIAlertView(title, message, null, "OK");

                    alertView.Clicked += (sender, e) =>
                    {
                        if (e.ButtonIndex == alertView.CancelButtonIndex)
                        {
                            ViewModel.CloseViewModel();
                        }
                    };

                    alertView.Dismissed += (sender, e) =>
                    {
                        alertView.Dispose();
                        alertView = null;
                    };

                    alertView.Show();
                }
            }
        }
Esempio n. 33
0
 public void Dispose()
 {
     dict = null;
     sheet?.Dispose();
     controller?.Dispose();
 }
Esempio n. 34
0
 public static void ShowAlert(string title, string message, Action dismissed = null)
 {
     var alert = new UIAlertView {Title = title, Message = message};
     alert.DismissWithClickedButtonIndex(alert.AddButton("Ok"), true);
     if (dismissed != null)
         alert.Dismissed += (sender, e) =>
         {
             dismissed();    
             alert.Dispose();
         };
     alert.Show();
 }
Esempio n. 35
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationController.SetNavigationBarHidden(false, true);

            #region UI Settings

            if (!DeviceHelper.IsPad)
            {
                AdjustFontSize(this.View);
            }

            //SetBackButtonTitle("Back");

            this.AutomaticallyAdjustsScrollViewInsets = false;

            #endregion


            mToastToken = Mvx.Resolve <IMvxMessenger>().SubscribeOnMainThread <ToastMessage>((ToastMessage message) =>
            {
                if (message.Sender != ViewModel)
                {
                    return;
                }

                if (!string.IsNullOrEmpty(message.Message))
                {
                    var progressHud = new ProgressHUD()
                    {
                        ForceiOS6LookAndFeel = true
                    };

                    progressHud.ShowToast(message.Message, ProgressHUD.MaskType.None, ProgressHUD.ToastPosition.Bottom, 1500);

                    progressHud.Dispose();
                    progressHud = null;
                }
            });

            mProgressToken = Mvx.Resolve <IMvxMessenger>().SubscribeOnMainThread <ProgressMessage>(message =>
            {
                if (message.Sender != ViewModel)
                {
                    return;
                }

                if (message.IsShow)
                {
                    if (mProgressHud == null)
                    {
                        mProgressHud = new ProgressHUD()
                        {
                            ForceiOS6LookAndFeel = true
                        }
                    }
                    ;

                    mProgressHud.Show(message.Message, -1, message.IsAllowInteraction ? ProgressHUD.MaskType.None : ProgressHUD.MaskType.Clear);
                }
                else
                {
                    if (mProgressHud != null)
                    {
                        mProgressHud.Dismiss();
                        mProgressHud.Dispose();
                        mProgressHud = null;
                    }
                }
            });

            mAlertToken = Mvx.Resolve <IMvxMessenger>().SubscribeOnMainThread <AlertMessage>(message =>
            {
                if (message.Sender != ViewModel)
                {
                    return;
                }

                //TODO : use UIAlertView in iOS 7.x
                if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
                {
                    //  show alert view with more than 1 buttons (e.g OK and Cancel )
                    if (message.OtherTitles != null && message.OtherActions != null)
                    {
                        if (mAlertView == null)
                        {
                            mAlertView = new UIAlertView(message.Title, message.Message, null, message.CancelTitle);
                        }

                        if (message.OtherTitles.Length == message.OtherActions.Length)
                        {
                            foreach (var title in message.OtherTitles)
                            {
                                mAlertView.AddButton(title);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Please check your message constructor");
                            return;
                        }

                        mAlertView.Clicked += (object sender, UIButtonEventArgs e) =>
                        {
                            if (e.ButtonIndex != 0)
                            {
                                message.OtherActions[(int)e.ButtonIndex - 1]();
                            }
                            else
                            {
                                if (message.CancelAction != null)
                                {
                                    message.CancelAction();
                                }
                            }
                        };

                        mAlertView.Dismissed += (object sender, UIButtonEventArgs e) =>
                        {
                            if (mAlertView != null)
                            {
                                mAlertView.Dispose();
                                mAlertView = null;
                            }
                        };

                        mAlertView.Show();
                    }
                    //this is just a normal alert view :)
                    else
                    {
                        if (mAlertView == null)
                        {
                            mAlertView = new UIAlertView(message.Title, message.Message, null, message.CancelTitle);
                        }

                        mAlertView.Clicked += (object sender, UIButtonEventArgs e) =>
                        {
                            if (message.CancelAction != null)
                            {
                                message.CancelAction();
                            }
                        };

                        mAlertView.Dismissed += (object sender, UIButtonEventArgs e) =>
                        {
                            if (mAlertView != null)
                            {
                                mAlertView.Dispose();
                                mAlertView = null;
                            }
                        };

                        mAlertView.Show();
                    }
                }
                else
                {
                    //show alert view with more than 1 buttons (e.g OK and Cancel )
                    if (message.OtherTitles != null && message.OtherActions != null)
                    {
                        UIAlertController alertController = UIAlertController.Create(message.Title, message.Message, UIAlertControllerStyle.Alert);
                        UIAlertAction cancelAction        = UIAlertAction.Create(message.CancelTitle, UIAlertActionStyle.Cancel,
                                                                                 action =>
                        {
                            if (message.CancelAction != null)
                            {
                                message.CancelAction();
                            }
                        });
                        alertController.AddAction(cancelAction);

                        if (message.OtherTitles.Length == message.OtherActions.Length)
                        {
                            for (int i = 0; i < message.OtherTitles.Length; i++)
                            {
                                UIAlertAction alertAction = UIAlertAction.Create(message.OtherTitles[i], UIAlertActionStyle.Default,
                                                                                 action =>
                                {
                                    if ((i - 1 >= 0) && (message.OtherActions[i - 1] != null))
                                    {
                                        message.OtherActions[i - 1]();
                                    }
                                });
                                alertController.AddAction(alertAction);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Please check your message constructor");
                            return;
                        }

                        PresentViewController(alertController, true, null);
                    }
                    //this is just a normal alert view :)
                    else
                    {
                        UIAlertController alertController = UIAlertController.Create(message.Title, message.Message, UIAlertControllerStyle.Alert);
                        UIAlertAction cancelAction        = UIAlertAction.Create(message.CancelTitle, UIAlertActionStyle.Cancel,
                                                                                 action =>
                        {
                            if (message.CancelAction != null)
                            {
                                message.CancelAction();
                            }
                        });

                        alertController.AddAction(cancelAction);

                        PresentViewController(alertController, true, null);
                    }
                }
            });
        }
		/// <summary>
		/// Event when the decline button is clicked
		/// </summary>
		partial void Decline ()
		{
			alertView = new UIAlertView("Decline Assignment", "Are you sure?", null, "Yes", "No");
			alertView.Dismissed += (sender, e) => {
				if (e.ButtonIndex == 0) {
					assignment.Status = AssignmentStatus.Declined;

					SaveAssignment ();
				}

				alertView.Dispose ();
				alertView = null;
			};
			alertView.Show ();
		}