void undo() { bool undo = true; if (!DialogUtils.Confirm(this, "Undo Change?")) { undo = false; } if (undo) { // use the init call to repopulate the screen with original settings initWidgetSettings(); } }
private async void ResetButtonToggled(object sender, EventArgs e) { ShowSpinner(true); await DialogUtils.DisplayDialogAsync(this, new DialogViewModel() { Title = ConsentViewModel.CONSENT_REMOVE_TITLE, Body = ConsentViewModel.CONSENT_REMOVE_MESSAGE, OkBtnTxt = ConsentViewModel.CONSENT_OK_BUTTON_TEXT, CancelbtnTxt = ConsentViewModel.CONSENT_NO_BUTTON_TEXT }, PerformWithdrawAsync, (() => ShowSpinner(false))); }
/// <summary> /// User wants to cancel out of the dialog box /// </summary> private void cancel() { Log.Debug(); bool quit = !_isDirty || DialogUtils.Confirm(R.GetString("CancelAndQuit")); if (quit) { Invoke(new MethodInvoker(delegate { Cancel = true; Windows.CloseForm(this); })); } }
private async void RegistrationLayoutButton_Click(object sender, EventArgs e) { if (!await IsRunning()) { await DialogUtils.DisplayDialogAsync( this, _viewModel.ReportingIllDialogViewModel); return; } Intent intent = new Intent(this, typeof(InformationAndConsentActivity)); StartActivity(intent); }
private void Adapter_ItemClick(object sender, RecyclerClickEventArgs e) { if (EngineService.EngineInstance.ContactListViewModel.CandiateList != null && CrossConnectivity.Current.IsConnected) { var otherModel = EngineService.EngineInstance.ContactListViewModel.CandiateList[e.Position]; var AddReqeust = new ContactAddRequest() { TOKEN = MyApplication.Me.TOKEN, MY_ID = $"{MyApplication.Me.USERID}", OTHER_ID = $"{otherModel.USERID}" }; EngineService.EngineInstance.ContactListViewModel.AddContactListItemCommand.Execute(AddReqeust); } else { DialogUtils.ShowOKDialog(this, @"warning", @"No Internet Connection"); } }
void SwipeRefresherHandle(object sender, EventArgs e) { if (Plugin.Connectivity.CrossConnectivity.Current.IsConnected) { GetPrivateChatEntryRequest model = new GetPrivateChatEntryRequest() { MY_USER_ID = ParentActivity.MyApplication.Me.USERID, TOKEN = ParentActivity.MyApplication.Me.TOKEN }; ChatListViewModel.LoadAllChatEntryItemCommand.Execute(model); } else { DialogUtils.ShowOKDialog(ParentActivity, @"Warning", @"No Internet Connection"); } }
void StatusAdapter_ItemClick(object sender, RecyclerClickEventArgs e) { if (Plugin.Connectivity.CrossConnectivity.Current.IsConnected) { string TitleValue = TitleArray[e.Position]; var request = new GetProfileRequest() { TOKEN = ParentActivity.MyApplication.Me.TOKEN, USERID = Convert.ToString(TitleValue) }; ThisProfileViewModel.CommandUpdateStatusTitle.Execute(request); } else { DialogUtils.ShowOKDialog(ParentActivity, @"Warning", @"No Internet Connection"); } }
private async void MfiReloadSongs_Click(object sender, RoutedEventArgs e) { try { viewModel.IsUpdatingPlaylists = true; await UwpUtils.GetDataContext <ISourcePlaylist>(sender).Reload(); } catch (Exception exc) { await DialogUtils.ShowSafeAsync(exc.Message, "Reload songs error"); } finally { viewModel.IsUpdatingPlaylists = false; } }
private async void Connect() { if (!ValidateConnect()) { return; } try { await _tcpClient.ConnectAsync(IpAddress, Port.Value); } catch (Exception ex) { DialogUtils.ShowErrorDialog(ex.Message); } }
private static ColorStateList CreateEditTextColorStateList(Context context, Color color) { int[][] states = new int[3][]; int[] colors = new int[3]; int i = 0; states[i] = new int[] { -Android.Resource.Attribute.StateEnabled }; colors[i] = DialogUtils.ResolveColor(context, Resource.Attribute.colorControlNormal); i++; states[i] = new int[] { -Android.Resource.Attribute.StatePressed, -Android.Resource.Attribute.StateFocused }; colors[i] = DialogUtils.ResolveColor(context, Resource.Attribute.colorControlNormal); i++; states[i] = new int[] { }; colors[i] = color; return(new ColorStateList(states, colors)); }
private void Start() { if (!ValidateStart()) { return; } try { _udpClientServer.Start(SelectedInterface.Address, ListenPort.Value); } catch (Exception ex) { DialogUtils.ShowErrorDialog(ex.Message); } }
/// <summary> /// User is done. Confirm, perform validation and check /// that everything is OK and then quit. /// </summary> private void finish() { var quit = true; if (_isDirty || hasTextChanged()) { quit = DialogUtils.Confirm(R.GetString("SaveAndQuit")); } if (quit) { Phrase.Text = Windows.GetText(textBoxPhrase); Cancel = false; Windows.CloseForm(this); } }
/// <summary> /// User wants to quit. Confirms and exits /// </summary> private void onBack() { if (_isDirty) { if (DialogUtils.Confirm(this, R.GetString("SaveSettings"))) { _previewScreenInterface.SaveSettings(); } else { Context.AppWindowPosition = _initialWindowPosition; } } Windows.CloseForm(this); }
public static void showDialog(BuildContext context, bool barrierDismissible = true, WidgetBuilder builder = null) { DialogUtils.showGeneralDialog( context: context, pageBuilder: (BuildContext buildContext, Animation <double> animation, Animation <double> secondaryAnimation) => { return(builder(buildContext)); }, barrierDismissible: barrierDismissible, barrierLabel: "", barrierColor: new Color(0x8A000000), transitionDuration: TimeSpan.FromMilliseconds(150), transitionBuilder: _buildMaterialDialogTransitions ); }
protected override void PreShowDialog(Form dialog) { base.PreShowDialog(dialog); // Operations that change dialog size DialogUtils.SetFont(dialog, m_ControlsFont); m_Trans.Translate(dialog); // Centre dialogs over our client area dialog.StartPosition = FormStartPosition.Manual; Rectangle parentPos = RectangleToScreen(Bounds); Point parentCentre = new Point((parentPos.Right + parentPos.Left) / 2, (parentPos.Bottom + parentPos.Top) / 2); int dialogLeft = (parentCentre.X - (dialog.Width / 2)); int dialogTop = (parentCentre.Y - (dialog.Height / 2)); // but keep within screen Rectangle screenArea = Screen.FromControl(this).WorkingArea; dialogLeft = Math.Max(screenArea.Left, dialogLeft); dialogLeft = Math.Min(screenArea.Right - dialog.Width, dialogLeft); dialogTop = Math.Max(screenArea.Top, dialogTop); dialogTop = Math.Min(screenArea.Bottom - dialog.Height, dialogTop); dialog.Location = new Point(dialogLeft, dialogTop); // Add icon for identification dialog.ShowIcon = true; dialog.Icon = HTMLContentControlCore.html; // Per dialog customisations if (dialog is MSDN.Html.Editor.EnterHrefForm) { var urlDialog = (dialog as MSDN.Html.Editor.EnterHrefForm); urlDialog.EnforceHrefTarget(MSDN.Html.Editor.NavigateActionOption.Default); urlDialog.LastBrowsedFolder = LastBrowsedFileFolder; } else if (dialog is MSDN.Html.Editor.EnterImageForm) { var imageDialog = (dialog as MSDN.Html.Editor.EnterImageForm); imageDialog.LastBrowsedFolder = LastBrowsedImageFolder; } }
async void AttachImageChooseHandler(object sender, EventArgs e) { RemoveAttachToolBoxFragment(); try { var PermStorage = await CheckNecessaryPermissions(Permission.Storage); if (PermStorage) { if (!CrossMedia.Current.IsPickPhotoSupported) { DialogUtils.ShowOKDialog(this, @"Warning", @"No gallery available."); return; } if (ViewModel.PhotoFileToBeSent == null) { ViewModel.PhotoFileToBeSent = new List <MediaFile>(); } var mediaFile = await CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions { PhotoSize = PhotoSize.Medium }); if (mediaFile != null) { ViewModel.PhotoFileToBeSent.Add(mediaFile); var model = new AddGroupChatHistoryItemRequest() { SENDER_ID = GetMyUserId(), SENDER_NAME = GetMyUserName(), GROUP_ID = ViewModel.CurrentlyOpenDTO.GROUP_ID, MSG_TYPE = GlobalConstants.CHAT_HISTORY_ITEM_IMAGE, MSG_CONTENT = "" }; ViewModel.SendGroupMessageCommand.Execute(model); } } else { ViewModel.PhotoFileToBeSent = null; } } catch (Exception e1) { Console.WriteLine(e1.ToString()); } }
public override void OnRunCommand(String command, object commandArg, ref bool handled) { handled = true; Log.Debug(command); switch (command) { case "TalkWindowZoomIn": Context.AppTalkWindowManager.ZoomIn(); break; case "TalkWindowZoomOut": Context.AppTalkWindowManager.ZoomOut(); break; case "TalkWindowZoomDefault": Context.AppTalkWindowManager.ZoomDefault(); break; case "TalkWindowSaveZoom": if (DialogUtils.ConfirmScanner("Save Font Setting?")) { Context.AppTalkWindowManager.SaveFont(); } break; case "ClearTalkWindowText": if (Context.AppTalkWindowManager.IsTalkWindowActive) { String text = Context.AppTalkWindowManager.TalkWindowText; if (!String.IsNullOrEmpty(text)) { if (DialogUtils.ConfirmScanner("Clear Talk Window?")) { Context.AppTalkWindowManager.Clear(); } } } break; default: base.OnRunCommand(command, commandArg, ref handled); break; } }
void add() { Boolean isCompleted = false; String originalTerm = String.Empty; String replacementTerm = String.Empty; do { Invoke(new MethodInvoker(delegate() { _hideForm = true; AlternatePronunciationEditorForm dlg = new AlternatePronunciationEditorForm(originalTerm, replacementTerm); Context.AppScreenManager.ShowDialog(this, dlg); if (dlg._hasTerm == false) { isCompleted = true; return; // user must have cancelled } if (String.IsNullOrEmpty(dlg._originalTerm)) { isCompleted = true; return; // this should have already been validated in the editor dialog } Log.Debug("originalterm=" + dlg._originalTerm + " replacementterm=" + dlg._replacementTerm); originalTerm = dlg._originalTerm; replacementTerm = dlg._replacementTerm; // check if pronunciation already exists if (Context.AppPronunications.Exists(dlg._originalTerm)) { // prompt user that pronunciation already exists! DialogUtils.ShowTimedDialog(this, "Error", "Pronunciation for '" + dlg._originalTerm + "' already exists"); } else { AddPronunciation(listViewAP, dlg._originalTerm, dlg._replacementTerm); isCompleted = true; ListViewChanged(); return; } })); } while (!isCompleted); }
/// <summary> /// Invoked to run a command /// </summary> /// <param name="command">The command to execute</param> /// <param name="commandArg">Optional arguments for the command</param> /// <param name="handled">set this to true if handled</param> public override void OnRunCommand(String command, object commandArg, ref bool handled) { handled = true; switch (command) { case "SwitchAppWindow": DialogUtils.ShowTaskSwitcher(WordPadProcessName); break; case "WordPadLectureManager": if (TextControlAgent != null) { String text = TextControlAgent.GetText(); if (String.IsNullOrEmpty(text.Trim())) { DialogUtils.ShowTimedDialog(PanelManager.Instance.GetCurrentPanel() as Form, R.GetString("LectureManager"), R.GetString("DocumentIsEmpty")); break; } if (DialogUtils.ConfirmScanner(R.GetString("LoadThisDocIntoLM"))) { #pragma warning disable 4014 launchLectureManager(); #pragma warning restore 4014 } } break; case "CmdSnapMaxDockWindowToggle": if (snapWindowDockAlphabetScanner) { Windows.ToggleForegroundWindowMaximizeDock(Context.AppPanelManager.GetCurrentForm() as Form, Context.AppWindowPosition, true); } else { Windows.ToggleSnapForegroundWindow(Context.AppWindowPosition, Common.AppPreferences.WindowSnapSizePercent); } break; default: base.OnRunCommand(command, commandArg, ref handled); break; } }
/// <summary> /// Use wants to cancel out /// </summary> private void onCancel() { bool cancel = true; if (_isDirty) { if (!DialogUtils.Confirm(this, Resources.ChangesNotSavedNquitAnyway)) { cancel = false; } } if (cancel) { Windows.CloseForm(this); } }
//Associate the parameters //NOT IN USE IN THIS VERSION private string AssociateParameters(FamilyParameter newParameter) { using (Transaction tw = new Transaction(doc, "Wire parameters")) { tw.Start(); try { var nestedParameter = GetNestedParameter(newParameter.Definition.Name); //Finds the parameter in the nested family SetDocumentParameter(newParameter, nestedParameter); //Set the value first, we don't want to lose it doc.FamilyManager.AssociateElementParameterToFamilyParameter(nestedParameter, newParameter); //And associates it to the existing family parameter. The second parameter belongs to the Main family return($"'{newParameter.Definition.Name}' was processed successfully.{Environment.NewLine}"); //Helps to populates the SuccessMessage } catch (Exception ex) { DialogUtils.Alert("Error", ex.Message); return(null); } tw.Commit(); } }
public static IPromise <object> showCupertinoDialog( BuildContext context, WidgetBuilder builder ) { D.assert(builder != null); return(DialogUtils.showGeneralDialog( context: context, barrierDismissible: false, barrierColor: _kModalBarrierColor, transitionDuration: new TimeSpan(0, 0, 0, 0, 250), pageBuilder: (BuildContext _context, Animation <float> animation, Animation <float> secondaryAnimation) => { return builder(_context); }, transitionBuilder: _buildCupertinoDialogTransitions )); }
/// <summary> /// Confirms whether to quit and close the form /// </summary> private void quit() { bool quit = true; if (_isDirty) { if (!DialogUtils.Confirm(this, R.GetString("ChangesNotSavedQuit"))) { quit = false; } } if (quit) { Windows.CloseForm(this); } }
/// <summary> /// Use wants to cancel out /// </summary> private void onCancel() { bool cancel = true; if (isDirty) { if (!DialogUtils.Confirm(this, "Changes not saved.\nQuit anyway?")) { cancel = false; } } if (cancel) { Windows.CloseForm(this); } }
/// <summary> /// Executes the command /// </summary> /// <param name="handled">set to true if the command was handled</param> /// <returns>true on success</returns> public override bool Execute(ref bool handled) { handled = true; Form form = Dispatcher.Scanner.Form; if (DialogUtils.ConfirmScanner(form as IPanel, "Launch Settings Menu?")) { Form settingsMenuForm = Context.AppPanelManager.CreatePanel("SettingsMenu"); if (settingsMenuForm != null) { Context.AppPanelManager.ShowDialog(settingsMenuForm as IPanel); } } return(true); }
/// <summary> /// Invoked when there is a request to run a command. This /// could as a result of the user activating a button on the /// scanner and there is a command associated with the button /// </summary> /// <param name="command">command to run</param> /// <param name="commandArg">any optional arguments</param> /// <param name="handled">was this handled?</param> public override void OnRunCommand(String command, object commandArg, ref bool handled) { handled = true; switch (command) { case "clearText": _form.ClearFilter(); break; case "CancelEditDelAbbreviation": closeEditDeleteConfirmScanner(); break; case "EditAbbreviation": closeEditDeleteConfirmScanner(); if (_abbreviationSelected != null) { editAbbreviation(_abbreviationSelected); } break; case "DeleteAbbreviation": if (_abbreviationSelected != null) { if (DialogUtils.ConfirmScanner("Delete " + _abbreviationSelected.Mnemonic + "?")) { deleteAbbreviation(_abbreviationSelected); _abbreviationSelected = null; closeEditDeleteConfirmScanner(); } } break; default: Log.Debug(command); if (_form != null) { _form.OnRunCommand(command, ref handled); } break; } }
/// <summary> /// Confirm with the user and quit the dialog /// </summary> private void quit() { bool quit = true; if (_isDirty) { if (!DialogUtils.Confirm(this, "Changes not saved. Quit?")) { quit = false; } } if (quit) { Windows.CloseForm(this); } }
private bool ValidateStart() { string error = null; if (HasError(nameof(ListenPort))) { error = GetError(nameof(ListenPort)); } if (error != null) { DialogUtils.ShowErrorDialog(error); return(false); } return(true); }
private void miDiscoInfo_Click(object sender, RoutedEventArgs e) { if (client != null && client.IsConnected) { int id = client.SendDiscoInfoRequest(); Signals.Register(id, (par) => { if (par.Type == XmppIqType.Result) { ViewXStream(par.xStream, "server disco#info"); } else if (par.Type == XmppIqType.Error) { DialogUtils.ShowWarning(this, string.Format("There was an error recovering disco#info from the server. {0} {0} {1}", Environment.NewLine, ParseStreamError(par.xStream))); } }); } }
void MAdapter_ContactItemClick(object sender, RecyclerClickEventArgs e) { //update contact list with block menu if (CrossConnectivity.Current.IsConnected) { var dataProvider = ThisContactListViewModel.Items.Where(u => u.IS_I_BLOCKED == false).ToList(); var model = new GetProfileRequest() { TOKEN = MyApplication.Me.TOKEN, USERID = Convert.ToString(dataProvider[e.Position].CONTACT_ID) }; ThisContactListViewModel.BlockContactCommand.Execute(model); } else { DialogUtils.ShowOKDialog(this, @"Warning", @"No Internet Connection"); } }