void Document_DocumentRemoved(object sender, SubjectEventArgs <Document> e) { Document.DocumentRemoved -= Document_DocumentRemoved; WriteBlock.AppendTask(() => { Document.Open(mFilePath, null); }); }
void Document_DocumentRemoved(object sender, SubjectEventArgs <Document> e) { Document.DocumentRemoved -= Document_DocumentRemoved; WriteBlock.AppendTask(() => { var windows = Document.Open(mFilePath, null); Window.ActiveWindow = windows.First(); }); }
private void ApplicationVersion() { WriteBlock.AppendTask(() => { var appVer = Application.Version; MessageBox.Show( "ReleaseNumber = " + appVer.ReleaseNumber + Environment.NewLine + "ServicePack = " + appVer.ServicePack, "Application.Version"); }); }
private void CreatePanelTab() { WriteBlock.AppendTask(() => { var command = Command.Create(Guid.NewGuid().ToString()); command.Image = Resources.robot; command.Text = "PanelTab Created by EllieWare"; command.IsVisible = true; var tab = PanelTab.Create(command, new TextBox(), Panel.Structure); }); }
private void Reload() { WriteBlock.AppendTask(() => { Document.DocumentRemoved += Document_DocumentRemoved; mFilePath = Window.ActiveWindow.Document.Path; var allWindows = Window.GetWindows(Window.ActiveWindow.Document); foreach (var thisWindow in allWindows) { thisWindow.Close(); } }); }
private void ColorFaceRed() { WriteBlock.AppendTask(() => { var ctx = Window.ActiveWindow.ActiveContext; var selection = ctx.Selection; var desFaces = selection.OfType <DesignFace>(); foreach (var thisDesFace in desFaces) { thisDesFace.SetColor(null, Color.Red); } }); }
public override bool Run() { var evt = new AutoResetEvent(false); var retVal = false; WriteBlock.AppendTask(() => { try { retVal = DoRun(); } finally { evt.Set(); } }); return(evt.WaitOne(60000) && retVal); }
public bool Run() { var evt = new AutoResetEvent(false); var retVal = false; WriteBlock.AppendTask(() => { try { retVal = DoRun(); } finally { evt.Set(); } }); // allow 1 hour for timeout return(evt.WaitOne(60 * 60 * 1000) && retVal); }
private void RemoveFace() { WriteBlock.AppendTask(() => { try { var ctx = Window.ActiveWindow.ActiveContext; var selection = ctx.Selection; var desFaces = selection.OfType <DesignFace>(); var modFaces = from thisDesFace in desFaces select thisDesFace.Shape; foreach (var thisModFace in modFaces) { var desBody = thisModFace.Body; desBody.DeleteFaces(new[] { thisModFace }, RepairAction.GrowSurrounding); } } catch (InvalidOperationException ex) { // Body.DeleteFaces() throws InvalidOperationException on failure MessageBox.Show(ex.Message); } }); }