Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
        /// <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();
            }
        }
Exemplo n.º 7
0
    public void CloseAndReset()
    {
        if (!isDisplaying)
        {
            return;
        }

        isDisplaying    = false;
        onConfirmAction = null;
        onCancelAction  = null;
    }
Exemplo n.º 8
0
        /// <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);
        }
Exemplo n.º 9
0
		private void EndDialog(DialogBoxAction action)
		{
			// close the form
			switch (action)
			{
				case DialogBoxAction.Cancel:
					DialogResult = DialogResult.Cancel;
					break;
				case DialogBoxAction.Ok:
					DialogResult = DialogResult.OK;
					break;
			}
		}
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        private void EndDialog(DialogBoxAction action)
        {
            // close the form
            switch (action)
            {
            case DialogBoxAction.Cancel:
                DialogResult = DialogResult.Cancel;
                break;

            case DialogBoxAction.Ok:
                DialogResult = DialogResult.OK;
                break;
            }
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        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();
            }
        }
Exemplo n.º 14
0
        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);
            }
        }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        /// <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;
        }
Exemplo n.º 18
0
 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);
 }
Exemplo n.º 19
0
        private bool ConfirmSave()
        {
            DialogBoxAction action = this.Host.ShowMessageBox(SR.MessageSaveModified, MessageBoxActions.YesNo);

            return(action == DialogBoxAction.Yes);
        }
Exemplo n.º 20
0
 public void Display(string title, string body, DialogBoxAction confirmAction, DialogBoxAction cancelAction)
 {
     confirmButton.gameObject.SetActive(true);
     ResetButtonLabelsToDefault();
     DisplayFullHelper(title, body, confirmAction, cancelAction);
 }
Exemplo n.º 21
0
 internal void DelayedClose(DialogBoxAction action)
 {
     BeginInvoke(new MethodInvoker(() => EndDialog(action)));
 }
Exemplo n.º 22
0
 public void Display(string body, DialogBoxAction confirmAction, DialogBoxAction cancelAction)
 {
     Display("ATTENTION", body, confirmAction, cancelAction);
 }
Exemplo n.º 23
0
 public void Display(string title, string body, DialogBoxAction closeAction)
 {
     confirmButton.gameObject.SetActive(false);
     ResetButtonLabelsToDefault();
     DisplayFullHelper(title, body, null, closeAction);
 }
Exemplo n.º 24
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="action"></param>
		/// <param name="filename"></param>
		public FileDialogResult(DialogBoxAction action, string filename)
		{
			_action = action;
			_filenames = new[]{filename};
		}
Exemplo n.º 25
0
 public void Display(string body, DialogBoxAction closeAction)
 {
     Display("ATTENTION", body, closeAction);
 }
Exemplo n.º 26
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="action"></param>
		/// <param name="filenames"></param>
		public FileDialogResult(DialogBoxAction action, string[] filenames)
		{
			_action = action;
			_filenames = filenames;
		}
Exemplo n.º 27
0
		internal void DelayedClose(DialogBoxAction action)
		{
			BeginInvoke(new MethodInvoker(() => EndDialog(action)));
		}
Exemplo n.º 28
0
        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);
                }
            }
        }
Exemplo n.º 29
0
        /// <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();
        }
Exemplo n.º 30
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="action"></param>
 /// <param name="filename"></param>
 public FileDialogResult(DialogBoxAction action, string filename)
 {
     _action    = action;
     _filenames = new[] { filename };
 }
Exemplo n.º 31
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="action"></param>
 /// <param name="filenames"></param>
 public FileDialogResult(DialogBoxAction action, string[] filenames)
 {
     _action    = action;
     _filenames = filenames;
 }
Exemplo n.º 32
0
        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);
            }
        }