Ejemplo n.º 1
0
        /// <summary>
        /// Handler for Revit's DocumentClosing event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnApplicationDocumentClosing(object sender, Autodesk.Revit.DB.Events.DocumentClosingEventArgs e)
        {
            // Invalidate the cached active document value if it is the closing document.
            var activeDocumentHashCode = DocumentManager.Instance.ActiveDocumentHashCode;

            if (e.Document != null && (e.Document.GetHashCode() == activeDocumentHashCode))
            {
                DocumentManager.Instance.HandleDocumentActivation(null);
            }

            HandleApplicationDocumentClosing(e.Document);
        }
Ejemplo n.º 2
0
 void m_app_DocumentClosing(object sender, Autodesk.Revit.DB.Events.DocumentClosingEventArgs e)
 {
     DisplayEvent("Document closing");
 }
Ejemplo n.º 3
0
 private void ControlledApplication_DocumentClosing(object sender, Autodesk.Revit.DB.Events.DocumentClosingEventArgs e)
 {
     ClosingDocumentPath = e.Document.PathName;
 }
Ejemplo n.º 4
0
 public void Application_DocumentClosing(object sender, Autodesk.Revit.DB.Events.DocumentClosingEventArgs e)
 {
     ExecuteEventHooks(EventType.Application_DocumentClosing, sender, e);
 }
Ejemplo n.º 5
0
 //Do something when the Document is Closing
 private void Application_DocumentClosing(object sender, Autodesk.Revit.DB.Events.DocumentClosingEventArgs args)
 {
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Removes all the stuffs this plugin made when Revit closed the document.
 /// </summary>
 /// <param name="e">The arguments of the event</param>
 public static void OnDocumentClosing(Autodesk.Revit.DB.Events.DocumentClosingEventArgs e)
 {
     OutlierPointCloudEngine.RemovePointCloud();
     InlierPointCloudEngine.RemoveAllPointClouds();
     DirectShapeEngine.RemoveAllDirectShapes();
 }
Ejemplo n.º 7
0
        private void appDocClosing(object sender, Autodesk.Revit.DB.Events.DocumentClosingEventArgs e)
        {
            BasicFileInfo fileInfo = BasicFileInfo.Extract(Variables.logFilePath);

            #region Post: Worksharing Warning-Close without saving

            if (Variables.slackOn && Variables.slackWSWarn)
            {
                if (fileInfo.AllLocalChangesSavedToCentral == false)
                {
                    string gif_lg_url = null;
                    string gif_sm_url = null;

                    if (Variables.giphySet > 0)
                    {
                        var    giphyClient = new GiphyClient();
                        string gif_msg     = giphyClient.GetRandomGif("Disappointed").Content;
                        var    gif_resp    = JsonConvert.DeserializeObject <Giphy.Response>(gif_msg);
                        if (Variables.giphySet == 1)
                        {
                            gif_sm_url = gif_resp.data.fixed_height_small_url;
                        }
                        if (Variables.giphySet == 2)
                        {
                            gif_lg_url = gif_resp.data.image_url;
                        }
                    }
                    var slackClient = new SlackClient(Variables.slackToken);

                    string text     = "";
                    string channel  = Variables.slackChId;
                    string botname  = "Worksharing Warning";
                    string icon_url = Variables.icon_revit;

                    var attachments = new Attachments
                    {
                        fallback = Variables.logUsername + "did not save to central before closing",
                        color    = "danger",
                        fields   =
                            new Fields[]
                        {
                            new Fields
                            {
                                title  = "Description",
                                value  = "The user has closed the model without saving their changes back to the central model. Open the model and save changes back to the central model.",
                                @short = false
                            },
                            new Fields
                            {
                                title  = "User",
                                value  = Variables.logUsername,
                                @short = true
                            },
                            new Fields
                            {
                                title  = "File",
                                value  = Variables.logFileCentralName,
                                @short = true
                            }
                        },
                        image_url = gif_lg_url,
                        thumb_url = gif_sm_url
                    };

                    string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                    var    resp         = JsonConvert.DeserializeObject <ChatPostMessageResponse>(msg_response);
                    msgts_ws.Add(resp.ts);
                }
            }
            #endregion
        }