public ToolboxViewModel() { if (WpfUtil.IsInDesignMode) { return; } this.SwitchRadeonGpu = new DelegateCommand(() => { if (MinerProfileViewModel.Instance.IsMining) { VirtualRoot.Out.ShowInfo("请先停止挖矿"); return; } var config = new DialogWindowViewModel( isConfirmNo: true, btnNoToolTip: "注意:关闭计算模式挖矿算力会减半", message: $"过程大概需要花费5到10秒钟", title: "确认", onYes: () => { VirtualRoot.Execute(new SwitchRadeonGpuCommand(on: true)); }, onNo: () => { VirtualRoot.Execute(new SwitchRadeonGpuCommand(on: false)); return(true); }, yesText: "开启计算模式", noText: "关闭计算模式"); this.ShowDialog(config); }); this.AtikmdagPatcher = new DelegateCommand(() => { if (MinerProfileViewModel.Instance.IsMining) { VirtualRoot.Out.ShowInfo("请先停止挖矿"); return; } VirtualRoot.Execute(new AtikmdagPatcherCommand()); }); this.NavigateToDriver = new DelegateCommand <SysDicItemViewModel>((item) => { if (item == null) { return; } Process.Start(item.Value); }); this.RegCmdHere = new DelegateCommand(() => { this.ShowDialog(new DialogWindowViewModel(message: $"确定在windows右键上下文菜单中添加\"命令行\"菜单吗?", title: "确认", onYes: () => { VirtualRoot.Execute(new RegCmdHereCommand()); })); }); this.BlockWAU = new DelegateCommand(() => { this.ShowDialog(new DialogWindowViewModel(message: $"确定禁用Windows系统更新吗?禁用后可在Windows服务中找到Windows Update手动启用。", title: "确认", onYes: () => { VirtualRoot.Execute(new BlockWAUCommand()); }, helpUrl: "https://www.loserhub.cn/posts/details/91")); }); this.Win10Optimize = new DelegateCommand(() => { this.ShowDialog(new DialogWindowViewModel(message: $"确定面向挖矿优化windows吗?", title: "确认", onYes: () => { VirtualRoot.Execute(new Win10OptimizeCommand()); }, helpUrl: "https://www.loserhub.cn/posts/details/83")); }); this.EnableWindowsRemoteDesktop = new DelegateCommand(() => { VirtualRoot.Execute(new EnableWindowsRemoteDesktopCommand()); }); this.WindowsAutoLogon = new DelegateCommand(() => { VirtualRoot.Execute(new EnableOrDisableWindowsAutoLoginCommand()); }); }
public ToolboxViewModel() { if (WpfUtil.IsInDesignMode) { return; } this.SwitchRadeonGpu = new DelegateCommand(() => { if (MinerProfileViewModel.Instance.IsMining) { VirtualRoot.Out.ShowWarn("请先停止挖矿", header: "提示", autoHideSeconds: 3); return; } var config = new DialogWindowViewModel( isConfirmNo: true, btnNoToolTip: "注意:关闭计算模式挖矿算力会减半", message: $"过程大概需要花费5到10秒钟", title: "确认", onYes: () => { VirtualRoot.Execute(new SwitchRadeonGpuCommand(on: true)); }, onNo: () => { VirtualRoot.Execute(new SwitchRadeonGpuCommand(on: false)); return(true); }, btnYesText: "开启计算模式", btnNoText: "关闭计算模式"); this.ShowSoftDialog(config); }); this.AtikmdagPatcher = new DelegateCommand(() => { if (MinerProfileViewModel.Instance.IsMining) { VirtualRoot.Out.ShowWarn("请先停止挖矿", header: "提示", autoHideSeconds: 3); return; } VirtualRoot.Execute(new AtikmdagPatcherCommand()); }); this.RegCmdHere = new DelegateCommand(() => { if (IsRegedCmdHere) { this.ShowSoftDialog(new DialogWindowViewModel(message: $"确定移除windows右键上下文菜单中的\"命令行\"菜单吗?", title: "确认", onYes: () => { Task.Factory.StartNew(() => { VirtualRoot.Execute(new UnRegCmdHereCommand()); OnPropertyChanged(nameof(IsRegedCmdHere)); }); }, btnYesText: "移除")); } else { this.ShowSoftDialog(new DialogWindowViewModel(message: $"确定在windows右键上下文菜单中添加\"命令行\"菜单吗?", title: "确认", onYes: () => { Task.Factory.StartNew(() => { this.IsWinCmdLoading = true; VirtualRoot.Execute(new RegCmdHereCommand()); }); }, btnYesText: "添加")); } }); this.OpenDevmgmt = new DelegateCommand(() => { Process.Start("devmgmt.msc"); }); this.OpenEventvwr = new DelegateCommand(() => { Process.Start("eventvwr.msc", "/c:Application"); }); }
public ToolboxViewModel() { if (WpfUtil.IsInDesignMode) { return; } this.SwitchRadeonGpu = new DelegateCommand(() => { if (MinerProfileViewModel.Instance.IsMining) { VirtualRoot.Out.ShowInfo("请先停止挖矿"); return; } var config = new DialogWindowViewModel( isConfirmNo: true, btnNoToolTip: "注意:关闭计算模式挖矿算力会减半", message: $"过程大概需要花费5到10秒钟", title: "确认", onYes: () => { VirtualRoot.Execute(new SwitchRadeonGpuCommand(on: true)); }, onNo: () => { VirtualRoot.Execute(new SwitchRadeonGpuCommand(on: false)); return(true); }, btnYesText: "开启计算模式", btnNoText: "关闭计算模式"); this.ShowSoftDialog(config); }); this.AtikmdagPatcher = new DelegateCommand(() => { if (MinerProfileViewModel.Instance.IsMining) { VirtualRoot.Out.ShowInfo("请先停止挖矿"); return; } VirtualRoot.Execute(new AtikmdagPatcherCommand()); }); this.RegCmdHere = new DelegateCommand(() => { if (IsRegedCmdHere) { this.ShowSoftDialog(new DialogWindowViewModel(message: $"确定移除windows右键上下文菜单中的\"命令行\"菜单吗?", title: "确认", onYes: () => { Task.Factory.StartNew(() => { VirtualRoot.Execute(new UnRegCmdHereCommand()); OnPropertyChanged(nameof(IsRegedCmdHere)); }); }, btnYesText: "移除")); } else { this.ShowSoftDialog(new DialogWindowViewModel(message: $"确定在windows右键上下文菜单中添加\"命令行\"菜单吗?", title: "确认", onYes: () => { Task.Factory.StartNew(() => { this.IsWinCmdLoading = true; VirtualRoot.SetInterval(per: TimeSpan.FromMilliseconds(100), perCallback: () => { this.WinCmdLodingIconAngle += 30; }, stopCallback: () => { this.IsWinCmdLoading = false; OnPropertyChanged(nameof(IsRegedCmdHere)); }, timeout: TimeSpan.FromSeconds(6), requestStop: () => { return(IsRegedCmdHere); }); VirtualRoot.Execute(new RegCmdHereCommand()); }); }, btnYesText: "添加")); } }); this.BlockWAU = new DelegateCommand(() => { this.ShowSoftDialog(new DialogWindowViewModel(message: $"确定禁用Windows系统更新吗?禁用后可在Windows服务中找到Windows Update手动启用。", title: "确认", onYes: () => { VirtualRoot.Execute(new BlockWAUCommand()); }, helpUrl: "https://www.cnblogs.com/ntminer/p/12155769.html")); }); this.Win10Optimize = new DelegateCommand(() => { this.ShowSoftDialog(new DialogWindowViewModel(message: $"确定面向挖矿优化windows吗?", title: "确认", onYes: () => { VirtualRoot.Execute(new Win10OptimizeCommand()); }, helpUrl: "https://www.cnblogs.com/ntminer/p/12155773.html")); }); this.EnableWindowsRemoteDesktop = new DelegateCommand(() => { VirtualRoot.Execute(new EnableWindowsRemoteDesktopCommand()); }); this.WindowsAutoLogon = new DelegateCommand(() => { VirtualRoot.Execute(new EnableOrDisableWindowsAutoLoginCommand()); }); this.OpenDevmgmt = new DelegateCommand(() => { Process.Start("devmgmt.msc"); }); this.OpenEventvwr = new DelegateCommand(() => { Process.Start("eventvwr.msc", "/c:Application"); }); }