Beispiel #1
0
        public static void Alert(ChatsViewController thisView)
        {
            UIAlertController loginAlert = UIAlertController.Create("Login Online", "Please enter your email and password", UIAlertControllerStyle.Alert);

            loginAlert.AddTextField((field) =>
            {
                field.Placeholder  = "Email";
                field.KeyboardType = UIKeyboardType.EmailAddress;
            });

            loginAlert.AddTextField((field) =>
            {
                field.Placeholder     = "Password";
                field.SecureTextEntry = true;
            });


            UIAlertAction loginAction;

            loginAction = UIAlertAction.Create("Login", UIAlertActionStyle.Default, async(UIAlertAction obj) => await Login(thisView, loginAlert.TextFields[0].Text, loginAlert.TextFields[1].Text));

            loginAlert.AddAction(loginAction);

            loginAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Destructive, null));

            thisView.PresentViewController(loginAlert, true, null);
        }
Beispiel #2
0
        void setupAlertController()
        {
            UITextField usernameField = null;
            UITextField passwordField = null;
            var         cancel        = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (alert) => { tcs.TrySetCanceled(); });
            var         ok            = UIAlertAction.Create("Login", UIAlertActionStyle.Default,
                                                             a => { tcs.TrySetResult(new Tuple <string, string>(usernameField.Text, passwordField.Text)); });

            alertController.AddTextField(field =>
            {
                field.Placeholder = "Username";
                if (Device.IsIos10)
                {
                    field.TextContentType = UITextContentType.Username;
                }
                usernameField = field;
            });
            alertController.AddTextField(field =>
            {
                field.Placeholder = "Password";
                if (Device.IsIos10)
                {
                    field.TextContentType = UITextContentType.Password;
                }
                field.SecureTextEntry = true;
                passwordField         = field;
            });
            alertController.AddAction(ok);
            alertController.AddAction(cancel);
        }
