void OnActionSheetRequested(Page sender, ActionSheetArguments arguments) { // Verify that the page making the request is part of this activity if (!PageIsInThisContext(sender)) { return; } var builder = new AlertDialog.Builder(Activity); builder.SetTitle(arguments.Title); string[] items = arguments.Buttons.ToArray(); builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which])); if (arguments.Cancel != null) { builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel)); } if (arguments.Destruction != null) { builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction)); } AlertDialog dialog = builder.Create(); builder.Dispose(); //to match current functionality of renderer we set cancelable on outside //and return null dialog.SetCanceledOnTouchOutside(true); dialog.CancelEvent += (o, e) => arguments.SetResult(null); dialog.Show(); }
private void ShowModeConfigurationDialog(int joystickId) { // Build and display the mode configuration dialog AlertDialog modeConfigurationDialog = null; AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AlertDialogStyle); builder.SetSingleChoiceItems(Resource.Array.JoystickModes, (int)GetRelatedJoystickConfiguration(joystickId).JoystickMode, delegate(object sender, DialogClickEventArgs args) { ConfigureJoystickAxis((JoystickConfiguration.JoystickModes)args.Which, joystickId); // ReSharper disable once AccessToModifiedClosure modeConfigurationDialog?.Dismiss(); }); builder.SetPositiveButton(Resource.String.ControlInterfaceActivity_configureJoystickModeDialogPositive, delegate { // ReSharper disable once AccessToModifiedClosure modeConfigurationDialog?.Dismiss(); }); builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickModeDialogTitle); builder.SetCancelable(false); modeConfigurationDialog = builder.Create(); modeConfigurationDialog.Show(); }
public void activateGodmode() { LayoutInflater layoutInflater = LayoutInflater.From(this); View view = layoutInflater.Inflate(Resource.Layout.GiftCode, null); Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this); alertbuilder.SetView(view); String code = ""; var input = view.FindViewById <EditText>(Resource.Id.editText); alertbuilder.SetCancelable(false) .SetPositiveButton("Choose", delegate { code = input.Text; if (code == "godmode") { godmode = !godmode; } Console.WriteLine(code + " " + godmode); canvasView.Invalidate(); }) .SetNegativeButton("Cancel", delegate { alertbuilder.Dispose(); }); Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create(); dialog.Show(); }
public void ShowDialog() { alertBuilder = new Android.Support.V7.App.AlertDialog.Builder(_activity); alertBuilder.SetView(Resource.Layout.progress_dialog_layout); alertBuilder.SetCancelable(false); alertDialog = alertBuilder.Show(); }
/// <summary> /// Show Reaction dialog when user long click on react button /// </summary> public void ClickDialog(CommentReplyClickEventArgs postData) { try { PostData = postData; //Show Dialog With 6 React Android.Support.V7.App.AlertDialog.Builder dialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(MainContext); //Irrelevant code for customizing the buttons and title LayoutInflater inflater = (LayoutInflater)MainContext.GetSystemService(Context.LayoutInflaterService); View dialogView = inflater.Inflate(Resource.Layout.XReactDialogLayout, null); InitializingReactImages(dialogView); ClickImageButtons(); dialogBuilder.SetView(dialogView); MReactAlertDialog = dialogBuilder.Create(); MReactAlertDialog.Window.SetBackgroundDrawableResource(MReactDialogShape); Window window = MReactAlertDialog.Window; window.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); MReactAlertDialog.Show(); } catch (Exception e) { Console.WriteLine(e); } }
void ShowProgressDialogue() { alert = new Android.Support.V7.App.AlertDialog.Builder(this); alert.SetView(Resource.Layout.progress); alert.SetCancelable(false); alertDialog = alert.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Company); ParseAndReturnAsync(); LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this); View popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null); Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this); alertDialogbuilder.SetView(popup); var userContent = popup.FindViewById <EditText>(Resource.Id.History_description); alertDialogbuilder.SetCancelable(false) .SetPositiveButton("Dodaj", delegate { Toast.MakeText(this, "Wysłano", ToastLength.Long).Show(); } ).SetNegativeButton("Zamknij", delegate { alertDialogbuilder.Dispose(); }); Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create(); if (this.Intent.GetBooleanExtra("Show", true)) { alertDialogAndroid.Show(); } }
/// <summary> /// Open a popup to enter a new recipient /// </summary> private void AddRecipientFromPopupButton_Click(object sender, EventArgs e) { Android.Support.V7.App.AlertDialog addRecipientDialog = null; var addRecipientBuilder = new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.Theme_AppCompat_Light_Dialog); var view = LayoutInflater.Inflate(Resource.Drawable.AddRecipient, null); addRecipientBuilder.SetTitle(Resource.String.alertSOS_popupTitle); addRecipientBuilder.SetPositiveButton(Resource.String.alertSOS_popupPositive, new EventHandler <DialogClickEventArgs>((o, ev) => { })); addRecipientBuilder.SetNegativeButton(Resource.String.alertSOS_popupNegative, new EventHandler <DialogClickEventArgs>((o, ev) => { addRecipientDialog.Dismiss(); })); addRecipientBuilder.SetView(view); addRecipientDialog = addRecipientBuilder.Create(); addRecipientDialog.ShowEvent += (ee, oo) => { var button = addRecipientDialog.GetButton((int)Android.Content.DialogButtonType.Positive); button.Click += (eee, ooo) => { var displayNameEditText = view.FindViewById <EditText>(Resource.Id.addRecipient_contact); var emailEditText = view.FindViewById <EditText>(Resource.Id.addRecipient_email); // empty display name if (string.IsNullOrEmpty(displayNameEditText.Text)) { displayNameEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmptyField); } // empty email else if (string.IsNullOrEmpty(emailEditText.Text)) { emailEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmptyField); } // invalide email else if (!Android.Util.Patterns.EmailAddress.Matcher(emailEditText.Text).Matches()) { emailEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmail); } // add the contact else { displayNameEditText.Error = null; emailEditText.Error = null; App.Locator.Alert.LsRecipients.Add(new AlertRecipientDTO { DisplayName = displayNameEditText.Text, Email = emailEditText.Text }); _selectedContact = new Contact { DisplayName = displayNameEditText.Text, Email = emailEditText.Text }; AlertRecipientLayout.AddChild(_selectedContact); addRecipientDialog.Dismiss(); } }; }; addRecipientDialog.Show(); }
private void AppearDateDialog() { DatePickerDialog datePickerDialog = new DatePickerDialog(this); Android.Support.V7.App.AlertDialog datePickerAlertDialog = null; Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this) .SetTitle("Invalid Date") .SetMessage("Too early to create an account. Please select an earlier date under 30 days.") .SetPositiveButton("Ok", (object s, Android.Content.DialogClickEventArgs dialogClickEventArgs) => { datePickerAlertDialog.Show(); }); datePickerAlertDialog = builder.Create(); datePickerDialog.DateSet += (s, e) => { if (e.Date > DateTime.Now.AddDays(30)) { datePickerAlertDialog.Show(); } else { ViewModel.ServiceStartDate = e.Date; DateButton.Text = e.Date.ToShortDateString(); } }; datePickerDialog.Show(); }
public static void ShowAlertDialog(Context context, string alertMessage) { Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(context); builder.SetMessage(alertMessage); builder.SetNegativeButton("Ok", Cancel_Action); Android.Support.V7.App.AlertDialog dialog = builder.Create(); dialog.Show(); }
public void CloseDialog() { if (alertDialog != null) { alertDialog.Dismiss(); alertDialog = null; alertBuilder = null; } }
/// <summary> /// Install handlers for the Ok button when the dialogue is displayed /// </summary> public override void OnResume() { base.OnResume(); AlertDialog alert = ( AlertDialog )Dialog; // Install a handler for the Ok button that performs the validation and playlist creation alert.GetButton(( int )DialogButtonType.Positive).Click += (sender, args) => reporter?.Invoke(libraryName.Text, this); }
/// <summary> /// Enable or disable the OK button at start up and after a rotation /// </summary> public override void OnResume() { base.OnResume(); // If a library has not been selected yet then keep the OK button disabled AlertDialog alert = ( AlertDialog )Dialog; alert.GetButton(( int )DialogButtonType.Positive).Enabled = (alert.ListView.CheckedItemPosition >= 0); }
void CloseProgressDialogue() { if (alert != null) { alertDialog.Dismiss(); alertDialog = null; alert = null; } }
private void TrainingTypeLayout_Click(object sender, EventArgs e) { TrainingType[] trainingTypes = Enum.GetValues(typeof(TrainingType)) as TrainingType[]; Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetTitle(Resources.GetString(Resource.String.training_type_select_type_name)); builder.SetItems( trainingTypes.Select(type => MapTrainingTypeToNameIdAndImageSourceId(type).Item1).ToArray(), new EventHandler <DialogClickEventArgs>((senderr, ee) => ChangeTrainingType(trainingTypes[ee.Which]))); Android.Support.V7.App.AlertDialog alert = builder.Create(); alert.Show(); }
private void AddUser_ClickConfig(View view) { newUserName = view.FindViewById <EditText>(Resource.Id.userNew); acceptBtn = view.FindViewById <Button>(Resource.Id.acceptButton); alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialogBuilder.SetView(view); alertDialogAndroid = alertDialogBuilder.Create(); alertDialogAndroid.Show(); }
private void ShowMotorConfigurationDialog(int joystickId, int joystickAxis) { // Build and display the motor configuration dialog AlertDialog motorConfigurationDialog = null; AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AlertDialogStyle); builder.SetSingleChoiceItems(GetMotorList(), GetRelatedJoystickConfiguration(joystickId).MotorIndexes[joystickAxis], delegate(object sender, DialogClickEventArgs args) { // When one motor was clicked we set it and display the next dialog SetMotorIndex(joystickId, args.Which, joystickAxis); // ReSharper disable once AccessToModifiedClosure motorConfigurationDialog?.Dismiss(); // If configured the first joystick axis we have to configure the second. // This can be done better but it works :) if (joystickAxis == 0) { ShowMotorConfigurationDialog(joystickId, ++joystickAxis); } }); builder.SetPositiveButton(Resource.String.ControlInterfaceActivity_configureJoystickMotor1DialogPositive, delegate { // ReSharper disable once AccessToModifiedClosure motorConfigurationDialog?.Dismiss(); // If configured the first joystick axis we have to configure the second. if (joystickAxis == 0) { ShowMotorConfigurationDialog(joystickId, ++joystickAxis); } }); if (joystickAxis == 0) { builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickMotor1DialogTitle); } else if (joystickAxis == 1) { builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickMotor2DialogTitle); } builder.SetCancelable(false); motorConfigurationDialog = builder.Create(); motorConfigurationDialog.Show(); }
/// <summary> /// Install handlers for the Ok button when the dialogue is displayed /// </summary> public override void OnResume() { base.OnResume(); AlertDialog alert = ( AlertDialog )Dialog; // Install a handler for the Ok button that performs the validation and playlist creation alert.GetButton(( int )DialogButtonType.Positive).Click += (sender, args) => { reporter?.Invoke(playListName.Text, this, allowAlbumPlaylistCreationChoice ? albumCheckbox.Checked : false); }; }
public static void HideProgress() { CrossCurrentActivity.Current.Activity.RunOnUiThread(() => { if (progressDialog != null) { progressDialog.Hide(); progressDialog = null; } }); }
private void AccBtn_ClickConfig(View vieww) { AccBtn = vieww.FindViewById <Button>(Resource.Id.AccButton); OKBtn = vieww.FindViewById <Button>(Resource.Id.OkButton); alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialogBuilder.SetView(vieww); alertDialogAndroid = alertDialogBuilder.Create(); alertDialogAndroid.Show(); OKBtn.Enabled = false; }
private void UsersList_ItemClickConfig(View view) { actualUsername = view.FindViewById <TextView>(Resource.Id.actualUserName); editBtn = view.FindViewById <ImageButton>(Resource.Id.editButton); microphoneBtn = view.FindViewById <ImageButton>(Resource.Id.microphoneButton); deleteBtn = view.FindViewById <ImageButton>(Resource.Id.deleteButton); alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialogBuilder.SetView(view); alertDialogAndroid = alertDialogBuilder.Create(); alertDialogAndroid.Show(); }
private void CreateAccount() { var results = AccountValidator.Validate(ViewModel); if (!results.IsValid) { Android.Support.V7.App.AlertDialog alertDialog = null; Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this) .SetTitle("Invalid Model") .SetMessage("- " + string.Join(" \n -", results.Errors.Select(x => x.ErrorMessage).ToList())) .SetPositiveButton("Ok", (object s, Android.Content.DialogClickEventArgs dialogClickEventArgs) => { alertDialog.Hide(); }); alertDialog = builder.Create(); alertDialog.Show(); } else { try { var db = new SQLiteConnection(DBPath); var insert = db.Insert(new Account() { Password = ViewModel.Password, UserName = ViewModel.UserName, FirstName = ViewModel.FirstName, LastName = ViewModel.LastName, PhoneNumber = ViewModel.PhoneNumber, ServiceDate = ViewModel.ServiceStartDate.Value }); if (insert == 1) { var intent = new Intent(this, typeof(ConfirmationActivity)); StartActivity(intent); } else { //TODO: Let the user know the database wasn't updated } } catch (Exception ex) { //TODO: Let the user know something went wrong } } }
private void Delete_ClickConfig(View view, string txt) { newUserName = view.FindViewById <EditText>(Resource.Id.userNew); AccBtn = view.FindViewById <Button>(Resource.Id.AccButton); OKBtn = view.FindViewById <Button>(Resource.Id.OkButton); TextView text = view.FindViewById <TextView>(Resource.Id.justTextAdd1); text.Text = txt; alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialogBuilder.SetView(view); alertDialogAndroid = alertDialogBuilder.Create(); alertDialogAndroid.Show(); }
public static void ShowProgress() { CrossCurrentActivity.Current.Activity.RunOnUiThread(() => { var builder = new Android.Support.V7.App.AlertDialog.Builder(CrossCurrentActivity.Current.Activity); var dialogView = CrossCurrentActivity.Current.Activity.LayoutInflater.Inflate(Resource.Layout.progressDialog, null); builder.SetView(dialogView); progressDialog = builder.Show(); progressDialog.SetCancelable(false); progressDialog.Window.SetLayout(Utils.ConvertDpToPixels(200), LayoutParams.WrapContent); var progressText = dialogView.FindViewById <TextView>(Resource.Id.progressText); progressText.Text = "cargando"; }); }
async void TakePhoto(object sender, System.EventArgs e) { string dpPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ScoutingApp.db3"); var db = new SQLiteConnection(dpPath); db.CreateTable <ImageTable>(); ImageTable tbl = new ImageTable(); await CrossMedia.Current.Initialize(); var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions { PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small, CompressionQuality = 40, Name = "highlanders.jpg", Directory = "sample" }); if (file == null) { return; } byte[] imageArray = System.IO.File.ReadAllBytes(file.Path); tbl.Image = imageArray; db.Insert(tbl); LayoutInflater layoutInflater = LayoutInflater.From(this); View view = layoutInflater.Inflate(Resource.Layout.photo_alert, null); Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this); alertbuilder.SetView(view); var userdata = view.FindViewById <EditText>(Resource.Id.edittextT); alertbuilder.SetCancelable(false).SetPositiveButton("Submit", delegate { int numberT; Int32.TryParse(userdata.Text, out numberT); tbl.Team = numberT; db.Insert(tbl); }); Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create(); dialog.Show(); }
public void DisplayResponse(string subject, string message) { //TODO KUNIN MO UNG NASA ADMINPENDINGVIEW.CS // AlertDialog.Builder builder = new AlertDialog.Builder(this.Activity); // builder.SetCustomTitle(dialogTitleTextView); // builder.SetMessage(Resource.String.pending_confirm_msg); AlertDialog.Builder builder = new AlertDialog.Builder(this.Context); builder.SetTitle(subject); builder.SetMessage(message); builder.SetPositiveButton("OK", AlertDialogOkClicked); alertDialog = builder.Create(); alertDialog.Show(); Logger.Log(subject + "\n" + message); }
public void OnClick(View itemView, int position) { // Toast.MakeText(itemView.Context,foods[position].name,ToastLength.Long).Show(); View dialogView = LayoutInflater.From(itemView.Context).Inflate(Resource.Layout.userInputNumberDialog, null); Android.Support.V7.App.AlertDialog.Builder alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(itemView.Context); TextView dialog_food_name = dialogView.FindViewById <TextView>(Resource.Id.dialog_food_name); dialog_food_name.Text = foods[position].name; alertDialogBuilder.SetView(dialogView); string serve = dialogView.FindViewById <EditText>(Resource.Id.serveNum).Text; alertDialogBuilder.SetCancelable(false).SetPositiveButton("Confirm", delegate { EditText txt_serve_num = dialogView.FindViewById <EditText>(Resource.Id.serveNum); Food food = foods[position]; if (string.IsNullOrEmpty(txt_serve_num.Text)) { txt_serve_num.Error = "Required"; } else { Order order = new Order(food.name, food.price, Int32.Parse(txt_serve_num.Text)); orders.Add(order); // save file to local var localOrders = Application.Context.GetSharedPreferences("MyOrders", FileCreationMode.Private); var orderEdit = localOrders.Edit(); var json = JsonConvert.SerializeObject(orders); orderEdit.PutString("orders", json); orderEdit.Commit(); Toast.MakeText(itemView.Context, "Food added", ToastLength.Long).Show(); } }) .SetNegativeButton("Cancel", delegate { alertDialogBuilder.Dispose(); }); Android.Support.V7.App.AlertDialog alertDialog = alertDialogBuilder.Create(); alertDialog.Show(); }
private void UploadBtn_Click(object sender, EventArgs e) { DatabaseHolder.receiver = ""; BluetoothHolder.bluetoothManage.Write(DatabaseHolder.GETDB); LayoutInflater layoutInflaterr = LayoutInflater.From(this.Activity); var vieww = layoutInflaterr.Inflate(Resource.Layout.UploadDialog, null); uploadBtnOK = vieww.FindViewById <Button>(Resource.Id.UploadButtonOK); alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialogBuilder.SetView(vieww); alertDialogAndroid = alertDialogBuilder.Create(); alertDialogAndroid.Show(); uploadBtnOK.Click += UploadBtnOK_Click; }
protected void showCompletedDialog() { Android.Support.V7.App.AlertDialog.Builder alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder( this); // set title alertDialogBuilder.SetTitle("Hooray"); alertDialogBuilder .SetMessage("We've completed the stepper") .SetCancelable(true) .SetPositiveButton("Yes", delegate { }); // create alert dialog Android.Support.V7.App.AlertDialog alertDialog = alertDialogBuilder.Create(); // show it alertDialog.Show(); }
} // We need a default constructor if the system decides to call on this receiver public override void OnReceive(Context context, Intent intent) { Android.Support.V7.App.AlertDialog assist; switch (ResultCode) { //if we receive an OK status it means that our sms has been sent successfully case Result.Ok: //Make sure that this is the manually initialized from the activity Receiver and not the system initialized one if (Context == null) { break; } //Grab the file to add the sms sent TextsPerDay texts = new TextsPerDay(Context); texts.AddToCount(); //set the timer to 3 hours ahead sentAt = DateTime.Now.AddHours(3); //Notify the user that his request has been successfully sent to 13033 assist = new Android.Support.V7.App.AlertDialog.Builder(Context) .SetTitle(Resource.String.Attention).SetMessage(Context.Resources.GetString(Resource.String.AttentionMessage) + " " + sentAt.ToString("hh:mm")).SetPositiveButton(Resource.String.OK, (object o, DialogClickEventArgs arg) => { //ask the user if he wants to be alerted view = ((Activity)Context).LayoutInflater.Inflate(Resource.Layout.AlertDialog, null); ListView list = view.FindViewById <ListView>(Resource.Id.AlertList); list.Adapter = new ArrayAdapter <string>(Context, Android.Resource.Layout.SimpleListItem1, new string[] { "15 " + Context.Resources.GetString(Resource.String.mins), "30 " + Context.Resources.GetString(Resource.String.mins), "1 " + Context.Resources.GetString(Resource.String.Hour) }); list.ItemClick += List_ItemClick; alertDialog = new Android.Support.V7.App.AlertDialog.Builder(Context).SetTitle(Resource.String.AlertTitle) .SetMessage(Resource.String.AlertMessage).SetView(view) .SetNegativeButton(Resource.String.Abort, (object o, DialogClickEventArgs e) => { }).Show(); }).Show(); break; default: //Make sure that this is the manually initialized from the activity Receiver and not the system initialized one if (Context == null) { break; } //Alert the user that something went wrong assist = new Android.Support.V7.App.AlertDialog.Builder(Context) .SetTitle(Resource.String.Error).SetIcon(Resource.Drawable.Error).SetMessage(Resource.String.SmsFailed).SetPositiveButton(Resource.String.OK, (object o, DialogClickEventArgs arg) => { }).Show(); break; } }
public void ShowProgressDialog() { if (progressDialog == null) { progressDialog = Dialogs.CreateFullScreenIndeterminateProgressDialog(context); } progressDialog.Show(); }