优化更新代码,添加界面功能并整合

This commit is contained in:
GG Z
2025-02-10 20:53:40 +08:00
parent 83b846f15f
commit 978e03a67f
1389 changed files with 95739 additions and 22200 deletions

View File

@@ -0,0 +1,47 @@
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI;
using Nice3point.Revit.Toolkit.External;
using Nice3point.Revit.Toolkit.External.Handlers;
namespace ShrlAlgo.RvKits.RvCommon;
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.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();
AutoSaveView view = new()
{
DataContext = viewModel
};
view.ShowDialog();
if (Properties.Settings.Default.IsActiveAutoSave)
{
if (Properties.Settings.Default.AutoSaveIntervalTime >= 1)
{
timer.Interval = Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
Properties.Settings.Default.Save();
}
//timer.Enabled = Properties.Settings.Default.AutoSave;
timer.Start();
}
else
{
timer.Stop();
}
Result = Result.Succeeded;
}
}