private void Open() { try { IApplicationComponent component = CreateComponent(); if (component != null) { WorkspaceCreationArgs args = new WorkspaceCreationArgs(component, this.Title, null); args.UserClosable = this.IsUserClosableWorkspace; _workspace = ApplicationComponent.LaunchAsWorkspace(this.Context.DesktopWindow, args); _workspace.Closed += delegate { _workspace = null; FolderExplorerComponentSettings.Default.UserConfigurationSaved -= OnUserConfigurationSaved; }; FolderExplorerComponentSettings.Default.UserConfigurationSaved += OnUserConfigurationSaved; } } catch (Exception e) { // could not launch component ExceptionHandler.Report(e, this.Context.DesktopWindow); } }
private void ShowInternal() { if (_desktopObject != null) { _desktopObject.Activate(); return; } List <TabPage> pages = new List <TabPage>(); foreach (IHealthcareArtifactExplorer explorer in GetExplorers()) { IApplicationComponent component = explorer.Component; if (component != null) { pages.Add(new TabPage(explorer.Name, component)); } } if (pages.Count == 0) { return; } TabComponentContainer container = new TabComponentContainer(); foreach (TabPage page in pages) { container.Pages.Add(page); } if (LaunchAsShelf) { ShelfCreationArgs args = new ShelfCreationArgs(); args.Component = container; args.Title = SR.TitleExplorer; args.Name = "Explorer"; args.DisplayHint = ShelfDisplayHint.DockLeft | ShelfDisplayHint.DockAutoHide; _desktopObject = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, args); } else { WorkspaceCreationArgs args = new WorkspaceCreationArgs(); args.Component = container; args.Title = SR.TitleExplorer; args.Name = "Explorer"; args.UserClosable = IsWorkspaceClosable; _desktopObject = ApplicationComponent.LaunchAsWorkspace(this.Context.DesktopWindow, args); } _desktopObject.Closed += delegate { _desktopObject = null; }; }
public static void ShowExplorer(IDesktopWindow desktopWindow) { //try //{ // string[] files = { "e:\\26885681.dcm", "e:\\26885683.dcm" }; // new OpenFilesHelper(files) { WindowBehaviour = ViewerLaunchSettings.WindowBehaviour }.OpenFiles(); //} //catch (Exception e) //{ // //ExceptionHandler.Report(e, SR.MessageUnableToOpenImages, Context.DesktopWindow); //} Platform.Log(LogLevel.Error, "starting download file"); DownloadDicomFile downloadfile = new DownloadDicomFile(); downloadfile.DownloadImages(); string[] files = downloadfile.m_files.ToArray(); string strPatientName = downloadfile.PatientName; try { new OpenFilesHelper(files) { WindowBehaviour = ViewerLaunchSettings.WindowBehaviour }.OpenFiles(strPatientName); } catch (Exception e) { Platform.Log(LogLevel.Error, e.ToString()); //ExceptionHandler.Report(e, SR.MessageUnableToOpenImages, Context.DesktopWindow); } return; if (_desktopObject != null) { _desktopObject.Activate(); return; } //return; List <TabPage> pages = new List <TabPage>(); foreach (IHealthcareArtifactExplorer explorer in GetExplorers()) { IApplicationComponent component = explorer.Component; if (component != null) { pages.Add(new TabPage(explorer.Name, component)); } } if (pages.Count == 0) { return; } TabComponentContainer container = new TabComponentContainer(); foreach (TabPage page in pages) { container.Pages.Add(page); } if (LaunchAsShelf) { ShelfCreationArgs args = new ShelfCreationArgs(); args.Component = container; args.Title = SR.TitleExplorer; args.Name = "Explorer"; args.DisplayHint = ShelfDisplayHint.DockLeft | ShelfDisplayHint.DockAutoHide; _desktopObject = ApplicationComponent.LaunchAsShelf(desktopWindow, args); } else { WorkspaceCreationArgs args = new WorkspaceCreationArgs(); args.Component = container; args.Title = SR.TitleExplorer; //args.Title = "打开本地文件"; args.Name = "Explorer"; args.UserClosable = IsWorkspaceClosable; _desktopObject = ApplicationComponent.LaunchAsWorkspace(desktopWindow, args); } _desktopObject.Closed += delegate { _desktopObject = null; }; }