diff --git a/CapMachine.Wpf/App.config b/CapMachine.Wpf/App.config
index 9a5c2da..5e08d11 100644
--- a/CapMachine.Wpf/App.config
+++ b/CapMachine.Wpf/App.config
@@ -10,6 +10,7 @@
+
\ No newline at end of file
diff --git a/CapMachine.Wpf/App.xaml.cs b/CapMachine.Wpf/App.xaml.cs
index 77f3a48..11863b6 100644
--- a/CapMachine.Wpf/App.xaml.cs
+++ b/CapMachine.Wpf/App.xaml.cs
@@ -268,9 +268,28 @@ namespace CapMachine.Wpf
RegionManager.SetRegionManager(view, regionManager);
RegionManager.UpdateRegions();
+ var configService = container.Resolve();
+
//给MainView的MainViewFooterContentRegion区域设置FooterView具体的信息
regionManager.RequestNavigate("MainViewFooterContentRegion", nameof(FooterView));
- regionManager.RequestNavigate("MainViewContentRegion", nameof(UserManageView));
+ if (IsDebugMode())
+ {
+ configService.IsUserLoggedIn = true;
+ if (configService.CurUserDto != null)
+ {
+ configService.CurUserDto.Name = "DebugUser";
+ configService.CurUserDto.Level = "管理员";
+ configService.CurUserDto.IsEnable = true;
+ configService.CurUserDto.Password = string.Empty;
+ }
+
+ regionManager.RequestNavigate("MainViewContentRegion", nameof(MonitorView));
+ }
+ else
+ {
+ configService.IsUserLoggedIn = false;
+ regionManager.RequestNavigate("MainViewContentRegion", nameof(UserManageView));
+ }
//调用首页的INavigationAware 接口做一个初始化操作
if (view.DataContext is INavigationAware navigationAware)
@@ -444,6 +463,29 @@ namespace CapMachine.Wpf
}
+ ///
+ /// 读取调试模式配置。
+ /// 非 0 表示调试模式(跳过登录),0 表示部署模式(需要登录)。
+ ///
+ /// 是否调试模式。
+ private bool IsDebugMode()
+ {
+ try
+ {
+ var debugValue = ConfigHelper.GetValue("Debug");
+ if (int.TryParse(debugValue, out var debugFlag))
+ {
+ return debugFlag != 0;
+ }
+
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
#endregion