public override void AppendAdditionalMenuItems(System.Windows.Forms.ToolStripDropDown menu) { base.AppendAdditionalMenuItems(menu); var data = PersistentData.AllData(true); if (data.Count() != 0) { var dropDownButton = new System.Windows.Forms.ToolStripMenuItem(); dropDownButton.Text = "Zoom to"; dropDownButton.Click += ZoomTo; menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { new System.Windows.Forms.ToolStripSeparator(), dropDownButton }); } }
private void ZoomTo(object sender, EventArgs e) { object oldCmdEcho = Application.GetSystemVariable("CMDECHO"); Application.SetSystemVariable("CMDECHO", 0); string command = "(command \"ZOOM\" \"OB\" \"PRO\""; var args = PersistentData.AllData(true).OfType <X>() .Where(data => data.BcDocName == System.IO.Path.GetFileNameWithoutExtension(PlugIn.LinkedDocument.Name)) .Aggregate(string.Empty, (s, data) => s + " \"H\" \"" + data.PersistentRef.ToString() + "\" "); if (PlugIn.LinkedDocument.IsActive && args.Length > 0) { PlugIn.LinkedDocument.SendStringToExecute(command + args + " \"\" \"\")(setvar \"CMDECHO\" " + oldCmdEcho + ")(princ)\n", true, true, false); } }
public bool NeedsToBeExpired(ICollection <Handle> modified, ICollection <Handle> erased, ICollection <Handle> added, ICollection <string> finishedCmds) { foreach (var data in VolatileData.AllData(true).OfType <Types.IGH_BcGeometricGoo>()) { if (modified.Contains(data.PersistentRef) || erased.Contains(data.PersistentRef)) { return(true); } } if (added.Count != 0) { return(PersistentData.AllData(true).OfType <Types.IGH_BcGeometricGoo>().Any(data => added.Contains(data.PersistentRef))); } return(false); }