Esempio n. 1
0
 void m_app_DocumentSavedToCentral(object sender, Autodesk.Revit.DB.Events.DocumentSynchronizedWithCentralEventArgs e)
 {
     DisplayEvent("Document saved to central");
 }
Esempio n. 2
0
 //Do something when the Document has finished Synchronizing
 private void Application_DocumentSynchronized(object sender, Autodesk.Revit.DB.Events.DocumentSynchronizedWithCentralEventArgs args)
 {
 }
Esempio n. 3
0
 public void Application_DocumentSynchronizedWithCentral(object sender, Autodesk.Revit.DB.Events.DocumentSynchronizedWithCentralEventArgs e)
 {
     ExecuteEventHooks(EventType.Application_DocumentSynchronizedWithCentral, sender, e);
 }
Esempio n. 4
0
        private void appDocSynched(object sender, Autodesk.Revit.DB.Events.DocumentSynchronizedWithCentralEventArgs e)
        {
            Variables.logSyncEnd      = DateTime.Now;
            Variables.logSyncDuration = Variables.logSyncEnd - Variables.logSyncStart;
            Document doc = e.Document;

            #region Settings: Reload from Extensible Storage
            ParameterCommands.Load(doc);
            #endregion

            #region Extra: Tracking-Report Differences after Sync
            IEnumerable <Element>    a         = TrackChanges.Command.GetTrackedElements(doc);
            Dictionary <int, string> end_state = TrackChanges.Command.GetSnapshot(a);
            string results = TrackChanges.Command.ReportDifferences(doc, _start_state, end_state);
            _start_state = TrackChanges.Command.GetSnapshot(a);

            #endregion

            #region Post: Worksharing Info-Synchronized to Central

            if (Variables.slackOn && Variables.slackWSInfo)
            {
                string gif_lg_url = null;
                string gif_sm_url = null;

                if (Variables.giphySet > 0)
                {
                    var    giphyClient = new GiphyClient();
                    string gif_msg     = giphyClient.GetRandomGif("ThumbsUp").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);

                //Delete previous synching message, if enabled
                if (Variables.tidySet > 0)
                {
                    slackClient.DeleteMessage(msgts_synching, Variables.slackChId);
                    msgts_synching.Clear();
                }

                //Post synched message
                string text     = "";
                string channel  = Variables.slackChId;
                string botname  = "Synching Info";
                string icon_url = Variables.icon_revit;

                var attachments = new Attachments
                {
                    fallback = Variables.logUsername + "has synched",
                    color    = "good",
                    fields   =
                        new Fields[]
                    {
                        new Fields
                        {
                            title  = "Status",
                            value  = Variables.logUsername + " has synched to central.\n[" + Variables.logFileCentralName + " (Size: " + Variables.logFileSize.ToString() + "MB) ]",
                            @short = true
                        },
                        new Fields
                        {
                            title  = "Duration",
                            value  = string.Format("{0:hh\\:mm\\:ss}", Variables.logSyncDuration),
                            @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_synching.Add(resp.ts);
            }
            #endregion
        }