public static void Initialize(Type type) { try { if (!(DocumentDataObject.instanceType != null)) { if (type == null) { throw new InvalidOperationException("null instance type"); } DocumentDataObject.instanceType = type; foreach (Document doc in Application.DocumentManager) { DocumentDataObject.AddDocument(doc); } if (!DocumentDataObject.ReactorsStarted) { Application.DocumentManager.DocumentCreated += (new DocumentCollectionEventHandler(DocumentDataObject.DocumentCreated)); Application.DocumentManager.DocumentBecameCurrent += (new DocumentCollectionEventHandler(DocumentDataObject.DocumentBecameCurrent)); Application.DocumentManager.DocumentActivated += (new DocumentCollectionEventHandler(DocumentDataObject.DocumentActivated)); Application.DocumentManager.DocumentToBeDestroyed += (new DocumentCollectionEventHandler(DocumentDataObject.DocumentToBeDestroyed)); DocumentDataObject.ReactorsStarted = true; } } } catch { } }
private static void DocumentCreated(object sender, DocumentCollectionEventArgs e) { if (e.Document != null) { DocumentDataObject.AddDocument(e.Document); } }
public void Initialize() { DocumentDataObject.Initialize(typeof(AfaDocData)); SplashScreenForm.DisplaySplashScreenFor(3); AfaDocData.ActiveDocData.DocDataset.ShowFeatureServiceLayers(true); ArcGISRibbon.Initialize(); }
private static DocumentDataObject Create(Document doc) { if (DocumentDataObject.instanceType != null) { DocumentDataObject documentDataObject = (DocumentDataObject)Activator.CreateInstance(DocumentDataObject.instanceType, true); documentDataObject.m_ThisDoc = doc; documentDataObject.Attach(doc); return(documentDataObject); } throw new InvalidOperationException(AfaStrings.NoInstanceClassSpecified); }
public void Terminate() { try { this.CleanOutTempFiles(); DocumentDataObject.Terminate(); ArcGISRibbon.Terminate(); GC.Collect(); GC.WaitForPendingFinalizers(); } catch { } }
private static void AddDocument(Document doc) { if (doc == null) { return; } if (!DocumentDataObject.m_docMap.ContainsKey(doc)) { Database database = doc.TryGetDatabase(); if (database != null) { DocumentDataObject.m_docMap.Add(doc, DocumentDataObject.Create(doc)); } } }
private static void RemoveDocument(Document doc) { try { if (doc == null) { return; } DocumentDataObject documentDataObject = DocumentDataObject.DocData(doc); if (documentDataObject != null) { documentDataObject.Detach(); documentDataObject.m_ThisDoc = null; } } catch { } DocumentDataObject.m_docMap.Remove(doc); }
public static void Initialize() { DocumentDataObject.Initialize(typeof(AfaDocData)); }
public static AfaDocData DocData(Document doc) { return(DocumentDataObject.DocData(doc) as AfaDocData); }
private static void DocumentToBeDestroyed(object sender, DocumentCollectionEventArgs e) { DocumentDataObject.RemoveDocument(e.Document); }