protected Agent(bool unitTestContext) { MainThread.Initialize(); agentServer = new AgentServer(this); evaluationContextManager = new Lazy <EvaluationContextManager> (() => { MainThread.Ensure(); var host = CreateEvaluationContextManager(); host.Events.Subscribe(new Observer <ICodeCellEvent> (evnt => { switch (evnt) { case EvaluationInFlight _: break; default: MessageChannel.Push(evnt); break; } })); return(host); }); if (!unitTestContext) { RepresentationManager.AddProvider(new ReflectionRepresentationProvider()); } }
private void Compare(bool compareAgain , bool withFilter) { statusBarPanel.ProgressBar.Value = statusBarPanel.ProgressBar.Minimum; if(!compareAgain) { OpenFileDialog theOpenFileDialog = new OpenFileDialog(); theOpenFileDialog.Filter = "DCM files (*.dcm) |*.dcm|All files (*.*)|*.*"; theOpenFileDialog.Title = "Select first DCM file"; theOpenFileDialog.Multiselect = false; theOpenFileDialog.ReadOnlyChecked = true; // Show the file dialog. // If the user pressed the OK button... if (theOpenFileDialog.ShowDialog() == DialogResult.OK) { // Add all DCM files selected. firstDCMFile = theOpenFileDialog.FileName; theOpenFileDialog.Filter = "DCM files (*.dcm) |*.dcm|All files (*.*)|*.*"; theOpenFileDialog.Title = "Select second DCM file"; theOpenFileDialog.Multiselect = false; theOpenFileDialog.ReadOnlyChecked = true; if (theOpenFileDialog.ShowDialog() == DialogResult.OK) { secondDCMFile = theOpenFileDialog.FileName; } else { return; } } else { return; } } //Update the title of the form string theNewText = "DCMCompare Tool - "; theNewText+= string.Format("Comparing {0} and {1}", firstDCMFile, secondDCMFile); Text = theNewText; //Initialize and Execute the script session if(theMainSessionThread == null) { dvtThreadMgr = new ThreadManager(); theMainSessionThread = new MainThread(); theMainSessionThread.Initialize(dvtThreadMgr); theMainSessionThread.Options.Identifier = "DCM_Compare"; theMainSessionThread.Options.LogThreadStartingAndStoppingInParent = false; theMainSessionThread.Options.LogChildThreadsOverview = false; // Load the Dvtk Script session theMainSessionThread.Options.LoadFromFile(Application.StartupPath + @"\Script.ses"); DirectoryInfo resultDirectory = new DirectoryInfo(theMainSessionThread.Options.ResultsDirectory); if(!resultDirectory.Exists) { resultDirectory.Create(); } theMainSessionThread.Options.StrictValidation = true; theMainSessionThread.Options.StartAndStopResultsGatheringEnabled = true; theMainSessionThread.Options.ResultsFileNameOnlyWithoutExtension = string.Format("{0:000}", theMainSessionThread.Options.SessionId) + "_" + theMainSessionThread.Options.Identifier + "_res"; detailXmlFullFileName = theMainSessionThread.Options.DetailResultsFullFileName; summaryXmlFullFileName = theMainSessionThread.Options.SummaryResultsFullFileName; menuItemCompareAgain.Visible = true; } if(withFilter) { //Populate the Filtered Attributes List if(listBoxFilterAttr.Items.Count != 0) { foreach( object listItem in listBoxFilterAttr.Items) { string attributeStr = listItem.ToString().Trim(); attributesTagList.Add(attributeStr); } } } //Start the execution theMainSessionThread.Start(); for(int i=0; i< 10; i++) { statusBarPanel.ProgressBar.PerformStep(); System.Threading.Thread.Sleep(250); } dvtThreadMgr.WaitForCompletionThreads(); //Stop the thread if(theMainSessionThread != null) { theMainSessionThread.Stop(); theMainSessionThread = null; dvtThreadMgr = null; } //Display the results this.ShowResults(); }
public DICOMEditor() { // // Required for Windows Form Designer support // InitializeComponent(); // Initialize the Dvtk library Dvtk.Setup.Initialize(); _DCMdataset = new HLI.DataSet(); _FileMetaInfo = new FileMetaInformation(); _AttributesInfoForDataGrid = new ArrayList(); _FMIForDataGrid = new ArrayList(); InitializeDatasetGrid(); InitializeFMIGrid(); // Get the session context ThreadManager threadMgr = new ThreadManager(); _MainThread = new MainThread(); _MainThread.Initialize(threadMgr); // Subscribe to Dvtk Activity report handler activityReportEventHandler = new Dvtk.Events.ActivityReportEventHandler(OnActivityReportEvent); // Subscribe to Sniffer Activity report handler activityLoggingDelegate = new appendTextToActivityLogging_ThreadSafe_Delegate(this.AppendTextToActivityLogging_ThreadSafe); // Provide functionality to open application with Media file or Directory // which contains Media files if(dcmFileOrDirToBeOpened != "") { DirectoryInfo userDirInfo = new DirectoryInfo(dcmFileOrDirToBeOpened.Trim()); if(userDirInfo.Exists) { //It's a directory contains Media files this.dirListBox.Path = userDirInfo.FullName; this.fileListBox.Path = this.dirListBox.Path; } else { //It's a Media file FileInfo dcmFileInfo = new FileInfo(dcmFileOrDirToBeOpened.Trim()); this.dirListBox.Path = dcmFileInfo.DirectoryName; this.fileListBox.Path = this.dirListBox.Path; this.fileListBox.SelectedItem = dcmFileInfo.Name; } } }
private void GetDetailedLogging() { ThreadManager threadMgr = new ThreadManager(); MainThread loggingThread = new MainThread(DCMFile); loggingThread.Initialize(threadMgr); loggingThread.Options.CopyFrom(_MainThread.Options); loggingThread.Options.Identifier = "DICOM Editor"; loggingThread.Options.DvtkScriptSession.LogLevelFlags = LogLevelFlags.Error | LogLevelFlags.Warning | LogLevelFlags.Info; loggingThread.Options.LogThreadStartingAndStoppingInParent = false; loggingThread.Options.LogChildThreadsOverview = false; loggingThread.Options.StrictValidation = true; loggingThread.Options.StartAndStopResultsGatheringEnabled = true; loggingThread.Options.ResultsFileNameOnlyWithoutExtension = string.Format("{0:000}", loggingThread.Options.SessionId) + "_" + loggingThread.Options.Identifier + "_res"; string detailXmlFullFileName = loggingThread.Options.DetailResultsFullFileName; string summaryXmlFullFileName = loggingThread.Options.SummaryResultsFullFileName; //Start the execution loggingThread.Start(); threadMgr.WaitForCompletionThreads(); //Stop the thread if(loggingThread != null) { loggingThread.Stop(); loggingThread = null; threadMgr = null; } //Display the results DetailLogging loggingDlg = new DetailLogging(); loggingDlg.ShowResults(detailXmlFullFileName,summaryXmlFullFileName); loggingDlg.ShowDialog(); }
static RepresentationManagerTests() { MainThread.Initialize(); Logging.Log.Initialize(new TestLogProvider()); }
public AgentSynchronizationContext() : base(withCurrentSynchronizationContext: true) { SetSynchronizationContext(this); MainThread.Initialize(); }
public ThemeFormBase() { //Initialize the main thread if (!DesignMode) { MainThread.Initialize(this); //ThreadPool.QueueUserWorkItem((c) => //{ // Thread.Sleep(1000); // MainThread.Send((c2) => ScrollBarSkinner.SkinTopWindow(this)); //}); } base.AutoScaleDimensions = new SizeF(1, 1); base.AutoScaleMode = AutoScaleMode.None; base.FormBorderStyle = FormBorderStyle.None; InitializeComponent(); _rmBottom.Cursor = Cursors.SizeNS; _rmLeft.Cursor = Cursors.SizeWE; _rmRight.Cursor = Cursors.SizeWE; _rmTop.Cursor = Cursors.SizeNS; _rmLT.Cursor = Cursors.SizeNWSE; _rmLB.Cursor = Cursors.SizeNESW; _rmRT.Cursor = Cursors.SizeNESW; _rmRB.Cursor = Cursors.SizeNWSE; _ttm = new OPMToolTipManager(this); this.FormButtons = FormButtons.All; this.AllowResize = true; this.Text = string.Empty; this.ControlBox = false; this.StartPosition = FormStartPosition.CenterParent; foreach (Control ctl in this.Controls) { if (ctl is ResizeMargin) { ctl.BringToFront(); ctl.BackColor = Color.Transparent; } } _rmBottom.Tag = HTBOTTOM; _rmLB.Tag = HTBOTTOMLEFT; _rmLeft.Tag = HTLEFT; _rmLT.Tag = HTTOPLEFT; _rmRB.Tag = HTBOTTOMRIGHT; _rmRight.Tag = HTRIGHT; _rmRT.Tag = HTTOPRIGHT; _rmTop.Tag = HTTOP; this.BackColor = ThemeManager.BackColor; this.Shown += new EventHandler(ThemeFormBase_Shown); this.Load += new EventHandler(ThemeForm_Load); this.Resize += new EventHandler(ThemeForm_Resize); this.MouseDown += new MouseEventHandler(OnMouseDown); this.MouseUp += new MouseEventHandler(OnMouseUp); this.MouseMove += new MouseEventHandler(OnMouseMove); this.MouseDoubleClick += new MouseEventHandler(ThemeForm_MouseDoubleClick); this.MouseHover += new EventHandler(OnMouseHover); this.MouseLeave += new EventHandler(OnMouseLeave); this.Activated += new EventHandler(OnActivated); this.Deactivate += new EventHandler(OnDeactivated); this.HandleCreated += new EventHandler(ThemeFormBase_HandleCreated); }