Beispiel #3
0
        private void ShowEditableAttributes()
        {
            // Create the alert controller.
            alertController = UIAlertController.Create(null, "Edit feature attributes", UIAlertControllerStyle.Alert);
            alertController.AddTextField(new Action <UITextField>(SetAddressText));
            alertController.AddTextField(new Action <UITextField>(SetStreetText));
            alertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, OkClick));
            alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            // Show the alert.
            PresentViewController(alertController, true, null);
        }
        private void ShowLoginUI()
        {
            // Prompt for the type of convex hull to create.
            UIAlertController loginAlert = UIAlertController.Create("Authenticate", "", UIAlertControllerStyle.Alert);

            loginAlert.AddTextField(field => field.Placeholder = "Username = user1");
            loginAlert.AddTextField(field => field.Placeholder = "Password = user1");
            loginAlert.AddAction(UIAlertAction.Create("Log in", UIAlertActionStyle.Default, action => { LoginEntered(loginAlert.TextFields[0].Text, loginAlert.TextFields[1].Text); }));
            loginAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            // Show the alert.
            PresentViewController(loginAlert, true, null);
        }
        private void AddButtonTapped(object sender, EventArgs e)
        {
            UIAlertController alertController = UIAlertController.Create("Новая подзадача", "", UIAlertControllerStyle.Alert);

            alertController.AddTextField((obj) =>
            {
                obj.Placeholder = "Текст";
            });

            UIAlertAction saveAction = UIAlertAction.Create("Сохранить", UIAlertActionStyle.Default, (obj) =>
            {
                UITextField tf  = alertController.TextFields[0];
                var sub         = new SubTask();
                sub.Title       = tf.Text;
                sub.SuperTaskID = Task.ID;
                Database.SaveSubtask(sub);
                subtasksList = Database.GetSubtasksByMainTaskID(Task.ID);
                tableView.ReloadData();
            });

            UIAlertAction cancelAction = UIAlertAction.Create("Отмена", UIAlertActionStyle.Cancel, null);

            alertController.AddAction(saveAction);
            alertController.AddAction(cancelAction);
            PresentViewController(alertController, true, null);
        }
        private void NameEdit()
        {
            UIAlertController alertController = UIAlertController.Create(
                "Enter Name(s)",
                "Please enter your name(s) or the name of your group:",
                UIAlertControllerStyle.Alert);

            UITextField field = null;

            // Add and configure text field
            alertController.AddTextField((textField) =>
            {
                // Save the field
                field = textField;
                field.ReturnKeyType   = UIReturnKeyType.Done;
                field.ClearButtonMode = UITextFieldViewMode.WhileEditing;
                field.Text            = (TableView.Source as TaskViewSource).enteredName;
            });

            alertController.AddAction(UIAlertAction.Create("Done", UIAlertActionStyle.Default, (actionOK) =>
            {
                if (!string.IsNullOrWhiteSpace(field.Text))
                {
                    (TableView.Source as TaskViewSource).enteredName = field.Text;
                    TableView.ReloadRows(new NSIndexPath[] { NSIndexPath.FromRowSection(0, 0) }, UITableViewRowAnimation.Automatic);
                    var suppress = SaveProgress();
                }
            }));

            // Add cancel button
            alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            PresentViewController(alertController, true, null);
        }
 private void ValueClick(object sender, EventArgs e)
 {
     // Verify that an attribute has been selected.
     if (_selectedAttribute != null)
     {
         UIAlertController prompt = null;
         if (_selectedAttribute.Domain is CodedValueDomain domain)
         {
             // Add every coded value as an action on the prompt.
             prompt = UIAlertController.Create(null, "Choose the value.", UIAlertControllerStyle.Alert);
             foreach (CodedValue value in domain.CodedValues)
             {
                 UIAlertAction action = UIAlertAction.Create(value.Name, UIAlertActionStyle.Default, (s) => ValueSelected(value));
                 prompt.AddAction(action);
             }
         }
         else
         {
             // Create an alert for the user to enter the value using the keyboard.
             prompt = UIAlertController.Create(null, "Enter the value", UIAlertControllerStyle.Alert);
             prompt.AddTextField(obj =>
             {
                 _valueTextEntry  = obj;
                 obj.Text         = "";
                 obj.KeyboardType = UIKeyboardType.NumberPad;
             });
             prompt.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, ValueEntered));
         }
         prompt.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));
         PresentViewController(prompt, true, null);
     }
 }
