Ejemplo n.º 1
0
 /// <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();
     }
 }
Ejemplo n.º 4
0
 private void RemoveStatusofClosedDocument(Object sender, DocumentClosedEventArgs args)
 {
     if (args.Status.Equals(RevitAPIEventStatus.Succeeded) && (documentOriginalStatusDic.ContainsKey(hashcodeofCurrentClosingDoc)))
     {
         documentOriginalStatusDic.Remove(hashcodeofCurrentClosingDoc);
     }
 }
Ejemplo n.º 5
0
        /// <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);
            }
        }
Ejemplo n.º 6
0
 /// <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);
         }
     }
 }
Ejemplo n.º 7
0
        /// <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);
     }
 }
Ejemplo n.º 9
0
 //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();
 }
Ejemplo n.º 10
0
        /// <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);
            }
        }
Ejemplo n.º 11
0
        private void OnDocumentClosed(object sender, DocumentClosedEventArgs e)
        {
            DocumentBase document = e.Document.Content as DocumentBase;

            if (document != null)
            {
                document.Close();
            }
        }
Ejemplo n.º 12
0
        private void DocumentClosed(object sender, DocumentClosedEventArgs e)
        {
            var template = e.Document.Content as RazorTemplateViewModel;

            if (template != null)
            {
                ViewModel.Templates.Remove(template);
            }
        }
Ejemplo n.º 13
0
        private void Manager_DocumentClosed(object sender, DocumentClosedEventArgs e)
        {
            if (!(e.Document?.Content is IDisposable doc))
            {
                return;
            }

            doc.Dispose();
        }
Ejemplo n.º 14
0
        private void DockingManager_DocumentClosed(object sender, DocumentClosedEventArgs e)
        {
            var manager = (DockingManager)sender;

            if (LayoutDocuments.Children.Count == 0 &&
                manager.FloatingWindows.ToList().Count == 0)
            {
                _countWorkArea = 0;
            }
        }
Ejemplo n.º 15
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();
            }
        }
Ejemplo n.º 16
0
        /// <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);
            }
        }
Ejemplo n.º 17
0
        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);
            }
        }
Ejemplo n.º 18
0
        /// <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);
        }
Ejemplo n.º 19
0
 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;
     }
 }
Ejemplo n.º 20
0
        private void AssociatedObject_DocumentClosed(object sender, DocumentClosedEventArgs e)
        {
            if (TargetCommand == null)
            {
                return;
            }
            var buf = e.Document.ContentId.ToString();

            if (buf != null)
            {
                TargetCommand.Execute(buf);
            }
        }
Ejemplo n.º 21
0
        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);
            }
        }
Ejemplo n.º 22
0
        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();
                }
            }
        }
Ejemplo n.º 23
0
        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();
        }
Ejemplo n.º 24
0
        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());
            }
        }
Ejemplo n.º 26
0
        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);
            }
        }
Ejemplo n.º 27
0
        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();
        }
Ejemplo n.º 28
0
 /// <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
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Handler for Revit's DocumentClosed event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnApplicationDocumentClosed(object sender, DocumentClosedEventArgs e)
 {
     HandleApplicationDocumentClosed();
 }
Ejemplo n.º 30
0
 /// <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);
 }
Ejemplo n.º 31
0
        /// <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); 
            }
        }
Ejemplo n.º 32
0
        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();
        }
Ejemplo n.º 33
0
        void DocumentClosed(object sender, DocumentClosedEventArgs e)
        {
            var document = e.Document;

            CleanupDocument(document);
        }
Ejemplo n.º 34
0
 /// <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();
     }
 }
Ejemplo n.º 35
0
 /// <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);
 }
Ejemplo n.º 36
0
 void DocumentClosed(object sender, DocumentClosedEventArgs e)
 {
     var document = e.Document;
     CleanupDocument(document);
 }
 private void OnDocumentClosed(object sender, DocumentClosedEventArgs e)
 {
     Application.ThisApp.GetSheetNoteModel().Clear();
 }