调整代码

This commit is contained in:
GG Z
2026-02-22 20:03:42 +08:00
parent 2ad3d0fde0
commit 7e2d5be3cd
258 changed files with 2916 additions and 5013 deletions

View File

@@ -0,0 +1,47 @@
using Autodesk.Revit.Attributes;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.RvCommon;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.General;
[Transaction(TransactionMode.Manual)]
public class AutoSaveCmd : ExternalCommand
{
private readonly System.Timers.Timer timer = Variables.AutoSaveTimer;
public override void Execute()
{
if (string.IsNullOrEmpty(Document.PathName))
{
ErrorMessage = "当前文件尚未保存,请先保存文件";
Result = Result.Failed;
return;
}
AutoSaveViewModel viewModel = new();
General.AutoSaveView view = new()
{
DataContext = viewModel
};
view.ShowDialog();
if (RevitAddins.Properties.Settings.Default.IsActiveAutoSave)
{
if (RevitAddins.Properties.Settings.Default.AutoSaveIntervalTime >= 1)
{
timer.Interval = RevitAddins.Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
RevitAddins.Properties.Settings.Default.Save();
}
//timer.Enabled = Properties.Settings.Default.AutoSave;
timer.Start();
}
else
{
timer.Stop();
}
Result = Result.Succeeded;
}
}