/// <summary> /// Handler for Revit's DocumentClosed event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void OnApplicationDocumentClosed(object sender, DocumentClosedEventArgs e) { if (revitDynamoModel != null) { revitDynamoModel.HandleApplicationDocumentClosed(); } }
public static void DeregisterServices(object sender, DocumentClosedEventArgs args) { foreach (var serv in _services) { serv.Deregister(); } }
private void Application_DocumentClosed(object sender, DocumentClosedEventArgs e) { if (_uiApplication.Application.Documents.IsEmpty) { MainWindow?.Close(); } }
private void RemoveStatusofClosedDocument(Object sender, DocumentClosedEventArgs args) { if (args.Status.Equals(RevitAPIEventStatus.Succeeded) && (documentOriginalStatusDic.ContainsKey(hashcodeofCurrentClosingDoc))) { documentOriginalStatusDic.Remove(hashcodeofCurrentClosingDoc); } }
/// <summary> /// Updates the Views collection in the Region whenever a Document is closed. /// </summary> private void DockingManager_DocumentClosed(object sender, DocumentClosedEventArgs e) { LayoutDocument layoutDocument = e.Document; if (layoutDocument == null) { return; } if (Region.Views.Contains(layoutDocument)) { Region.Remove(layoutDocument); } if (Region.Views.Contains(layoutDocument.Content)) { Region.Remove(layoutDocument.Content); } if (!(layoutDocument.Content is FrameworkElement fElement)) { return; } if (Region.Views.Contains(fElement)) { Region.Remove(fElement); } if (Region.Views.Contains(fElement.DataContext)) { Region.Remove(fElement.DataContext); } }
/// <summary> /// Handles the DocumentClosedEventArgs event raised by the DockingNanager when /// one of the LayoutContent it hosts is closed. /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event.</param> /// <param name="region">The region.</param> void OnDocumentClosedEventArgs(object sender, DocumentClosedEventArgs e, IRegion region) { if ((e.Document.Content as FrameworkElement)?.DataContext is IDecompileViewModel viewModel) { bool closed = false; if (!viewModel.Shutdown(false)) { Container.Resolve <IDialogService>() .PresentConfirmation($"File {Path.GetFileName(viewModel.FilePath)}" + "didn't seem to close in time.\nWould you force to close it?", r => { if (r?.Result == ButtonResult.Yes) { viewModel.Shutdown(true); closed = true; } }); } else { closed = true; } if (closed) { region.Remove(e.Document.Content); } } }
/// <summary> /// Handler for Revit's DocumentClosed event. /// This handler is called when a document is closed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Application_DocumentClosed(object sender, DocumentClosedEventArgs e) { // If the active UI document is null, it means that all views have been // closed from all document. Clear our reference, present a warning, // and disable running. if (DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument == null) { DocumentManager.Instance.CurrentUIDocument = null; this.RunEnabled = false; this.Logger.LogWarning( "Dynamo no longer has an active document. Please open a document.", WarningLevel.Error); } else { // If Dynamo's active UI document's document is the one that was just closed // then set Dynamo's active UI document to whatever revit says is active. if (DocumentManager.Instance.CurrentUIDocument.Document == null) { DocumentManager.Instance.CurrentUIDocument = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; } } var uiDoc = DocumentManager.Instance.CurrentUIDocument; if (uiDoc != null) { this.SetRunEnabledBasedOnContext(uiDoc.ActiveView); } }
private void DockingManager_OnDocumentClosed(object sender, DocumentClosedEventArgs e) { DocumentClosedCommand?.Execute(e.Document.Content); if (this.DataContext is MainWindowViewModel) { (this.DataContext as MainWindowViewModel).DocumentClosed(e.Document.Content); } }
//On document closed, close the ViewModel private void c_app_DocumentClosed(object sender, DocumentClosedEventArgs e) { if (!Started) { return; // only do if the plugin is active } Control.DocumentClosed(); }
/// <summary> /// Handles the DocumentClosedEventArgs event raised by the DockingNanager when /// one of the LayoutContent it hosts is closed. /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event.</param> /// <param name="region">The region.</param> void OnDocumentClosedEventArgs(object sender, DocumentClosedEventArgs e, IRegion region) { var presenterLayoutDocument = e.Document as PresenterLayoutDocument; if (presenterLayoutDocument != null) { region.Remove(presenterLayoutDocument.View); } }
private void OnDocumentClosed(object sender, DocumentClosedEventArgs e) { DocumentBase document = e.Document.Content as DocumentBase; if (document != null) { document.Close(); } }
private void DocumentClosed(object sender, DocumentClosedEventArgs e) { var template = e.Document.Content as RazorTemplateViewModel; if (template != null) { ViewModel.Templates.Remove(template); } }
private void Manager_DocumentClosed(object sender, DocumentClosedEventArgs e) { if (!(e.Document?.Content is IDisposable doc)) { return; } doc.Dispose(); }
private void DockingManager_DocumentClosed(object sender, DocumentClosedEventArgs e) { var manager = (DockingManager)sender; if (LayoutDocuments.Children.Count == 0 && manager.FloatingWindows.ToList().Count == 0) { _countWorkArea = 0; } }
public void DocumentClosed(DocumentClosedEventArgs e) { Tabs.Remove(e.Document.Content as Screen); var disposable = e.Document.Content as IDisposable; if (disposable != null) { disposable.Dispose(); } }
/// <summary> /// Called when the docking manager has just closed a document. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DocumentClosedEventArgs" /> instance containing the event data.</param> private static void OnDockingManagerDocumentClosed(object sender, DocumentClosedEventArgs e) { var containerView = e.Document; var view = containerView.Content as IDocumentView; if (view != null) { ContextualViewModelManager.UnregisterDocumentView(view); } }
private void WindowClosed(object sender, DocumentClosedEventArgs e) { Logging.Logger.Info($"Closed window, '{e.Document.Title}', id: '{e.Document.ContentId}'"); LayoutDocument document = e.Document?.Content as LayoutDocument; if (Windows.Contains(document)) { Windows.Remove(document); } }
/// <summary> /// Called when the docking manager has just closed a document. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DocumentClosedEventArgs"/> instance containing the event data.</param> private static void OnDockingManagerDocumentClosed(object sender, DocumentClosedEventArgs e) { /*var containerView = e.Document; * var view = containerView.Content as IDocumentView; * if (view != null) * { * view.CloseDocument(); * }*/ //var region = RegionManager.Regions[(string)view.Tag]; //region.Remove(sender); }
private void c_app_DocumentClosed(object sender, DocumentClosedEventArgs e) { if (!Started) { return; // only do if the plugin is active } if (App.ActiveUIDocument == null && Started && _presenter != null) { _presenter.Close(); _presenter = null; } }
private void AssociatedObject_DocumentClosed(object sender, DocumentClosedEventArgs e) { if (TargetCommand == null) { return; } var buf = e.Document.ContentId.ToString(); if (buf != null) { TargetCommand.Execute(buf); } }
private void DockManager_DocumentClosed(object sender, DocumentClosedEventArgs e) { var doc = e.Document.Content as IDockDocument; if (doc != null) { doc.DocumentClosed(); } if (Documents.Contains(doc)) { Documents.Remove(doc); } }
private void newDockableContent_Closed(object sender, DocumentClosedEventArgs e) { var dockableContent = e.Document; if (dockableContent != null) { if (this.Region.Views.Contains(dockableContent.Content)) { _documents.Remove(dockableContent); this.Region.Remove(dockableContent.Content); //this.SynchronizeItems(); } } }
private void OnDockingManagerDocumentClosed(object sender, DocumentClosedEventArgs e) { var control = e.Document.Content as DockingControl; if (control == null) { return; } _documents.RemoveWhere(p => Equals(p.Value, e.Document)); _isLayoutChanged = true; _changedControls.Remove(control); _dockingControlSettings.Remove(control); Flush(); }
private void Application_DocumentClosed(object sender, DocumentClosedEventArgs e) { //Disable running against revit without a document if (DocumentManager.Instance.CurrentDBDocument == null) { DynamoViewModel.RunEnabled = false; dynSettings.Controller.DynamoLogger.LogWarning( "Dynamo no longer has an active document.", WarningLevel.Moderate); } else { DynamoViewModel.RunEnabled = true; dynSettings.Controller.DynamoLogger.LogWarning(GetDocumentPointerMessage(), WarningLevel.Moderate); } ResetForNewDocument(); }
void OnDocumentClosed(object sender, DocumentClosedEventArgs e) { try { var filter = Builders <BsonDocument> .Filter.Eq("_id", current["_id"]); var update = Builders <BsonDocument> .Update.Set("is_collaborated", true).Set("is_running", false); collection.UpdateOne(filter, update); current = searchQueue(); needsCollaboration(sender); } catch (Exception err) { Console.Write(err.ToString()); } }
public void DocumentClosed(object sender, DocumentClosedEventArgs e) { PanesViewModel pvm = null; foreach (var vm in Documents) { if (vm.ContentId == e.Document.ContentId) { pvm = vm; break; } } if (pvm != null) { Documents.Remove(pvm); } }
/// <summary> /// Called when [document closed]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="Autodesk.Revit.DB.Events.DocumentClosedEventArgs" /> instance containing the event data.</param> /// ReSharper disable once MemberCanBeMadeStatic.Local private void OnDocumentClosed(object sender, DocumentClosedEventArgs args) { // TODO: add you code here }
/// <summary> /// Handler for Revit's DocumentClosed event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnApplicationDocumentClosed(object sender, DocumentClosedEventArgs e) { HandleApplicationDocumentClosed(); }
/// <summary> /// Handles the DocumentClosedEventArgs event raised by the DockingNanager when /// one of the LayoutContent it hosts is closed. /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event.</param> /// <param name="region">The region.</param> void OnDocumentClosedEventArgs(object sender, DocumentClosedEventArgs e, IRegion region) { region.Remove(e.Document.Content); }
/// <summary> /// Handler for Revit's DocumentClosed event. /// This handler is called when a document is closed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Application_DocumentClosed(object sender, DocumentClosedEventArgs e) { // If the active UI document is null, it means that all views have been // closed from all document. Clear our reference, present a warning, // and disable running. if (DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument == null) { DocumentManager.Instance.CurrentUIDocument = null; DynamoViewModel.RunEnabled = false; dynSettings.DynamoLogger.LogWarning( "Dynamo no longer has an active document. Please open a document.", WarningLevel.Error); } else { // If Dynamo's active UI document's document is the one that was just closed // then set Dynamo's active UI document to whatever revit says is active. if (DocumentManager.Instance.CurrentUIDocument.Document == null) { DocumentManager.Instance.CurrentUIDocument = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; } } var uiDoc = DocumentManager.Instance.CurrentUIDocument; if (uiDoc != null) { DynamoRevit.SetRunEnabledBasedOnContext(uiDoc.ActiveView); } }
private void Application_DocumentClosed(object sender, DocumentClosedEventArgs e) { //Disable running against revit without a document if (DocumentManager.Instance.CurrentDBDocument == null) { //DocumentManager.Instance.CurrentUIDocument = null; DynamoViewModel.RunEnabled = false; DynamoLogger.Instance.LogWarning( "Dynamo no longer has an active document.", WarningLevel.Moderate); } else { //DocumentManager.Instance.CurrentUIDocument = // DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; DynamoViewModel.RunEnabled = true; DynamoLogger.Instance.LogWarning( string.Format( "Dynamo is now pointing at document: {0}", DocumentManager.Instance.CurrentUIDocument.Document.PathName), WarningLevel.Moderate); } ResetForNewDocument(); }
void DocumentClosed(object sender, DocumentClosedEventArgs e) { var document = e.Document; CleanupDocument(document); }
/// <summary> /// Removed the document which was closed, event reactor doesn't need to monitor this document any more. /// DocumentId is designed to identify one document, it's equal to hash code of this document. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void DocumentClosed(object sender, DocumentClosedEventArgs e) { DumpLog("Raised DocumentClosed."); m_docMapDict.Remove(e.DocumentId); }
private void OnDocumentClosed(object sender, DocumentClosedEventArgs e) { Application.ThisApp.GetSheetNoteModel().Clear(); }