Esempio n. 1
0
 public void LocalServiceControlLinkClicked()
 {
     if (DoesLocalServiceHaveToStop)
     {
         try
         {
             BlockingOperation.Run(LocalServiceProcess.Stop);
         }
         catch (Exception e)
         {
             Platform.Log(LogLevel.Debug, e);
             Host.DesktopWindow.ShowMessageBox(SR.MessageUnableToStopLocalService, MessageBoxActions.Ok);
         }
     }
     else if (DoesLocalServiceHaveToStart)
     {
         try
         {
             BlockingOperation.Run(LocalServiceProcess.Start);
         }
         catch (Exception e)
         {
             Platform.Log(LogLevel.Debug, e);
             Host.DesktopWindow.ShowMessageBox(SR.MessageUnableToStartLocalService, MessageBoxActions.Ok);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void Apply()
        {
            // check if a layout component is already displayed
            if (_shelves.ContainsKey(this.Context.DesktopWindow))
            {
                _shelves[this.Context.DesktopWindow].Activate();
            }
            else
            {
                BlockingOperation.Run(delegate
                {
                    _desktopWindow = Context.DesktopWindow;

                    var atsWebBrowserContainer = ATSWebBrowserContainer.Create(_desktopWindow);
                    var atsWebBrowserComponent =
                        atsWebBrowserContainer.Pane1.Component as ATSWebBrowserComponent;
                    var aimAnnotationComponent =
                        atsWebBrowserContainer.Pane2.Component as AimAnnotationComponent;

                    if (atsWebBrowserComponent != null && aimAnnotationComponent != null)
                    {
                        ApplicationComponent.LaunchAsWorkspace(Context.DesktopWindow, atsWebBrowserContainer, SR.WorkspaceName);
                        atsWebBrowserComponent.Url = Configuration.AtsSettings.Default.AtsUrl;
                        atsWebBrowserComponent.AimAnnotationComponent = aimAnnotationComponent;
                        atsWebBrowserComponent.Go();
                    }
                });
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void ShowAnnotationList()
        {
            if (this.ComponentShelf == null)
            {
                BlockingOperation.Run(delegate
                {
                    try
                    {
                        IDesktopWindow desktopWindow = this.Context.DesktopWindow;

                        IShelf shelf  = AimAnnotationsListComponent.Launch(desktopWindow);
                        shelf.Closed += delegate
                        {
                            _shelves.Remove(desktopWindow);
                        };

                        _shelves[this.Context.DesktopWindow] = shelf;
                    }
                    catch (Exception e)
                    {
                        ExceptionHandler.Report(e, this.Context.DesktopWindow);
                    }
                });
            }
            else
            {
                this.ComponentShelf.Show();
            }
        }
Esempio n. 4
0
            public void Run()
            {
                if (NumberOfImagesToExport <= 5)
                {
                    BlockingOperation.Run(delegate { Export(null); });
                    Complete();
                }
                else
                {
                    ItemsToExport.ForEach(delegate(IClipboardItem item) { item.Lock(); });

                    BackgroundTask task = new BackgroundTask(Export, true)
                    {
                        ThreadUICulture = Application.CurrentUICulture
                    };

                    ProgressDialogComponent progressComponent = new ProgressDialogComponent(task, true, ProgressBarStyle.Blocks);

                    _progressComponentShelf = LaunchAsShelf(DesktopWindow, progressComponent,
                                                            SR.TitleExportingImages, "ExportingImages",
                                                            ShelfDisplayHint.DockFloat);

                    _progressComponentShelf.Closed += delegate
                    {
                        Complete();
                        task.Dispose();
                    };
                }
            }
Esempio n. 5
0
        /// <summary>
        /// Creates the <see cref="ImageViewerComponent"/>, loads the specified images,
        /// and launches the <see cref="ImageViewerComponent"/>.
        /// </summary>
        public ImageViewerComponent OpenFiles()
        {
            ImageViewerComponent viewer = null;

            BlockingOperation.Run(delegate { viewer = LoadAndOpenFiles(); });
            return(viewer);
        }
        public void Show()
        {
            // check if a layout component is already displayed
            if (_shelves.ContainsKey(Context.DesktopWindow))
            {
                _shelves[Context.DesktopWindow].Activate();
            }
            else
            {
                BlockingOperation.Run(delegate
                {
                    _desktopWindow = Context.DesktopWindow;

                    var component =
                        new SegmentationComponent(Context.DesktopWindow);

                    IShelf shelf = ApplicationComponent.LaunchAsShelf(
                        _desktopWindow,
                        component,
                        SR.SegmentationTitle,
                        "DICOM Segmentation",
                        ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);

                    shelf.Closed            += OnShelfClosed;
                    _shelves[_desktopWindow] = shelf;
                });
            }
        }
        public void Show()
        {
            // check if a layout component is already displayed
            if (_shelves.ContainsKey(this.Context.DesktopWindow))
            {
                _shelves[this.Context.DesktopWindow].Activate();
            }
            else
            {
                BlockingOperation.Run(delegate
                {
                    _desktopWindow = this.Context.DesktopWindow;

                    AimAnnotationComponent aimComponent = AimAnnotationComponent.Create(Context.DesktopWindow, false);

                    IShelf shelf = ApplicationComponent.LaunchAsShelf(
                        _desktopWindow,
                        aimComponent,
                        SR.TitleAIMCreater,
                        "AIM Annotation",
                        ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);

                    shelf.Closed            += OnShelfClosed;
                    _shelves[_desktopWindow] = shelf;
                });
            }
        }
        public void RunCreateAnnotation()
        {
            BlockingOperation.Run(
                delegate()
            {
                this.CreateAnnotation();

                if (_sopInstanceUidToAeTitle.Count == 0)
                {
                    Thread.Sleep(500);
                }
                else
                {
                    int totalAnnotations = _sopInstanceUidToAeTitle.Count;
                    while (_sopInstanceUidToAeTitle.Count > 0)
                    {
                        //int currentAnnotation = totalAnnotations - _sopInstanceUidToAeTitle.Count + 1;
                        //int percentComplete = (int) (((float) (currentAnnotation)/totalAnnotations)*100 - .1);
                        //string message = string.Format("Importing annotation {0} out of {1}", currentAnnotation, totalAnnotations);
                        //context.ReportProgress(new BackgroundTaskProgress(percentComplete, message));
                        Thread.Sleep(500);
                    }
                }

                //context.Complete(null);
            });
        }
        public ImageViewerComponent OpenFiles()
        {
            string strPatientName       = "";
            ImageViewerComponent viewer = null;

            BlockingOperation.Run(delegate { viewer = LoadAndOpenFiles(strPatientName); });
            return(viewer);
        }
 public void AddSelectedStudies()
 {
     BlockingOperation.Run(delegate
     {
         foreach (var study in _browserToolContext.SelectedStudies)
         {
             LoadStudy(study);
         }
     });
 }
Esempio n. 11
0
 public void Refresh()
 {
     try
     {
         BlockingOperation.Run(RefreshInternal);
         _seriesTable.Sort();
     }
     catch (Exception e)
     {
         ExceptionHandler.Report(e, base.Host.DesktopWindow);
     }
 }
Esempio n. 12
0
        public override void Start()
        {
            InitializeTable();
            BlockingOperation.Run(RefreshInternal);
            _seriesTable.Sort(new TableSortParams(_seriesTable.Columns[0], false));

            _toolSet            = new ToolSet(new SeriesDetailsToolExtensionPoint(), new SeriesDetailsToolContext(this));
            _toolbarActionModel = ActionModelRoot.CreateModel(GetType().FullName, SeriesDetailsTool.ToolbarActionSite, _toolSet.Actions);
            _contextActionModel = ActionModelRoot.CreateModel(GetType().FullName, SeriesDetailsTool.ContextMenuActionSite, _toolSet.Actions);

            base.Start();
        }
        private void OpenAttachment()
        {
            var document = this.SelectedDocument;

            if (document == null)
            {
                return;
            }

            BlockingOperation.Run(() =>
            {
                var localUri = AttachedDocument.DownloadFile(document);
                Process.Start(localUri);
            });
        }
 public void CopyDisplaySet()
 {
     try
     {
         BlockingOperation.Run(
             delegate
         {
             Clipboard.Add(this.Context.Viewer.SelectedPresentationImage.ParentDisplaySet);
         });
     }
     catch (Exception e)
     {
         ExceptionHandler.Report(e, SR.MessageClipboardCopyFailed, Context.DesktopWindow);
     }
 }
Esempio n. 15
0
        public void CopyToClipboard()
        {
            if (!Enabled)
            {
                return;
            }

            try
            {
                BlockingOperation.Run(CopyToClipboardInternal);
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, SR.MessageClipboardCopyFailed, Host.DesktopWindow);
                this.Host.Exit();
            }
        }
        private void OpenAttachment()
        {
            var document = this.SelectedDocument;

            if (document == null)
            {
                return;
            }

            try
            {
                BlockingOperation.Run(() =>
                {
                    var localUri = AttachedDocument.DownloadFile(document);
                    Process.Start(localUri);
                });
            }
            catch (Exception ex)
            {
                ExceptionHandler.Report(ex, SR.ExceptionFailedToDisplayDocument, Host.DesktopWindow);
            }
        }
Esempio n. 17
0
        public void Go()
        {
            _component = new ChangePixelAspectRatioComponent();
            if (ApplicationComponentExitCode.Accepted !=
                ApplicationComponent.LaunchAsDialog(Context.DesktopWindow, _component, "Change Aspect Ratio"))
            {
                return;
            }

            FileDialogResult fileDialog = Context.DesktopWindow.ShowSelectFolderDialogBox(new SelectFolderDialogCreationArgs());

            if (fileDialog.Action != DialogBoxAction.Ok)
            {
                return;
            }

            _outputDirectory = fileDialog.FileName;

            _dicomFileNames = CollectionUtils.Map(GetImages(!_component.ConvertWholeDisplaySet),
                                                  (IPresentationImage image) => ((LocalSopDataSource)((IImageSopProvider)image).ImageSop.DataSource).Filename);

            try
            {
                if (_dicomFileNames.Count > 5)
                {
                    var task = new BackgroundTask(Go, true);
                    ProgressDialog.Show(task, Context.DesktopWindow, true, ProgressBarStyle.Continuous);
                }
                else
                {
                    BlockingOperation.Run(() => Go(new NullContext()));
                }
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, Context.DesktopWindow);
            }
        }
        public void Show()
        {
            if (_shelves.ContainsKey(Context.DesktopWindow))
            {
                _shelves[Context.DesktopWindow].Activate();
            }
            else
            {
                BlockingOperation.Run(delegate
                {
                    _desktopWindow   = Context.DesktopWindow;
                    var aimComponent = new AimAnnotationComponent(Context.DesktopWindow);
                    var shelf        = ApplicationComponent.LaunchAsShelf(
                        _desktopWindow,
                        aimComponent,
                        SR.TitleAIMCreater,
                        "AIM Annotation",
                        ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);

                    shelf.Closed            += OnShelfClosed;
                    _shelves[_desktopWindow] = shelf;
                });
            }
        }
Esempio n. 19
0
 public void RestartService()
 {
     BlockingOperation.Run(() => ControlService(ServiceControlOperation.Restart));
 }
Esempio n. 20
0
 public void SendSeries()
 {
     BlockingOperation.Run(SendSeriesInternal);
 }
Esempio n. 21
0
 public void Show()
 {
     BlockingOperation.Run(ShowInternal);
 }
Esempio n. 22
0
 public void Show()
 {
     BlockingOperation.Run(delegate { ShowInternal(); });
 }
Esempio n. 23
0
 private void VerifyServer()
 {
     BlockingOperation.Run(this.InternalVerifyServer);
 }
Esempio n. 24
0
 public void StopService()
 {
     BlockingOperation.Run(() => ControlService(ServiceControlOperation.Stop));
 }
Esempio n. 25
0
 public SyncWait()
 {
     threads = new ConcurrentDictionary <Guid, Result>();
     actions = new BlockingOperation <Action>(x => x());
 }