/// <summary> /// Cancels the build currently running inside the SharpDevelop GUI. /// This method does nothing if no build is running. /// </summary> public static void CancelGuiBuild() { WorkbenchSingleton.AssertMainThread(); if (guiBuildCancellation != null) { guiBuildCancellation.Cancel(); } }
static void RaiseParserUpdateStepFinished(ParserUpdateStepEventArgs e) { WorkbenchSingleton.SafeThreadAsyncCall( delegate { ParserUpdateStepFinished(null, e); }); }
/// <summary> /// Invoke the action on the main thread in a fire-and-forget mode. /// </summary> internal static void InvokeAsyncAndForget(Action action) { #if SD5 SD.MainThread.InvokeAsyncAndForget(action); #else WorkbenchSingleton.SafeThreadAsyncCall(action); #endif }
/// <summary> /// Cancels the build currently running inside the SharpDevelop GUI. /// This method does nothing if no build is running. /// </summary> public static void CancelGuiBuild() { WorkbenchSingleton.AssertMainThread(); if (guiBuildProgressMonitor != null) { guiBuildProgressMonitor.Cancel(); } }
/// <summary> /// Invoke the action on the main thread and return after it is done. /// WARNING: This may cause a deadlock if the main thread is locked on the current thread! /// </summary> internal static void Invoke(Action action) { #if SD5 SD.MainThread.Invoke(action); #else WorkbenchSingleton.SafeThreadCall(action); #endif }
public PhysicalCountListForm() { InitializeComponent(); listView1.Resize += delegate { columnHeader1.Width = listView1.Width - 22 - (columnHeader2.Width + columnHeader3.Width); }; refreshToolStripMenuItem.Click += delegate { OnActivated(null); }; addToolStripMenuItem.Click += delegate { WorkbenchSingleton.AddChild(new PhysicalCountForm()); }; modifyToolStripMenuItem.Click += delegate { ListView1DoubleClick(this, null); }; }
public static void UpdateCommentTags(string fileName, IList <TagComment> tagComments) { if (fileName == null || tagComments == null) { return; } WorkbenchSingleton.SafeThreadAsyncCall(UpdateCommentTagsInvoked, fileName, tagComments); }
public void Done(IBuildable buildable, BuildOptions options, BuildResults results) { WorkbenchSingleton.SafeThreadAsyncCall( delegate { guiBuildProgressMonitor = null; GuiBuildFinished.RaiseEvent(null, new BuildEventArgs(buildable, options, results)); }); }
public override void Run() { VisitForm form = new VisitForm(); // IVisitDao visitDao = new NHibernateVisitDao(); // IPatientDao patientDao = new NHibernatePatientDao(); WorkbenchSingleton.AddChild(form); }
void AttachedProcessExited(object sender, EventArgs e) { attachedProcess.Exited -= new EventHandler(AttachedProcessExited); attachedProcess.Dispose(); attachedProcess = null; WorkbenchSingleton.SafeThreadAsyncCall(new Action <EventArgs>(OnDebugStopped), EventArgs.Empty); }
internal static void StartParserThread() { WorkbenchSingleton.DebugAssertMainThread(); timer = new DispatcherTimer(DispatcherPriority.Background); timer.Interval = TimeSpan.FromSeconds(1.5); timer.Tick += new EventHandler(timer_Tick); timer.Start(); }
public void InitializeWorkbench() { app = new App(); System.Windows.Forms.Integration.WindowsFormsHost.EnableWindowsFormsInterop(); ComponentDispatcher.ThreadIdle -= ComponentDispatcher_ThreadIdle; // ensure we don't register twice ComponentDispatcher.ThreadIdle += ComponentDispatcher_ThreadIdle; WorkbenchSingleton.InitializeWorkbench(new WpfWorkbench(), new AvalonDockLayout()); }
void ListView1DoubleClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { PhysicalCount c = counts[listView1.SelectedItems[0].Index]; WorkbenchSingleton.AddChild(new PhysicalCountForm(c), "Edit Physical Count"); } }
void RunWorkbenchInternal(object settings) { WorkbenchSettings wbSettings = (WorkbenchSettings)settings; WorkbenchStartup wbc = new WorkbenchStartup(); LoggingService.Info("Initializing workbench..."); wbc.InitializeWorkbench(); RunWorkbenchInitializedCommands(); LoggingService.Info("Starting workbench..."); Exception exception = null; // finally start the workbench. try { callback.BeforeRunWorkbench(); if (Debugger.IsAttached) { wbc.Run(wbSettings.InitialFileList); } else { try { wbc.Run(wbSettings.InitialFileList); } catch (Exception ex) { exception = ex; } } } finally { LoggingService.Info("Unloading services..."); try { WorkbenchSingleton.OnWorkbenchUnloaded(); PropertyService.Save(); } catch (Exception ex) { LoggingService.Warn("Exception during unloading", ex); if (exception == null) { exception = ex; } } } LoggingService.Info("Finished running workbench."); callback.WorkbenchClosed(); if (exception != null) { const string errorText = "Unhandled exception terminated the workbench"; LoggingService.Fatal(exception); if (useSharpDevelopErrorHandler) { System.Windows.Forms.Application.Run(new ExceptionBox(exception, errorText, true)); } else { throw new RunWorkbenchException(errorText, exception); } } }
void btnStartClick(object sender, RoutedEventArgs e) { try { if (!File.Exists(txtExePath.Text)) { throw new FileNotFoundException("file '" + txtExePath.Text + "' was not found!"); } if (!Directory.Exists(txtWorkingDir.Text)) { throw new DirectoryNotFoundException("directory '" + txtWorkingDir.Text + "' was not found!"); } string outputName = "Session" + DateTime.Now.ToString("yyyyMMdd_HHmmss", CultureInfo.InvariantCulture) + ".sdps"; string outputPath = ""; SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = Path.GetDirectoryName(txtExePath.Text); sfd.Filter = StringParser.Parse("${res:AddIns.Profiler.FileExtensionDescription}|*.sdps"); sfd.FileName = outputName; if (sfd.ShowDialog() == true) { outputPath = sfd.FileName; } else { return; } try { Directory.CreateDirectory(Path.GetDirectoryName(outputPath)); var runner = CreateRunner(txtExePath.Text, txtWorkingDir.Text, txtArgs.Text, new ProfilingDataSQLiteWriter(outputPath)); if (runner != null) { runner.RunFinished += delegate { WorkbenchSingleton.SafeThreadCall(() => FileService.OpenFile(outputPath)); }; runner.Run(); } this.Close(); } catch (ProfilerException ex) { MessageService.ShowError(ex.Message); } } catch (ArgumentNullException) { MessageService.ShowError(StringParser.Parse("${res:AddIns.Profiler.ProfileExecutable.ErrorMessage}")); } catch (FileNotFoundException ex) { MessageService.ShowError(ex.Message); } catch (DirectoryNotFoundException ex2) { MessageService.ShowError(ex2.Message); } catch (UnauthorizedAccessException ex4) { MessageService.ShowError(ex4.Message); } catch (Exception ex3) { MessageService.ShowException(ex3); } }
void ButtonNewClick(object sender, EventArgs e) { using (CustomerDiscountedItemForm f = new CustomerDiscountedItemForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { customer.AddDiscountedItem(f.CustomerDiscountedItem); } } }
void NewToolStripMenuItemClick(object sender, EventArgs e) { using (var f = new TruckReturnItemForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { ret.AddItem(f.ReturnItem); } } }
public override void Run() { CustomerCenterForm form = new CustomerCenterForm(); ICustomerRepository customerDao = new NHibernateCustomerRepository(); form.CustomersList += delegate { form.Customers = customerDao.FindActive(); }; form.CustomerAdd += delegate { new AddCustomer().Run(); }; WorkbenchSingleton.AddChild(form); }
public static bool GetClipboardContainsText() { WorkbenchSingleton.DebugAssertMainThread(); if (WorkbenchSingleton.Workbench != null && WorkbenchSingleton.Workbench.IsActiveWindow) { UpdateClipboardContainsText(); } return(clipboardContainsText); }
public override void Run() { CategoryListForm form = new CategoryListForm(); form.CategoriesList += delegate { form.Categories = Category.FindAll(); }; WorkbenchSingleton.AddChild(form); }
void SetWatcher() { WorkbenchSingleton.AssertMainThread(); if (watcher != null) { watcher.EnableRaisingEvents = false; } if (!enabled) { return; } if (globalDisableCount > 0) { return; } if (DetectExternalChangesOption == false) { return; } string fileName = file.FileName; if (string.IsNullOrEmpty(fileName)) { return; } if (FileUtility.IsUrl(fileName)) { return; } if (!Path.IsPathRooted(fileName)) { return; } try { if (watcher == null) { watcher = new FileSystemWatcher(); watcher.SynchronizingObject = WorkbenchSingleton.MainForm; watcher.Changed += OnFileChangedEvent; watcher.Created += OnFileChangedEvent; watcher.Renamed += OnFileChangedEvent; } watcher.Path = Path.GetDirectoryName(fileName); watcher.Filter = Path.GetFileName(fileName); watcher.EnableRaisingEvents = true; } catch (PlatformNotSupportedException) { if (watcher != null) { watcher.Dispose(); } watcher = null; } }
void ParserServiceLoadSolutionProjectsThreadEnded(object sender, EventArgs e) { WorkbenchSingleton.SafeThreadAsyncCall( () => { highlightCache.Clear(); TextView.Redraw(); } ); }
public ProjectChangeWatcher(string fileName) { this.fileName = fileName; WorkbenchSingleton.AssertMainThread(); activeWatchers.Add(this); WorkbenchSingleton.MainWindow.Activated += MainFormActivated; }
public override void Drop(int lineNumber) { // call async because the Debugger seems to use Application.DoEvents(), but we don't want to process events // because Drag'N'Drop operation has finished WorkbenchSingleton.SafeThreadAsyncCall( delegate { DebuggerService.CurrentDebugger.SetInstructionPointer(this.FileName, lineNumber, 1); }); }
public static void DisableAllChangeWatchers() { WorkbenchSingleton.AssertMainThread(); globalDisableCount++; foreach (FileChangeWatcher w in activeWatchers) { w.SetWatcher(); } }
public static void RaiseEventStartBuild() { WorkbenchSingleton.AssertMainThread(); building = true; if (StartBuild != null) { StartBuild(null, EventArgs.Empty); } }
void ButtonAddressDetailsClick(object sender, EventArgs e) { using (var f = new AddressForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { richTextBoxAddress.Text = f.Address.ToString(); } } }
void ButtonNewClick(object sender, EventArgs e) { using (ModuleCommandForm f = new ModuleCommandForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { module.AddCommand(f.Command); } } }
public static void RaiseEventEndBuild(BuildEventArgs e) { WorkbenchSingleton.AssertMainThread(); building = false; if (EndBuild != null) { EndBuild(null, e); } }
void ProcessExitEvent(object sender, EventArgs e) { WorkbenchSingleton.SafeThreadAsyncCall( delegate { ProcessRunner p = (ProcessRunner)sender; TaskService.BuildMessageViewCategory.AppendLine(StringParser.Parse("${res:XML.MainMenu.ToolMenu.ExternalTools.ExitedWithCode} " + p.ExitCode)); p.Dispose(); }); }