Beispiel #8
0
        public void ShowInputDialog(string title, string text, string ok, string cancel, string hint, string placeholder, Action <bool, string> callback)
        {
            inputDialog = UIAlertController.Create(title, text, UIAlertControllerStyle.Alert);
            UITextField input = null;

            inputDialog.AddTextField((textField) =>
            {
                input = textField;

                input.Placeholder = hint;
                if (placeholder != null)
                {
                    input.Text = placeholder;
                }
                input.AutocorrectionType = UITextAutocorrectionType.No;
                input.KeyboardType       = UIKeyboardType.Default;
                input.ReturnKeyType      = UIReturnKeyType.Done;
                input.ClearButtonMode    = UITextFieldViewMode.WhileEditing;
            });
            inputDialog.AddAction(UIAlertAction.Create(ok, UIAlertActionStyle.Default, (x) =>
            {
                callback(true, input.Text);
            }));
            if (cancel != null)
            {
                inputDialog.AddAction(UIAlertAction.Create(cancel, UIAlertActionStyle.Cancel, (x) =>
                {
                    callback(false, input.Text);
                }));
            }
            GetTopViewController().PresentViewController(inputDialog, true, null);
        }
        private void AddOptionPressed(object sender, EventArgs e)
        {
            UIAlertController alertController = UIAlertController.Create(
                "New Option",
                "Enter your new choice option below:",
                UIAlertControllerStyle.Alert);

            UITextField field = null;

            // Add and configure text field
            alertController.AddTextField((textField) =>
            {
                // Save the field
                field = textField;
                field.ReturnKeyType   = UIReturnKeyType.Done;
                field.ClearButtonMode = UITextFieldViewMode.WhileEditing;
            });

            alertController.AddAction(UIAlertAction.Create("Add", UIAlertActionStyle.Default, (actionOK) =>
            {
                if (!string.IsNullOrWhiteSpace(field.Text))
                {
                    viewSource.AddRow(field.Text);
                }
            }));

            // Add cancel button
            alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            PresentViewController(alertController, true, () => { });
        }
        partial void OneToOneChatBtn_TouchUpInside(UIButton sender)
        {
            UIAlertController alert = UIAlertController.Create("Applozic Demo!!!", "Enter userId of receiver", UIAlertControllerStyle.Alert);

            alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, action =>
            {
                // This code is invoked when the user taps on login, and this shows how to access the field values
                Console.WriteLine("UserID: {0}", alert.TextFields[0].Text);
                String userId = alert.TextFields[0].Text;

                if (String.IsNullOrEmpty(userId))
                {
                    new UIAlertView("", "Please enter userId", null, "OK", null).Show();
                    return;
                }
                ALChatManager.launchChatForUser(userId, this);
            }));

            //Cancel
            alert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Default, action =>
            {
                Console.WriteLine("UserID: {0}", alert.TextFields[0].Text);
            }));

            alert.AddTextField((field) =>
            {
                field.Placeholder = "userId";
            });

            PresentViewController(alert, animated: true, completionHandler: null);
        }
        //what should happen when specific row in tableview is selected
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            //show alertview when first cell is pressed to adjust drinking goal
            if (indexPath.Section == 0 && indexPath.Row == 0)
            {
                #region AlertDialog mit UIAlertController

                UIAlertController alertController = UIAlertController.Create("Daily water intake", "Please change your intake to a new amount (ml).", UIAlertControllerStyle.Alert);
                UITextField       EditWaterIntake = null;

                alertController.AddTextField(EditWaterIntakeTxt =>
                {
                    EditWaterIntake      = EditWaterIntakeTxt;
                    jsonDict             = jsonHelper.jsonGetAllData();
                    EditWaterIntake.Text = jsonDict["amount"].ToString();
                });

                alertController.AddAction(UIAlertAction.Create("Update",
                                                               UIAlertActionStyle.Default,
                                                               onClick =>
                {
                    jsonDict["amount"] = int.Parse(EditWaterIntake.Text);
                    jsonHelper.jsonWrite(jsonDict);
                    Console.WriteLine(jsonDict.Values);
                }));
                alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

                PresentViewController(alertController, true, null);
                #endregion
            }

            //show alertview when third cell is pressed to adjust weight
            if (indexPath.Section == 0 && indexPath.Row == 2)
            {
                #region AlertDialog mit UIAlertController

                UIAlertController alertController = UIAlertController.Create("Change your weight", "Please enter your weight below (kg)", UIAlertControllerStyle.Alert);
                UITextField       EditWeight      = null;

                alertController.AddTextField(EditWeightTxt =>
                {
                    EditWeight      = EditWeightTxt;
                    jsonDict        = jsonHelper.jsonGetAllData();
                    EditWeight.Text = jsonDict["weight"].ToString();
                });

                alertController.AddAction(UIAlertAction.Create("Update",
                                                               UIAlertActionStyle.Default,
                                                               onClick =>
                {
                    jsonDict["weight"] = int.Parse(EditWeight.Text);
                    jsonHelper.jsonWrite(jsonDict);
                    Console.WriteLine(jsonDict.Values);
                }));
                alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

                PresentViewController(alertController, true, null);
                #endregion
            }
        }
        private void ShowOAuthPropsUi()
        {
            UIAlertController alertController = UIAlertController.Create("OAuth Properties", "Set the client ID and redirect URL",
                                                                         UIAlertControllerStyle.Alert);

            alertController.AddTextField(field => { field.Text = _appClientId; });
            alertController.AddTextField(field => { field.Text = _oAuthRedirectUrl; });
            alertController.AddAction(UIAlertAction.Create("Save", UIAlertActionStyle.Default, uiAction =>
            {
                _appClientId      = alertController.TextFields[0].Text.Trim();
                _oAuthRedirectUrl = alertController.TextFields[1].Text.Trim();
                UpdateAuthenticationManager();
            }));

            PresentViewController(alertController, true, null);
        }
        private void SearchForActivity(object s, object e)
        {
            UIAlertController alert = UIAlertController.Create("Enter Share Code",
                                                               "Enter the share code for the activity you wish to open.",
                                                               UIAlertControllerStyle.Alert);

            alert.AddTextField((textField) =>
            {
                textField.Placeholder = "Share code";
            });

            alert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));
            alert.AddAction(UIAlertAction.Create("Search", UIAlertActionStyle.Default, (UIAlertAction obj) =>
            {
                string enteredText = alert.TextFields[0].Text;
                if (string.IsNullOrWhiteSpace(enteredText))
                {
                    return;
                }

                var suppress = GetAndOpenActivity(enteredText);
            }));

            PresentViewController(alert, true, null);
        }
