private bool?ShowDialog(ModalDialog dialog) { DialogOpened?.Invoke(this, EventArgs.Empty); dialog.ShowDialog(); DialogClosed?.Invoke(this, EventArgs.Empty); return(dialog.Result); }
public MainAppForm() { Text = "MainAppForm"; Controls.Add(new Button { Text = "Show ModalDialog", AutoSize = true, Location = new Point(10, 10) }); Controls[0].Click += (s, e) => { using (ModalDialog dlg = new ModalDialog()) dlg.ShowDialog(this); }; }
public static void ShowServerErrors(InfoCore[] errorInfos, System.Web.UI.Page page) { if (errorInfos != null && errorInfos.Length > 0) { Dictionary <string, InfoCore> dictionary = new Dictionary <string, InfoCore>(); Array.ForEach <InfoCore>(errorInfos, delegate(InfoCore x) { if (!dictionary.ContainsKey(x.Message)) { dictionary.Add(x.Message, x); } }); ModalDialog current = ModalDialog.GetCurrent(page); current.ShowDialog(dictionary.Values.ToArray <InfoCore>()); } }
public void Init(Ioctls ioctls, Core core, Runtime runtime) { /** * Shows a dialog widget. * \param _dialogHandle The handle of the dialog that will be shown. * * \returns Any of the following result codes: * - #MAW_RES_OK if the child could be removed from the parent. * - #MAW_RES_INVALID_HANDLE if the handle was invalid. * - #MAW_RES_ERROR otherwise. */ ioctls.maWidgetModalDialogShow = delegate(int _dialogHandle) { if (!isHandleValid(runtime, _dialogHandle)) { return(MoSync.Constants.MAW_RES_INVALID_HANDLE); } MoSync.Util.RunActionOnMainThreadSync(() => { ModalDialog modalDialog = ((ModalDialog)runtime.GetModule <NativeUIModule>().GetWidget(_dialogHandle)); if (modalDialog.Visible.Equals("false")) { // show the dialog modalDialog.ShowDialog(true); // set the dialog visibility modalDialog.Visible = "true"; } }); return(MoSync.Constants.MAW_RES_OK); }; /** * Hides/Dismisses a currently displayed dialog. * \param _dialogHandle The handle of the dialog that will be hidden. * * \returns Any of the following result codes: * - #MAW_RES_OK if the child could be removed from the parent. * - #MAW_RES_INVALID_HANDLE if the handle was invalid. * - #MAW_RES_ERROR otherwise. */ ioctls.maWidgetModalDialogHide = delegate(int _dialogHandle) { if (!isHandleValid(runtime, _dialogHandle)) { return(MoSync.Constants.MAW_RES_INVALID_HANDLE); } MoSync.Util.RunActionOnMainThreadSync(() => { ModalDialog modalDialog = ((ModalDialog)runtime.GetModule <NativeUIModule>().GetWidget(_dialogHandle)); if (modalDialog.Visible.Equals("true")) { // hide the dialog modalDialog.ShowDialog(false); // set the dialog visibility modalDialog.Visible = "false"; } }); return(MoSync.Constants.MAW_RES_OK); }; }
public static void ShowServerError(string errorString, string detailString, System.Web.UI.Page page) { ModalDialog current = ModalDialog.GetCurrent(page); current.ShowDialog(ClientStrings.Error, errorString, string.Empty, ModalDialogType.Error); }