默认文件路径保存

This commit is contained in:
hsc
2026-06-10 13:08:52 +08:00
parent c01aa6e545
commit 59d047d8e6
5 changed files with 54 additions and 19 deletions

View File

@@ -84,7 +84,8 @@ namespace ADP.ViewModels
_globalInfo.ContextDic.TryGetValue(_globalInfo.CurrentScope, out var ctx) ? ctx : null;
private StepRunning? CurrentRunner =>
_globalInfo.StepRunningDic.TryGetValue(_globalInfo.CurrentScope, out var runner) ? runner : null;
private SystemConfig? CurrentConfig =>
_globalInfo.ConfigDic.TryGetValue(_globalInfo.CurrentScope, out var config) ? config : null;
public string RunState
{
get => CurrentContext?.RunState ?? "运行";
@@ -179,7 +180,7 @@ namespace ADP.ViewModels
Application.Current.MainWindow.Show();
_regionManager.RequestNavigate("ShellViewManager", "MainView");
});
_eventAggregator.GetEvent<RunSingalCompletedEvent>().Subscribe(UpdateRunIcon);
_globalInfo.ScopeChanged += (s, e) =>
@@ -459,6 +460,7 @@ namespace ADP.ViewModels
private void SetDefault()
{
if (CurrentConfig == null) return;
// 💡 1. 抓取触发瞬间的 Scope 与 Context 快照
string runningScope = _globalInfo.CurrentScope;
ScopedContext? targetContext = CurrentContext;
@@ -467,8 +469,8 @@ namespace ADP.ViewModels
if (targetContext.CurrentFilePath != null)
{
//SystemConfig.DefaultProgramFilePath = targetContext.CurrentFilePath;
//ConfigService.Save();
CurrentConfig.DefaultProgramFilePath = targetContext.CurrentFilePath;
ConfigService.Save(CurrentConfig);
LoggerHelper.SuccessWithNotify($"工位 [{runningScope}] 已成功将当前程序设为默认启动程序");
}
}

View File

@@ -60,11 +60,11 @@
CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
Style="{StaticResource MaterialDesignFlatButton}"
Margin="8" />
<Button Content="更新界面"
<!--<Button Content="更新界面"
Command="{Binding NavigateCommand}"
CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
Style="{StaticResource MaterialDesignFlatButton}"
Margin="8" />
Margin="8" />-->
</StackPanel>
</materialDesign:DrawerHost.LeftDrawerContent>
<Grid>