Beispiel #14
0
        //AlertDialog zum hinzufügen von einem Task
        public void alertDialog()
        {
            /* Deprecated Version
             * UIAlertView alertView = new UIAlertView();
             * alertView.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
             * alertView.Title = "Neuen Task anlegen";
             * alertView.Message = "Bitte Taskbeschreibung angeben";
             * alertView.AddButton("Abbrechen");
             * alertView.AddButton("OK");
             * alertView.Show();
             *
             * alertView.Clicked += (object sender, UIButtonEventArgs args) =>
             * {
             *  if (args.ButtonIndex == 1 && alertView.GetTextField(0).Text.Length > 0)
             *  {
             *      taskList.RemoveAt(taskList.Count-1);
             *      taskList.Add(new Task(alertView.GetTextField(0).Text));
             *      taskList.Add(new Task("(add new)"));
             *      tableTasks.ReloadData();
             *  }
             * };*/
            //AlertController anlegen
            UIAlertController alertController = UIAlertController.Create(
                "Task hinzufügen",
                "Bitte Taskbeschreibung angeben",
                UIAlertControllerStyle.Alert);

            //Eingabefeld hinzufügen
            UITextField txtAddTask = null;

            alertController.AddTextField(AddTaskTxt =>
            {
                txtAddTask             = AddTaskTxt;
                txtAddTask.Placeholder = "Hier Taskbechreibung einfügen";
            });

            //OK-Button hinzufügen
            alertController.AddAction(UIAlertAction.Create(
                                          "OK",
                                          UIAlertActionStyle.Default,
                                          onClick =>
            {
                if (txtAddTask.Text.Length > 0)
                {
                    taskList.RemoveAt(taskList.Count - 1);
                    taskList.Add(new Task(txtAddTask.Text));
                    taskList.Add(new Task("(add new)"));
                    tableTasks.ReloadData();
                }
            }));
            //Cancel-Button hinzufügen
            alertController.AddAction(UIAlertAction.Create(
                                          "Abbrechen",
                                          UIAlertActionStyle.Default,
                                          null));
            //PresentViewController aufrufen zur Anzeige des Dialoges
            PresentViewController(alertController, true, null);
        }
        //int index;
        partial void ViewRaceRecordButton_TouchUpInside(UIButton sender)
        {
            left             = true;
            alertController1 = UIAlertController.Create("Race Record", null, UIAlertControllerStyle.Alert);
            alertController1.AddTextField((field) =>
            {
                field.Placeholder = "Location";
            });
            alertController1.AddTextField((field) =>
            {
                field.Placeholder = "Course";
            });
            UIAlertAction saveAction;

            saveAction = UIAlertAction.Create("Filter", UIAlertActionStyle.Default, action => filterRace());
            alertController1.AddAction(saveAction);
            alertController1.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));
            PresentViewController(alertController1, true, null);
        }
        partial void ViewSeriesRecordButton_TouchUpInside(UIButton sender)
        {
            left             = false;
            alertController2 = UIAlertController.Create("Series Record", null, UIAlertControllerStyle.Alert);
            alertController2.AddTextField((field) =>
            {
                field.Placeholder = "Year";
            });
            alertController2.AddTextField((field) =>
            {
                field.Placeholder = "Series";
            });
            UIAlertAction saveAction;

            saveAction = UIAlertAction.Create("Filter", UIAlertActionStyle.Default, action => filterSeries());
            alertController2.AddAction(saveAction);
            alertController2.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));
            PresentViewController(alertController2, true, null);
        }
