Ejemplo n.º 1
0
        /// <summary>
        /// Handles removal of updaters when Document closes.
        /// </summary>
        public void DocumentClosing(object sender, DocumentClosingEventArgs args)
        {
            try
            {
                var doc = args.Document;
                if (null == doc)
                {
                    return;
                }

                var centralPath = RevitUtil.GetCentralFilePath(doc);
                if (!configDictionary.ContainsKey(centralPath))
                {
                    return;
                }

                var config = configDictionary[centralPath];
                UpdaterUtil.UnregisterUpdaters(doc, config);
                configDictionary.Remove(centralPath);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Ejemplo n.º 2
0
 public void DocumentClosing(object sender, DocumentClosingEventArgs args)
 {
     try
     {
         Document doc = args.Document;
         if (null != doc)
         {
             //unregister updater
             SheetManagerConfiguration config = DataStorageUtil.GetConfiguration(doc);
             bool unregistered = UpdaterUtil.UnregisterUpdaters(doc, config);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed to unregister updater.\n" + ex.Message, "Sheet Manager : Unregister Updater", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }