Ejemplo n.º 1
0
		public void AnonymizeStudy()
		{
			_component = new AnonymizeStudyComponent(Context.SelectedStudy);
			if (ApplicationComponentExitCode.Accepted == 
				ApplicationComponent.LaunchAsDialog(Context.DesktopWindow, _component, SR.TitleAnonymizeStudy))
			{
                if (LocalStorageMonitor.IsMaxUsedSpaceExceeded)
                {
                    Context.DesktopWindow.ShowMessageBox(SR.MessageCannotAnonymizeMaxDiskUsageExceeded, MessageBoxActions.Ok);
                    return;
                }

				BackgroundTask task = null;
				try
				{
					task = new BackgroundTask(Anonymize, false, Context.SelectedStudy);
					ProgressDialog.Show(task, Context.DesktopWindow, true);
				}
				catch(Exception e)
				{
					Platform.Log(LogLevel.Error, e);
					Context.DesktopWindow.ShowMessageBox(SR.MessageAnonymizeStudyFailed, MessageBoxActions.Ok);
				}
				finally
				{					
					if (task != null)
						task.Dispose();
				}
			}
		}
Ejemplo n.º 2
0
		public void LaunchMpr()
		{
			Exception exception = null;

			IPresentationImage currentImage = this.Context.Viewer.SelectedPresentationImage;
			if (currentImage == null)
				return;

			// gather the source frames which MPR will operate on. exceptions are reported.
			BackgroundTaskParams @params;
			try
			{
				@params = new BackgroundTaskParams(FilterSourceFrames(currentImage.ParentDisplaySet, currentImage));
			}
			catch (Exception ex)
			{
				ExceptionHandler.Report(ex, SR.ExceptionMprLoadFailure, base.Context.DesktopWindow);
				return;
			}

			// execute the task to create an MPR component. exceptions (either thrown or passed via task) are reported, but any created component must be disposed
			BackgroundTask task = new BackgroundTask(LoadVolume, true, @params);
			task.Terminated += (sender, e) => exception = e.Exception;
			try
			{
				ProgressDialog.Show(task, base.Context.DesktopWindow, true, ProgressBarStyle.Blocks);
			}
			catch (Exception ex)
			{
				exception = ex;
				if (_viewer != null)
				{
					_viewer.Dispose();
					_viewer = null;
				}
			}
			finally
			{
				task.Dispose();
			}

			if (exception != null)
			{
				ExceptionHandler.Report(exception, SR.ExceptionMprLoadFailure, base.Context.DesktopWindow);
				return;
			}

			// launch the created MPR component as a workspace. any exceptions here are just reported.
			try
			{
				LaunchImageViewerArgs args = new LaunchImageViewerArgs(ViewerLaunchSettings.WindowBehaviour);
				args.Title = _viewer.Title;
				MprViewerComponent.Launch(_viewer, args);
			}
			catch (Exception ex)
			{
				ExceptionHandler.Report(ex, SR.ExceptionMprLoadFailure, base.Context.DesktopWindow);
			}
			finally
			{
				_viewer = null;
			}
		}
Ejemplo n.º 3
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();
														};
				}
			}
			public void Run()
			{
				CreateBaseDataSet();
				
				_tempFileDirectory = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "ClearCanvas");
				_tempFileDirectory = System.IO.Path.Combine(_tempFileDirectory, "BitmapImport");
				DeleteEmptyFolders(_tempFileDirectory);

				_tempFileDirectory = System.IO.Path.Combine(_tempFileDirectory, System.IO.Path.GetRandomFileName());
				Directory.CreateDirectory(_tempFileDirectory);

				BackgroundTask task = new BackgroundTask(Process, true);
				task.Terminated += delegate
									{
										OnComplete();
										task.Dispose();
									};

				lock (_waitShowProgressLock)
				{
					task.Run();

					Monitor.Wait(_waitShowProgressLock);
					if (_showProgress)
					{
						ProgressDialogComponent progressComponent = new ProgressDialogComponent(task, true, ProgressBarStyle.Blocks);
						LaunchAsShelf(DesktopWindow, progressComponent, SR.TitleImportingImages, ShelfDisplayHint.DockFloat);
					}

					Monitor.Pulse(_waitShowProgressLock);
				}
			}
		public void ChangeToSyntax(TransferSyntax syntax)
		{
			_syntax = syntax;

			BackgroundTask task = null;
			try
			{
				task = new BackgroundTask(ChangeToSyntax, false, Context.SelectedStudy);
				ProgressDialog.Show(task, this.Context.DesktopWindow, true);
			}
			catch(Exception e)
			{
				Platform.Log(LogLevel.Error, e);
				string message = String.Format("An error occurred while compressing; folder must be deleted manually: {0}", _tempPath);
				this.Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok);
			}
			finally
			{
				_tempPath = null;

				if (task != null)
					task.Dispose();
			}
		}