Beispiel #17
0
 /// <summary>
 /// start Recodring button
 /// </summary>
 /// <param name="sender"></param>
 partial void UIButton399_TouchUpInside(UIButton sender)
 {
     // two branches since the button changes functions
     // 1. recording
     // 2. not recording
     if (audioRecorder.recording)
     {
         sender.SetTitle("Record a sound", UIControlState.Normal);
         sender.BackgroundColor = UIColor.SystemGreenColor;
         audioRecorder.StopRecording();
         // alert window for naming the sound
         UIAlertController alert = UIAlertController.Create(
             "Sound Name",
             "Enter a name for this sound",
             UIAlertControllerStyle.Alert
             );
         alert.AddAction(UIAlertAction.Create("Save sound", UIAlertActionStyle.Default, action => {
             frameExtractor.AddSupportedRecording(
                 Utils.GetFileName(audioRecorder.name_placeholder),
                 alert.TextFields[0].Text
                 );
             try
             {
                 File.Move(
                     Utils.GetFileName(audioRecorder.name_placeholder),
                     Utils.GetFileName(alert.TextFields[0].Text)
                     );
             }
             catch (IOException)
             {
                 // in case a file with this name already exists
                 // File.Move cant handle overriding
                 File.Delete(Utils.GetFileName(alert.TextFields[0].Text));
                 File.Move(
                     Utils.GetFileName(audioRecorder.name_placeholder),
                     Utils.GetFileName(alert.TextFields[0].Text)
                     );
             }
         }));
         alert.AddTextField((field) => {
             field.Placeholder = "sound name";
         });
         PresentViewController(alert, animated: true, completionHandler: null);
         audioRecorder.recording  = false;
         frameExtractor.recording = false;
     }
     else
     {
         audioRecorder.StartRecording();
         frameExtractor.recording = true;
         sender.SetTitle("Recording", UIControlState.Normal);
         sender.BackgroundColor  = UIColor.SystemRedColor;
         audioRecorder.recording = true;
     }
 }
Beispiel #18
0
 private void CreateAlertButton(UIAlertController alert, string placeholder)
 {
     alert.AddTextField((fieldTextField) =>
     {
         fieldTextField.Placeholder        = placeholder;
         fieldTextField.AutocorrectionType = UITextAutocorrectionType.No;
         fieldTextField.KeyboardType       = UIKeyboardType.Default;
         fieldTextField.ReturnKeyType      = UIReturnKeyType.Done;
         fieldTextField.ClearButtonMode    = UITextFieldViewMode.WhileEditing;
     });
 }
        private void SaveMapClicked(object sender, EventArgs e)
        {
            UIAlertController alertController = UIAlertController.Create("Map properties", "Set the title, description, and tags",
                                                                         UIAlertControllerStyle.Alert);

            alertController.AddTextField(field => { field.Text = _title; });
            alertController.AddTextField(field => { field.Text = _description; });
            alertController.AddTextField(field => { field.Text = _tags; });

            alertController.AddAction(UIAlertAction.Create("Save", UIAlertActionStyle.Default, uiAction =>
            {
                _title       = alertController.TextFields[0].Text.Trim();
                _description = alertController.TextFields[1].Text.Trim();
                _tags        = alertController.TextFields[2].Text.Trim();
                MapItemInfoEntered();
            }));

            alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            PresentViewController(alertController, true, null);
        }
