private void documentActivated(object sender, DocumentCollectionEventArgs e) { PerDocData perDocDatum = null; if (!CMNApplication.mDocDataCollection.Contains(e.Document)) { perDocDatum = new PerDocData(e.Document); CMNApplication.mDocDataCollection.Add(e.Document, perDocDatum); } else { perDocDatum = (PerDocData)CMNApplication.mDocDataCollection[e.Document]; } if (CMNApplication.ESWCmn != null) { CMNApplication.ESWCmn.CmnControl.CurrentDocData = perDocDatum; CMNApplication.ESWCmn.CmnControl.RestoreFromCurrentData(true); if (Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Count == 1 && CMNApplication.ESWCmn.CmnControl.mbShouldRestore) { CMNApplication.ESWCmn.ESW.Visible = true; CMNApplication.ESWCmn.CmnControl.mbShouldRestore = false; } } W32Util.SetFocusToAcadMainFrame(); }
private void documentToBeDeactivated(object sender, DocumentCollectionEventArgs e) { if (CMNApplication.ESWCmn == null) { return; } PerDocData item = (PerDocData)CMNApplication.mDocDataCollection[e.Document]; if (item == null) { return; } item.mCurrentExpression = CMNApplication.ESWCmn.CmnControl.mSearchTextBox.Text; }
public void Initialize() { Thread.CurrentThread.CurrentUICulture = new CultureInfo(SystemObjects.DynamicLinker.ProductLcid, true); //ResourceManager resourceManager = new ResourceManager(typeof(CalculatorForm)); //resourceManager.GetString("panel_.AccessibleDescription", new CultureInfo(SystemObjects.DynamicLinker.ProductLcid, true)); if (CMNControl.UIData == null) { CMNControl.DeserializeUiLayout(); } CMNApplication.mDocDataCollection = new Hashtable(); IEnumerator enumerator = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.GetEnumerator(); while (enumerator.MoveNext()) { PerDocData perDocDatum = new PerDocData((Document)enumerator.Current); CMNApplication.mDocDataCollection.Add((Document)enumerator.Current, perDocDatum); } Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentToBeDestroyed += new DocumentCollectionEventHandler(this.docToBeDestroyed); Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentToBeDeactivated += new DocumentCollectionEventHandler(this.documentToBeDeactivated); Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentActivated += new DocumentCollectionEventHandler(this.documentActivated); Autodesk.AutoCAD.ApplicationServices.Application.SystemVariableChanged += new SystemVariableChangedEventHandler(this.sysvarChanged); //CalcDialogCreator.SetCreatorFunc(new ShowModalFunc(CMNApplication.ShowModalCalculator)); }
public CMNControl(object host) { this.mHost = host; this.mCurDocData = null; this.CreateControls(); }