多项功能优化
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
@@ -26,25 +25,29 @@ public class RvApp : ExternalApplication
|
||||
{
|
||||
saveHandler.RaiseAsync(app =>
|
||||
{
|
||||
|
||||
var doc = app.ActiveUIDocument.Document;
|
||||
#if REVIT2018
|
||||
foreach (Autodesk.Revit.DB.Document doc in app.Application.Documents)
|
||||
{
|
||||
if (doc.IsModified && !string.IsNullOrEmpty(doc.PathName))
|
||||
{
|
||||
doc.Save();
|
||||
}
|
||||
}
|
||||
|
||||
if (doc.IsModified && !string.IsNullOrEmpty(doc.PathName))
|
||||
#else
|
||||
foreach (Autodesk.Revit.DB.Document doc in app.Application.Documents)
|
||||
if (!doc.IsBackgroundCalculationInProgress() && doc.IsModified && !string.IsNullOrEmpty(doc.PathName))
|
||||
#endif
|
||||
{
|
||||
if (!doc.IsBackgroundCalculationInProgress() && doc.IsModified&&!string.IsNullOrEmpty(doc.PathName))
|
||||
try
|
||||
{
|
||||
doc.Save();
|
||||
}
|
||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||
{
|
||||
MessageBox.Show("已手动取消本次保存", "提示");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
var command = RevitCommandId.LookupPostableCommandId(PostableCommand.Save);
|
||||
app.PostCommand(command);
|
||||
//MessageBox.Show("本次自动保存失败,将重新计时", "提示");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
});
|
||||
}
|
||||
public override void OnStartup()
|
||||
@@ -87,7 +90,7 @@ public class RvApp : ExternalApplication
|
||||
|
||||
if (Properties.Settings.Default.IsActiveAutoSave)
|
||||
{
|
||||
var interval = Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
|
||||
var interval = Properties.Settings.Default.AutoSaveIntervalTime * 60_000;
|
||||
saveTimer.Interval = interval;
|
||||
saveTimer.Elapsed -= OnTimedEvent;
|
||||
saveTimer.Elapsed += OnTimedEvent;
|
||||
@@ -95,6 +98,8 @@ public class RvApp : ExternalApplication
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void CivilApp(UIControlledApplication application)
|
||||
{
|
||||
var ribbonPanel = application.CreateRibbonPanel(TabName, "土建装饰");
|
||||
|
||||
Reference in New Issue
Block a user