Beispiel #20
0
        public Task ShowDialog(ItemModel _item, string _description)
        {
            var tcs = new TaskCompletionSource <bool>();

            try
            {
                UIAlertController alert = UIAlertController.Create("", _description, UIAlertControllerStyle.Alert);
                UITextField       field = null;

                // Add and configure text field
                alert.AddTextField((textField) =>
                {
                    // Save the field
                    field = textField;

                    // Initialize field
                    field.Placeholder        = "Add new name";
                    field.AutocorrectionType = UITextAutocorrectionType.No;
                    field.KeyboardType       = UIKeyboardType.Default;
                    field.ReturnKeyType      = UIReturnKeyType.Done;
                    field.ClearButtonMode    = UITextFieldViewMode.WhileEditing;
                });

                // Add cancel button
                alert.AddAction(UIAlertAction.Create("CANCEL", UIAlertActionStyle.Cancel, (actionCancel) =>
                {
                    tcs.SetResult(false);
                }));

                // Add ok button
                alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, (actionOK) =>
                {
                    if (field.Text.Trim().Length > 0)
                    {
                        _item.Name = field.Text.Trim();
                    }

                    tcs.SetResult(true);
                }));

                // Display the alert
                UIWindow         window     = UIApplication.SharedApplication.KeyWindow;
                UIViewController controller = window.RootViewController;

                controller.PresentViewController(alert, true, null);
            }
            catch
            {
                tcs.TrySetResult(false);
            }

            return(tcs.Task);
        }
Beispiel #21
0
        private void ZoomToQuery_Click(object sender, EventArgs e)
        {
            // Prompt for the type of convex hull to create.
            UIAlertController unionAlert = UIAlertController.Create("Query features", "Enter a state abbreviation (e.g. CA)", UIAlertControllerStyle.Alert);

            unionAlert.AddTextField(field => field.Placeholder = "e.g. CA");
            unionAlert.AddAction(UIAlertAction.Create("Submit query", UIAlertActionStyle.Default, action => ZoomToFeature(unionAlert.TextFields[0].Text)));
            unionAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            // Show the alert.
            PresentViewController(unionAlert, true, null);
        }
        private void OnQueryClicked(object sender, EventArgs e)
        {
            // Prompt for the type of convex hull to create.
            UIAlertController unionAlert = UIAlertController.Create("Query features", "Enter a state name.", UIAlertControllerStyle.Alert);

            unionAlert.AddTextField(field => field.Placeholder = "State name");
            unionAlert.AddAction(UIAlertAction.Create("Submit query", UIAlertActionStyle.Default, async action => await QueryStateFeature(unionAlert.TextFields[0].Text)));
            unionAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            // Show the alert.
            PresentViewController(unionAlert, true, null);
        }
        void NumberOneAlert(int num)
        {
            UIAlertController alert = UIAlertController.Create("Choose the limit", "Please write the multiplication limit your number will have. Invalid numbers will be taken as a 0", UIAlertControllerStyle.Alert);

            alert.AddTextField((alertText) => {});

            var cancelAction = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null);
            var okayAction   = UIAlertAction.Create("Okay", UIAlertActionStyle.Default, action => NumberOne(num));

            alert.AddAction(okayAction);
            alert.AddAction(cancelAction);
            PresentViewController(alert, true, null);
        }
        public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
        {
            // show an alert
            okayAlertController = UIAlertController.Create(notification.AlertAction, notification.AlertBody, UIAlertControllerStyle.Alert);
            okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, action => GetEmail()));
            okayAlertController.AddTextField(delegate(UITextField textField)
            {
            });
            Window.RootViewController.PresentViewController(okayAlertController, true, null);

            // reset our badge
            UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
        }
        private void SearchMaps_Clicked(object sender, EventArgs e)
        {
            // Prompt for the query.
            UIAlertController unionAlert = UIAlertController.Create("Search for maps", "Enter a search term.",
                                                                    UIAlertControllerStyle.Alert);

            unionAlert.AddTextField(field => { });
            unionAlert.AddAction(UIAlertAction.Create("Search", UIAlertActionStyle.Default,
                                                      action => SearchTextEntered(unionAlert.TextFields[0].Text)));
            unionAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            // Show the alert.
            PresentViewController(unionAlert, true, null);
        }
Beispiel #26
0
        void setupAlertController()
        {
            UITextField textField = null;
            var         cancel    = UIAlertAction.Create(Strings.Nevermind, UIAlertActionStyle.Cancel, (alert) => { tcs.TrySetCanceled(); });
            var         ok        = UIAlertAction.Create(buttonText, UIAlertActionStyle.Default, a => { tcs.TrySetResult(textField.Text); });

            alertController.AddTextField(field =>
            {
                field.Text = defaultText;
                textField  = field;
            });
            alertController.AddAction(ok);
            alertController.AddAction(cancel);
        }
Beispiel #27
0
        private void OnAddBookmarksButtonClicked(object sender, EventArgs e)
        {
            // Create Alert for naming the bookmark.
            if (_textInputAlertController == null)
            {
                _textInputAlertController = UIAlertController.Create("Provide the bookmark name", "", UIAlertControllerStyle.Alert);

                // Add Text Input.
                _textInputAlertController.AddTextField(textField => { });

                void HandleAlertAction(UIAlertAction action)
                {
                    // Get the name from the text field.
                    string name = _textInputAlertController.TextFields[0].Text;

                    // Exit if the name is empty.
                    if (String.IsNullOrEmpty(name))
                    {
                        return;
                    }

                    // Check to see if there is a bookmark with same name.
                    bool doesNameExist = _myMapView.Map.Bookmarks.Any(b => b.Name == name);

                    if (doesNameExist)
                    {
                        return;
                    }

                    // Create a new bookmark.
                    Bookmark myBookmark = new Bookmark
                    {
                        Name = name,
                        // Get the current viewpoint from map and assign it to bookmark .
                        Viewpoint = _myMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry)
                    };

                    // Add the bookmark to bookmark collection of the map.
                    _myMapView.Map.Bookmarks.Add(myBookmark);
                }

                // Add Actions.
                _textInputAlertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));
                _textInputAlertController.AddAction(UIAlertAction.Create("Done", UIAlertActionStyle.Default, HandleAlertAction));
            }

            // Show the alert.
            PresentViewController(_textInputAlertController, true, null);
        }
        //Esta es la acción que se ejecuta al seleccionar uno de los números.
        void SetMultiplicationNumber(UIAlertAction obj)
        {
            //Se parsea el número seleccionado en la primera alerta.
            multiplicationNum = int.Parse(obj.Title);

            //Se muestra la segunda alerta.
            UIAlertController alert = UIAlertController.Create("Ahora inserte el número máximo entero de la tabla de multiplicar (Del -999 al 999):", null, UIAlertControllerStyle.Alert);

            alert.AddTextField(IngresarLimiteMultiplicacion);
            alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, EstablecerLimiteMultiplicacion));
            alert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));


            PresentViewController(viewControllerToPresent: alert, animated: true, completionHandler: null);
        }
        // Function to query map image sublayers when the query button is clicked.
        private void QuerySublayers_Click(object sender, EventArgs e)
        {
            // Clear selected features from the graphics overlay.
            _selectedFeaturesOverlay.Graphics.Clear();

            // Prompt the user for a query.
            UIAlertController prompt = UIAlertController.Create("Enter query", "Query for places with population(2000) > ", UIAlertControllerStyle.Alert);

            prompt.AddTextField((obj) =>
            {
                _queryEntry = obj;
                obj.Text    = "181000";
            });
            prompt.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, submitQuery));
            PresentViewController(prompt, true, null);
        }
Beispiel #30
0
        private void ShowUrlInputEventHandler(object sender, EventArgs e)
        {
            UIAlertController alert = UIAlertController.Create("Load From URL", null, UIAlertControllerStyle.Alert);

            alert.AddTextField((UITextField obj) => obj.Placeholder = "Enter URL");

            UIAlertAction load = UIAlertAction.Create("Load", UIAlertActionStyle.Default, (obj) => this.LoadAnimationFromUrl(alert.TextFields.ToString()));

            alert.AddAction(load);

            UIAlertAction close = UIAlertAction.Create("Cancel", UIAlertActionStyle.Default, null);

            alert.AddAction(close);

            this.PresentViewController(alert, animated: true, completionHandler: null);
        }