protected void OnDialogClosed(string dialogName, Guid dialogInstanceId) { if (_dialogData != null && dialogInstanceId == _dialogData.DialogInstanceId) { DialogManagerMessaging.SendDialogManagerMessage(_dialogData.DialogHandle, DialogResult.Cancel); _dialogData = null; } }
public Guid ShowDialog(string headerText, string text, DialogType type, bool showCancelButton, DialogButtonType?focusedButton) { Guid dialogHandle = Guid.NewGuid(); ItemsList buttons = new ItemsList(); switch (type) { case DialogType.OkDialog: buttons.Add(CreateButtonListItem(OK_BUTTON_TEXT, dialogHandle, DialogResult.Ok, focusedButton == DialogButtonType.Ok || !showCancelButton)); break; case DialogType.YesNoDialog: buttons.Add(CreateButtonListItem(YES_BUTTON_TEXT, dialogHandle, DialogResult.Yes, focusedButton == DialogButtonType.Yes)); buttons.Add(CreateButtonListItem(NO_BUTTON_TEXT, dialogHandle, DialogResult.No, focusedButton == DialogButtonType.No)); break; default: throw new NotImplementedException(string.Format("DialogManager: DialogType {0} is not implemented yet", type)); } if (showCancelButton) { buttons.Add(CreateButtonListItem(CANCEL_BUTTON_TEXT, dialogHandle, DialogResult.Cancel, focusedButton == DialogButtonType.Cancel)); } IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); _dialogData = new GenericDialogData(headerText, text, buttons, dialogHandle); Guid?dialogInstanceId = screenManager.ShowDialog(GENERIC_DIALOG_SCREEN, OnDialogClosed); if (!dialogInstanceId.HasValue) { throw new InvalidDataException("Generic dialog could not be shown"); } _dialogData.DialogInstanceId = dialogInstanceId.Value; return(dialogHandle); }
public Guid ShowDialog(string headerText, string text, DialogType type, bool showCancelButton, DialogButtonType? focusedButton) { Guid dialogHandle = Guid.NewGuid(); ItemsList buttons = new ItemsList(); switch (type) { case DialogType.OkDialog: buttons.Add(CreateButtonListItem(OK_BUTTON_TEXT, dialogHandle, DialogResult.Ok, focusedButton == DialogButtonType.Ok || !showCancelButton)); break; case DialogType.YesNoDialog: buttons.Add(CreateButtonListItem(YES_BUTTON_TEXT, dialogHandle, DialogResult.Yes, focusedButton == DialogButtonType.Yes)); buttons.Add(CreateButtonListItem(NO_BUTTON_TEXT, dialogHandle, DialogResult.No, focusedButton == DialogButtonType.No)); break; default: throw new NotImplementedException(string.Format("DialogManager: DialogType {0} is not implemented yet", type)); } if (showCancelButton) buttons.Add(CreateButtonListItem(CANCEL_BUTTON_TEXT, dialogHandle, DialogResult.Cancel, focusedButton == DialogButtonType.Cancel)); IScreenManager screenManager = ServiceRegistration.Get<IScreenManager>(); _dialogData = new GenericDialogData(headerText, text, buttons, dialogHandle); Guid? dialogInstanceId = screenManager.ShowDialog(GENERIC_DIALOG_SCREEN, OnDialogClosed); if (!dialogInstanceId.HasValue) throw new InvalidDataException("Generic dialog could not be shown"); _dialogData.DialogInstanceId = dialogInstanceId.Value; return dialogHandle; }
protected void Cleanup() { _dialogData = null; }