public void ShowAdvancedConfigurationOptions() { try { if (_printerConfig != null) { DicomPrinterAdvancedConfigurationComponent component = new DicomPrinterAdvancedConfigurationComponent(_printerConfig.FilmBox.AutomaticFilmSizeConfiguration); DialogBoxAction action = base.Host.DesktopWindow.ShowDialogBox(new SimpleComponentContainer(component), "Advanced Configuration"); if (action == DialogBoxAction.Ok) { AutomaticFilmSizeConfiguration objB = component.CreateAutomaticFilmSizeConfiguration(); AutomaticFilmSizeConfiguration objA = _printerConfig.FilmBox.AutomaticFilmSizeConfiguration; if (!object.Equals(objA, objB)) { _printerConfig.FilmBox.AutomaticFilmSizeConfiguration = objB; this.Modified = true; } } } } catch (Exception exception) { Platform.Log(Macro.Common.LogLevel.Debug, exception); } }
private bool ValidateMouseToolInitiallyActive(AbstractActionModelTreeLeafAction node, bool initiallyActive) { // if we're just synchronizing the value due to another update action, short the validation request if (_updatingKeyStrokes) { return(true); } // find the mouse button to which this tool is assigned var mouseButton = _mouseButtonMap.FindKey(node.ActionId, XMouseButtons.Left); // check for presence of another initial tool for this button if (initiallyActive && _initialMouseToolsMap.IsAssignedToOther(mouseButton, node.ActionId)) { IList <AbstractActionModelTreeLeafAction> actions = _actionMap[_initialMouseToolsMap[mouseButton]]; if (actions.Count > 0) { string message = string.Format(SR.MessageMouseButtonInitialToolAlreadyAssigned, XMouseButtonsConverter.Format(mouseButton), actions[0].Label); DialogBoxAction result = base.Host.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo); if (result != DialogBoxAction.Yes) { return(false); } } } return(true); }
private bool ValidateMouseToolMouseButton(AbstractActionModelTreeLeafAction node, XMouseButtons mouseButton) { // if we're just synchronizing the value due to another update action, short the validation request if (_updatingKeyStrokes) { return(true); } // check that we're not setting it to none if (mouseButton == XMouseButtons.None) { return(false); } // check for presence of a global tool for this button var defaultMouseButtonCombo = new XMouseButtonCombo(mouseButton, ModifierFlags.None); if (_defaultMouseToolsMap.IsAssigned(defaultMouseButtonCombo)) { IList <AbstractActionModelTreeLeafAction> actions = _actionMap[_defaultMouseToolsMap[defaultMouseButtonCombo]]; if (actions.Count > 0) { string message = string.Format(SR.MessageMouseButtonActiveToolAssignmentConflict, defaultMouseButtonCombo, actions[0].Label); DialogBoxAction result = base.Host.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo); if (result != DialogBoxAction.Yes) { return(false); } } } return(true); }
private void DisplayFullHelper(string title, string body, DialogBoxAction confirmAction, DialogBoxAction cancelAction) { cachedGo.SetActive(true); isDisplaying = true; RecalculateTextBoundsAndUI(); titleTextLabel.text = title; bodyTextLabel.text = body; onConfirmAction = confirmAction; onCancelAction = cancelAction; }
private void ResetPropertyValue(SettingsProperty property) { DialogBoxAction action = this.Host.ShowMessageBox(SR.MessageReset, MessageBoxActions.YesNo); if (action == DialogBoxAction.Yes) { property.Value = property.DefaultValue; _settingsPropertiesTable.Items.NotifyItemUpdated(property); } }
/// <summary> /// Called to dismiss the dialog /// </summary> /// <param name="action"></param> public void Dismiss(DialogBoxAction action) { _result = action; IWebSynchronizationContext context = (SynchronizationContext.Current as IWebSynchronizationContext); if (context != null) { context.BreakModal(); } }
public void CloseAndReset() { if (!isDisplaying) { return; } isDisplaying = false; onConfirmAction = null; onCancelAction = null; }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="buttons"></param> /// <param name="title"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, string title, MessageBoxActions buttons) { if (ApplicationContext.Current != null) { MessageBoxEntityHandler handler = EntityHandler.Create <MessageBoxEntityHandler>(); handler.SetModelObject(this); MessageBox box = handler.GetEntity(); box.Message = message; box.Title = title; switch (buttons) { case MessageBoxActions.Ok: box.Actions = WebMessageBoxActions.Ok; _result = DialogBoxAction.Ok; break; case MessageBoxActions.OkCancel: box.Actions = WebMessageBoxActions.OkCancel; _result = DialogBoxAction.Ok; break; case MessageBoxActions.YesNo: box.Actions = WebMessageBoxActions.YesNo; _result = DialogBoxAction.Yes; break; case MessageBoxActions.YesNoCancel: box.Actions = WebMessageBoxActions.YesNoCancel; _result = DialogBoxAction.Yes; break; } MessageBoxShownEvent @event = new MessageBoxShownEvent { Identifier = box.Identifier, MessageBox = box, SenderId = ApplicationContext.Current.ApplicationId, }; ApplicationContext.Current.FireEvent(@event); IWebSynchronizationContext context = (SynchronizationContext.Current as IWebSynchronizationContext); if (context != null) { context.RunModal(); } return(_result); } return(DialogBoxAction.Ok); }
private void EndDialog(DialogBoxAction action) { // close the form switch (action) { case DialogBoxAction.Cancel: DialogResult = DialogResult.Cancel; break; case DialogBoxAction.Ok: DialogResult = DialogResult.OK; break; } }
private bool ValidateClickActionKeyStroke(AbstractActionModelTreeLeafClickAction node, XKeys keys) { // if we're just synchronizing key strokes due to another key stroke set action, short the validation request if (_updatingKeyStrokes) { return(true); } // if the key stroke is the empty value, it is always allowed if (keys == XKeys.None) { return(true); } // if the key stroke contains only modifiers and no key, it is never allowed if ((keys & XKeys.Modifiers) != 0 && (keys & XKeys.KeyCode) == 0) { return(false); } // if the action is not part of the viewer component then it is handled by the desktop and must be modified if (GetActionsById(_imageViewer.ExportedActions, node.ActionId).Count == 0 && (keys & XKeys.Modifiers) == 0) { return(false); } // if the key stroke is a value reserved by built-in viewer operations, then it cannot be allowed if (_reservedKeystrokes.Contains(keys)) { var message = string.Format(SR.MessageKeyStrokeReserved, XKeysConverter.Format(keys)); Host.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok); return(false); } // check for other assignments to the same key stroke and confirm the action if there are pre-existing assignments if (_keyStrokeMap.IsAssignedToOther(keys, node.ActionId)) { IList <AbstractActionModelTreeLeafAction> actions = _actionMap[_keyStrokeMap[keys]]; if (actions.Count > 0) { string message = string.Format(SR.MessageKeyStrokeAlreadyAssigned, XKeysConverter.Format(keys), actions[0].Label); DialogBoxAction result = base.Host.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo); if (result != DialogBoxAction.Yes) { return(false); } } } return(true); }
private bool ConfirmDeletion() { string message = Context.SelectedStudies.Count == 1 ? SR.MessageConfirmDeleteStudy : String.Format(SR.MessageConfirmDeleteStudies, Context.SelectedStudies.Count); DialogBoxAction action = Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo); if (action == DialogBoxAction.Yes) { return(true); } return(false); }
public void Show() { ColumnPickerComponent component = new ColumnPickerComponent(base.Columns); SimpleComponentContainer container = new SimpleComponentContainer(component); DialogBoxAction action = base.DesktopWindow.ShowDialogBox(container, SR.AddRemoveColumns); if (action == DialogBoxAction.Ok) { base.Columns.Clear(); foreach (StudyFilterColumn.ColumnDefinition column in component.Columns) { base.Columns.Add(column.Create()); } base.RefreshTable(); } }
private void Import() { try { DialogBoxAction action = this.Host.ShowMessageBox("Import settings meta-data defined in locally installed plugins?", MessageBoxActions.OkCancel); if (action == DialogBoxAction.Ok) { DoImport(); } // update groups table FillSettingsGroupTable(); } catch (Exception e) { ExceptionHandler.Report(e, this.Host.DesktopWindow); } }
private bool ValidateDefaultMouseButtons(AbstractActionModelTreeLeafAction node, XMouseButtonCombo defaultMouseButtonCombo) { // if we're just synchronizing the value due to another update action, short the validation request if (_updatingKeyStrokes) { return(true); } // check for presence of another global tool for this button if (_defaultMouseToolsMap.IsAssignedToOther(defaultMouseButtonCombo, node.ActionId)) { IList <AbstractActionModelTreeLeafAction> actions = _actionMap[_defaultMouseToolsMap[defaultMouseButtonCombo]]; if (actions.Count > 0) { string message = string.Format(SR.MessageMouseButtonGlobalToolAlreadyAssigned, defaultMouseButtonCombo, actions[0].Label); DialogBoxAction result = base.Host.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo); if (result != DialogBoxAction.Yes) { return(false); } } } // check for presence of an active tool for this button var unmodifiedMouseButton = defaultMouseButtonCombo.MouseButtons; if (defaultMouseButtonCombo.Modifiers == ModifierFlags.None && _mouseButtonMap[unmodifiedMouseButton].Count > 0) { IList <AbstractActionModelTreeLeafAction> actions = _actionMap[_mouseButtonMap[unmodifiedMouseButton][0]]; if (actions.Count > 0) { string message = string.Format(SR.MessageMouseButtonGlobalToolAssignmentConflict, unmodifiedMouseButton, actions[0].Label); DialogBoxAction result = base.Host.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo); if (result != DialogBoxAction.Yes) { return(false); } } } return(true); }
public void PublishToServer() { AENavigatorComponent aeNavigator = new AENavigatorComponent(); aeNavigator.IsReadOnly = true; aeNavigator.ShowCheckBoxes = false; aeNavigator.ShowLocalDataStoreNode = false; aeNavigator.ShowTitlebar = false; aeNavigator.ShowTools = false; SimpleComponentContainer dialogContainer = new SimpleComponentContainer(aeNavigator); DialogBoxAction code = this.Host.DesktopWindow.ShowDialogBox(dialogContainer, SR.SelectDestination); if (code != DialogBoxAction.Ok) { return; } if (aeNavigator.SelectedServers == null || aeNavigator.SelectedServers.Servers == null || aeNavigator.SelectedServers.Servers.Count == 0) { return; } if (aeNavigator.SelectedServers.Servers.Count < 1) { return; } BackgroundTask task = new BackgroundTask( delegate { foreach (Server destinationAE in aeNavigator.SelectedServers.Servers) { _studyBuilder.Publish(ServerTree.GetClientAETitle(), destinationAE.AETitle, destinationAE.Host, destinationAE.Port); } }, false); ProgressDialog.Show(task, base.Host.DesktopWindow, true, ProgressBarStyle.Marquee); }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="buttons"></param> /// <param name="title"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, string title, MessageBoxActions buttons) { if (ApplicationContext.Current != null) { MessageBoxEntityHandler handler = EntityHandler.Create<MessageBoxEntityHandler>(); handler.SetModelObject(this); MessageBox box = handler.GetEntity(); box.Message = message; box.Title = title; switch (buttons) { case MessageBoxActions.Ok: box.Actions = WebMessageBoxActions.Ok; _result = DialogBoxAction.Ok; break; case MessageBoxActions.OkCancel: box.Actions = WebMessageBoxActions.OkCancel; _result = DialogBoxAction.Ok; break; case MessageBoxActions.YesNo: box.Actions = WebMessageBoxActions.YesNo; _result = DialogBoxAction.Yes; break; case MessageBoxActions.YesNoCancel: box.Actions = WebMessageBoxActions.YesNoCancel; _result = DialogBoxAction.Yes; break; } MessageBoxShownEvent @event = new MessageBoxShownEvent { Identifier = box.Identifier, MessageBox = box, SenderId = ApplicationContext.Current.ApplicationId, }; ApplicationContext.Current.FireEvent(@event); IWebSynchronizationContext context = (SynchronizationContext.Current as IWebSynchronizationContext); if (context != null) context.RunModal(); return _result; } return DialogBoxAction.Ok; }
private void DisplayPurchasePrompt(ShopItem item, DialogBoxAction confirmCallback) { DialogBoxUI.instance.Display("CONFIRM", "Would you like to spend [FFF723]" + item.price + " Frog Points[-] to get [FFF723]" + item.name + "[-]?", confirmCallback, null); }
private bool ConfirmSave() { DialogBoxAction action = this.Host.ShowMessageBox(SR.MessageSaveModified, MessageBoxActions.YesNo); return(action == DialogBoxAction.Yes); }
public void Display(string title, string body, DialogBoxAction confirmAction, DialogBoxAction cancelAction) { confirmButton.gameObject.SetActive(true); ResetButtonLabelsToDefault(); DisplayFullHelper(title, body, confirmAction, cancelAction); }
internal void DelayedClose(DialogBoxAction action) { BeginInvoke(new MethodInvoker(() => EndDialog(action))); }
public void Display(string body, DialogBoxAction confirmAction, DialogBoxAction cancelAction) { Display("ATTENTION", body, confirmAction, cancelAction); }
public void Display(string title, string body, DialogBoxAction closeAction) { confirmButton.gameObject.SetActive(false); ResetButtonLabelsToDefault(); DisplayFullHelper(title, body, null, closeAction); }
/// <summary> /// Constructor. /// </summary> /// <param name="action"></param> /// <param name="filename"></param> public FileDialogResult(DialogBoxAction action, string filename) { _action = action; _filenames = new[]{filename}; }
public void Display(string body, DialogBoxAction closeAction) { Display("ATTENTION", body, closeAction); }
/// <summary> /// Constructor /// </summary> /// <param name="action"></param> /// <param name="filenames"></param> public FileDialogResult(DialogBoxAction action, string[] filenames) { _action = action; _filenames = filenames; }
public void Publish() { if (_sourceInformation.ClipboardItems.Count == 0) { return; } var service = Platform.GetService <IPublishFiles>(); while (!service.CanPublish()) { // ActiveDesktopWindow may be null when the study is opened from Webstation // By the time viewer closes, there is no browser window to display the error if (Application.ActiveDesktopWindow == null) { // Log to file only and return immediately Platform.Log(LogLevel.Error, SR.MessageKeyImagePublishingFailed); return; } else { // TODO CR (Sep 12): convert this to a desktop alert DialogBoxAction result = Application.ActiveDesktopWindow.ShowMessageBox( SR.MessageCannotPublishKeyImagesServersNotRunning, MessageBoxActions.OkCancel); if (result == DialogBoxAction.Cancel) { return; } } } var anyFailed = false; try { CreateKeyObjectDocuments(); var publishers = new Dictionary <string, DicomPublishingHelper>(); // add each KO document to a publisher by study foreach (var koDocument in _keyObjectDocuments) { var publisher = GetValue(publishers, koDocument.DataSet[DicomTags.StudyInstanceUid].ToString()); publisher.Files.Add(koDocument); } // add each PR state to a publisher by study foreach (var presentationFrame in SourceFrames) { var sourceFrame = presentationFrame.Key; var publisher = GetValue(publishers, sourceFrame.StudyInstanceUid); if (presentationFrame.Value != null) { publisher.Files.Add(presentationFrame.Value.DicomFile); } var sopDataSource = sourceFrame.ParentImageSop.DataSource; publisher.OriginServer = ServerDirectory.GetRemoteServersByAETitle(sopDataSource[DicomTags.SourceApplicationEntityTitle].ToString()).FirstOrDefault(); publisher.SourceServer = sopDataSource.Server; } // publish all files now foreach (var publisher in publishers.Values) { if (!publisher.Publish()) { anyFailed = true; } } } catch (Exception e) { anyFailed = true; Platform.Log(LogLevel.Error, e, "An unexpected error occurred while trying to publish key images."); } // TODO CR (Sep 12): convert this to a desktop alert if (anyFailed) { // ActiveDesktopWindow may be null when the study is opened from Webstation // By the time viewer closes, there is no browser window to display the error, so log to file only. if (Application.ActiveDesktopWindow == null) { Platform.Log(LogLevel.Error, SR.MessageKeyImagePublishingFailed); } else { Application.ActiveDesktopWindow.ShowMessageBox(SR.MessageKeyImagePublishingFailed, MessageBoxActions.Ok); } } }
/// <summary> /// Called to dismiss the dialog /// </summary> /// <param name="action"></param> public void Dismiss(DialogBoxAction action) { _result = action; IWebSynchronizationContext context = (SynchronizationContext.Current as IWebSynchronizationContext); if (context != null) context.BreakModal(); }
/// <summary> /// Constructor. /// </summary> /// <param name="action"></param> /// <param name="filename"></param> public FileDialogResult(DialogBoxAction action, string filename) { _action = action; _filenames = new[] { filename }; }
public void Publish() { if (_sourceInformation.ClipboardItems.Count == 0) { return; } while (!WorkItemActivityMonitor.IsRunning) { // TODO CR (Sep 12): convert this to a desktop alert DialogBoxAction result = Application.ActiveDesktopWindow.ShowMessageBox( SR.MessageCannotPublishKeyImagesServersNotRunning, MessageBoxActions.OkCancel); if (result == DialogBoxAction.Cancel) { return; } } var anyFailed = false; try { CreateKeyObjectDocuments(); var publishers = new Dictionary <string, DicomPublishingHelper>(); // add each KO document to a publisher by study foreach (var koDocument in _keyObjectDocuments) { var publisher = GetValue(publishers, koDocument.DataSet[DicomTags.StudyInstanceUid].ToString()); publisher.Files.Add(koDocument); } // add each PR state to a publisher by study foreach (var presentationFrame in SourceFrames) { var sourceFrame = presentationFrame.Key; var publisher = GetValue(publishers, sourceFrame.StudyInstanceUid); if (presentationFrame.Value != null) { publisher.Files.Add(presentationFrame.Value.DicomFile); } var sopDataSource = sourceFrame.ParentImageSop.DataSource; publisher.OriginServer = ServerDirectory.GetRemoteServersByAETitle(sopDataSource[DicomTags.SourceApplicationEntityTitle].ToString()).FirstOrDefault(); publisher.SourceServer = sopDataSource.Server; } // publish all files now foreach (var publisher in publishers.Values) { if (!publisher.Publish()) { anyFailed = true; } } } catch (Exception e) { anyFailed = true; Platform.Log(LogLevel.Error, e, "An unexpected error occurred while trying to publish key images."); } // TODO CR (Sep 12): convert this to a desktop alert if (anyFailed) { Application.ActiveDesktopWindow.ShowMessageBox(SR.MessageKeyImagePublishingFailed, MessageBoxActions.Ok); } }