private void MainWindow_Loaded(object sender, RoutedEventArgs e) { try { var machineInfo = MachineLogic.localMachine(); var netmachineInfo = UserLogic.AutoLogin(machineInfo.token); if (netmachineInfo == null) { NavigationHelper.NavigatedToView("用户登录"); } if (netmachineInfo.machineId != machineInfo.machineId) { NavigationHelper.NavigatedToView("用户登录"); } machineInfo.machineName = netmachineInfo.machineName; machineInfo.machinepwd = netmachineInfo.machinePwd; MachineLogic.RecordMachineInfo(machineInfo); NavigationHelper.NavigatedToView("主界面"); } catch (Exception) { NavigationHelper.NavigatedToView("用户登录"); } var Swatches = new SwatchesProvider().Swatches; var swatch = Swatches.FirstOrDefault(o => o.Name == "blue"); ModifyTheme(theme => { theme.SetBaseTheme(Theme.Light); }); ModifyTheme(theme => theme.SetPrimaryColor(swatch.ExemplarHue.Color)); ModifyTheme(theme => theme.SetSecondaryColor(swatch.AccentExemplarHue.Color)); }