public MainWindowViewModel() { if (Design.IsInDesignMode) { return; } this.CloseMainWindow = new DelegateCommand(() => { if (MinerProfile.IsNoUi) { VirtualRoot.Execute(new CloseMainWindowCommand()); } else { VirtualRoot.Execute(new CloseNTMinerCommand()); } }); this.CustomTheme = new DelegateCommand(() => { LogColor.ShowWindow(); }); this.UseThisPcName = new DelegateCommand(() => { string thisPcName = NTMinerRoot.GetThisPcName(); DialogWindow.ShowDialog(message: $"确定使用本机名{thisPcName}作为矿机名吗?", title: "确认", onYes: () => { MinerProfile.MinerName = thisPcName; }, icon: IconConst.IconConfirm); }); if (DevMode.IsDevMode) { _serverJsonVersion = GetServerJsonVersion(); } }
private ConsoleViewModel() { this.CustomTheme = new DelegateCommand(() => { LogColor.ShowWindow(); }); VirtualRoot.On <MineStartedEvent>("挖矿开始后因此日志窗口的水印", LogEnum.DevConsole, action: message => { this.IsWatermarkVisible = Visibility.Collapsed; }); }
public override void Link() { VirtualRoot.Window <ShowDialogWindowCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { DialogWindow.ShowDialog(message: message.Message, title: message.Title, onYes: message.OnYes, icon: message.Icon); }); }); VirtualRoot.Window <ShowQQGroupQrCodeCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { QQGroupQrCode.ShowWindow(); }); }); VirtualRoot.Window <ShowCalcCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { Calc.ShowWindow(message.CoinVm); }); }); VirtualRoot.Window <ShowFileDownloaderCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { FileDownloader.ShowWindow(message.DownloadFileUrl, message.FileTitle, message.DownloadComplete); }); }); VirtualRoot.Window <ShowAboutPageCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { AboutPage.ShowWindow(); }); }); VirtualRoot.Window <ShowKernelOutputPageCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { KernelOutputPage.ShowWindow(message.SelectedKernelOutputVm); }); }); VirtualRoot.Window <ShowKernelInputPageCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { KernelInputPage.ShowWindow(); }); }); VirtualRoot.Window <ShowGroupPageCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { GroupPage.ShowWindow(); }); }); VirtualRoot.Window <ShowSysDicPageCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { SysDicPage.ShowWindow(); }); }); VirtualRoot.Window <ShowVirtualMemoryCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { VirtualMemory.ShowWindow(); }); }); VirtualRoot.Window <ShowRestartWindowsCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { RestartWindows.ShowDialog(); }); }); VirtualRoot.Window <ShowNotificationSampleCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { NotificationSample.ShowWindow(); }); }); VirtualRoot.Window <ShowOuterPropertyCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { OuterProperty.ShowWindow(); }); }); VirtualRoot.Window <ShowInnerPropertyCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { InnerProperty.ShowWindow(); }); }); VirtualRoot.Window <ShowUserPageCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { UserPage.ShowWindow(); }); }); VirtualRoot.Window <ShowKernelDownloaderCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { KernelDownloading.ShowWindow(message.KernelId, message.DownloadComplete); }); }); VirtualRoot.Window <EnvironmentVariableEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { EnvironmentVariableEdit.ShowWindow(message.CoinKernelVm, message.EnvironmentVariable); }); }); VirtualRoot.Window <InputSegmentEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { InputSegmentEdit.ShowWindow(message.CoinKernelVm, message.Segment); }); }); VirtualRoot.Window <CoinKernelEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { CoinKernelEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <CoinEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { CoinEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <ShowContainerWindowCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { ContainerWindow window = ContainerWindow.GetWindow(message.Vm); window?.ShowWindow(); }); }); VirtualRoot.Window <GroupEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { GroupEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <KernelInputEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { KernelInputEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <KernelOutputFilterEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { KernelOutputFilterEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <KernelOutputTranslaterEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { KernelOutputTranslaterEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <KernelOutputEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { KernelOutputEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <ShowPackagesWindowCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { PackagesWindow.ShowWindow(); }); }); VirtualRoot.Window <KernelEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { KernelEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <ShowLogColorCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { LogColor.ShowWindow(); }); }); VirtualRoot.Window <ShowGpuProfilesPageCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { GpuProfilesPage.ShowWindow(message.MinerClientsWindowVm); }); }); VirtualRoot.Window <PackageEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { PackageEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <PoolKernelEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { PoolKernelEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <PoolEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { PoolEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <SysDicItemEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { SysDicItemEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <SysDicEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { SysDicEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <UserEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { UserEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.Window <WalletEditCommand>(LogEnum.DevConsole, action: message => { UIThread.Execute(() => { WalletEdit.ShowWindow(message.FormType, message.Source); }); }); }
public override void Link() { VirtualRoot.BuildCmdPath <ShowDialogWindowCommand>(action: message => { UIThread.Execute(() => { DialogWindow.ShowDialog(new DialogWindowViewModel(message: message.Message, title: message.Title, onYes: message.OnYes, icon: message.Icon)); }); }); VirtualRoot.BuildCmdPath <ShowQQGroupQrCodeCommand>(action: message => { UIThread.Execute(() => { QQGroupQrCode.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowCalcCommand>(action: message => { UIThread.Execute(() => { Calc.ShowWindow(message.CoinVm); }); }); VirtualRoot.BuildCmdPath <ShowLocalIpsCommand>(action: message => { UIThread.Execute(() => { LocalIpConfig.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowEthNoDevFeeCommand>(action: message => { UIThread.Execute(() => { EthNoDevFeeEdit.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowCalcConfigCommand>(action: message => { UIThread.Execute(() => { CalcConfig.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowMinerClientsWindowCommand>(action: message => { UIThread.Execute(() => { MinerClientsWindow.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowNTMinerUpdaterConfigCommand>(action: message => { UIThread.Execute(() => { NTMinerUpdaterConfig.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowAboutPageCommand>(action: message => { UIThread.Execute(() => { AboutPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowKernelOutputPageCommand>(action: message => { UIThread.Execute(() => { KernelOutputPage.ShowWindow(message.SelectedKernelOutputVm); }); }); VirtualRoot.BuildCmdPath <ShowKernelInputPageCommand>(action: message => { UIThread.Execute(() => { KernelInputPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowTagBrandCommand>(action: message => { if (NTMinerRoot.IsBrandSpecified) { return; } BrandTag.ShowWindow(); }); VirtualRoot.BuildCmdPath <ShowCoinPageCommand>(action: message => { UIThread.Execute(() => { CoinPage.ShowWindow(message.CurrentCoin, message.TabType); }); }); VirtualRoot.BuildCmdPath <ShowGroupPageCommand>(action: message => { UIThread.Execute(() => { GroupPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowSysDicPageCommand>(action: message => { UIThread.Execute(() => { SysDicPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowVirtualMemoryCommand>(action: message => { UIThread.Execute(() => { VirtualMemory.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowRestartWindowsCommand>(action: message => { UIThread.Execute(() => { RestartWindows.ShowDialog(); }); }); VirtualRoot.BuildCmdPath <ShowNotificationSampleCommand>(action: message => { UIThread.Execute(() => { NotificationSample.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowPropertyCommand>(action: message => { UIThread.Execute(() => { Property.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowChartsWindowCommand>(action: message => { UIThread.Execute(() => { ChartsWindow.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowOverClockDataPageCommand>(action: message => { UIThread.Execute(() => { OverClockDataPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowNTMinerWalletPageCommand>(action: message => { UIThread.Execute(() => { NTMinerWalletPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowMessagePathIdsCommand>(action: message => { UIThread.Execute(() => { MessagePathIds.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowUserPageCommand>(action: message => { UIThread.Execute(() => { UserPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowRemoteDesktopLoginDialogCommand>(action: message => { RemoteDesktopLogin.ShowWindow(message.Vm); }); VirtualRoot.BuildCmdPath <ShowKernelsWindowCommand>(action: message => { UIThread.Execute(() => { KernelsWindow.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowKernelDownloaderCommand>(action: message => { UIThread.Execute(() => { KernelDownloading.ShowWindow(message.KernelId, message.DownloadComplete); }); }); VirtualRoot.BuildCmdPath <EnvironmentVariableEditCommand>(action: message => { UIThread.Execute(() => { EnvironmentVariableEdit.ShowWindow(message.CoinKernelVm, message.EnvironmentVariable); }); }); VirtualRoot.BuildCmdPath <InputSegmentEditCommand>(action: message => { UIThread.Execute(() => { InputSegmentEdit.ShowWindow(message.CoinKernelVm, message.Segment); }); }); VirtualRoot.BuildCmdPath <CoinKernelEditCommand>(action: message => { UIThread.Execute(() => { CoinKernelEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <CoinEditCommand>(action: message => { UIThread.Execute(() => { CoinEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <ColumnsShowEditCommand>(action: message => { UIThread.Execute(() => { ColumnsShowEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <ShowContainerWindowCommand>(action: message => { UIThread.Execute(() => { ContainerWindow window = ContainerWindow.GetWindow(message.Vm); window?.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowSpeedChartsCommand>(action: message => { UIThread.Execute(() => { SpeedCharts.ShowWindow(message.GpuSpeedVm); }); }); VirtualRoot.BuildCmdPath <ShowFileWriterPageCommand>(action: message => { UIThread.Execute(() => { FileWriterPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <FileWriterEditCommand>(action: message => { UIThread.Execute(() => { FileWriterEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <ShowFragmentWriterPageCommand>(action: message => { UIThread.Execute(() => { FragmentWriterPage.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <FragmentWriterEditCommand>(action: message => { UIThread.Execute(() => { FragmentWriterEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <GroupEditCommand>(action: message => { UIThread.Execute(() => { GroupEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <KernelInputEditCommand>(action: message => { UIThread.Execute(() => { KernelInputEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <KernelOutputFilterEditCommand>(action: message => { UIThread.Execute(() => { KernelOutputFilterEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <KernelOutputTranslaterEditCommand>(action: message => { UIThread.Execute(() => { KernelOutputTranslaterEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <KernelOutputEditCommand>(action: message => { UIThread.Execute(() => { KernelOutputEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <ShowPackagesWindowCommand>(action: message => { UIThread.Execute(() => { PackagesWindow.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <KernelEditCommand>(action: message => { UIThread.Execute(() => { KernelEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <ShowLogColorCommand>(action: message => { UIThread.Execute(() => { LogColor.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <ShowMinerClientSettingCommand>(action: message => { UIThread.Execute(() => { MinerClientSetting.ShowWindow(message.Vm); }); }); VirtualRoot.BuildCmdPath <ShowMinerNamesSeterCommand>(action: message => { UIThread.Execute(() => { MinerNamesSeter.ShowWindow(message.Vm); }); }); VirtualRoot.BuildCmdPath <ShowGpuProfilesPageCommand>(action: message => { UIThread.Execute(() => { GpuProfilesPage.ShowWindow(message.MinerClientsWindowVm); }); }); VirtualRoot.BuildCmdPath <ShowMinerClientAddCommand>(action: message => { UIThread.Execute(() => { MinerClientAdd.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <MinerGroupEditCommand>(action: message => { UIThread.Execute(() => { MinerGroupEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <NTMinerWalletEditCommand>(action: message => { UIThread.Execute(() => { NTMinerWalletEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <MineWorkEditCommand>(action: message => { UIThread.Execute(() => { MineWorkEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <OverClockDataEditCommand>(action: message => { UIThread.Execute(() => { OverClockDataEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <PackageEditCommand>(action: message => { UIThread.Execute(() => { PackageEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <PoolKernelEditCommand>(action: message => { UIThread.Execute(() => { PoolKernelEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <PoolEditCommand>(action: message => { UIThread.Execute(() => { PoolEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <ShowControlCenterHostConfigCommand>(action: message => { UIThread.Execute(() => { ControlCenterHostConfig.ShowWindow(); }); }); VirtualRoot.BuildCmdPath <SysDicItemEditCommand>(action: message => { UIThread.Execute(() => { SysDicItemEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <SysDicEditCommand>(action: message => { UIThread.Execute(() => { SysDicEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <UserEditCommand>(action: message => { UIThread.Execute(() => { UserEdit.ShowWindow(message.FormType, message.Source); }); }); VirtualRoot.BuildCmdPath <WalletEditCommand>(action: message => { UIThread.Execute(() => { WalletEdit.ShowWindow(message.FormType, message.Source); }); }); }
private MinerProfileViewModel() { if (NTMinerRoot.IsInDesignMode) { return; } this.CustomTheme = new DelegateCommand(() => { LogColor.ShowWindow(); }); Global.Access <Per1SecondEvent>( Guid.Parse("479A35A1-5A5A-48AF-B184-F1EC568BE181"), "挖矿计时秒表", LogEnum.None, action: message => { var mineContext = NTMinerRoot.Current.CurrentMineContext; if (mineContext != null) { this.MineTimeSpan = DateTime.Now - mineContext.CreatedOn; } OnPropertyChanged(nameof(MineStatusText)); }); Global.Access <MinerProfilePropertyChangedEvent>( Guid.Parse("00F1C9F7-ADC8-438D-8B7E-942F6EE5F9A4"), "MinerProfile设置变更后刷新VM内存", LogEnum.Log, action: message => { OnPropertyChanged(message.PropertyName); }); Global.Access <MineWorkPropertyChangedEvent>( Guid.Parse("7F96F755-E292-4146-9390-75635D150A4B"), "MineWork设置变更后刷新VM内存", LogEnum.Log, action: message => { OnPropertyChanged(message.PropertyName); }); Global.Access <MineStartedEvent>( Guid.Parse("36B6B69F-37E3-44BE-9CA9-20D6764E7058"), "挖矿开始后刷新MinerProfileVM的IsMinig属性", LogEnum.None, action: message => { this.OnPropertyChanged(nameof(this.IsMining)); }); Global.Access <MineStopedEvent>( Guid.Parse("C4C1308A-1C04-4094-91A2-D11993C626A0"), "挖矿停止后刷新MinerProfileVM的IsMinig属性", LogEnum.None, action: message => { this.OnPropertyChanged(nameof(this.IsMining)); }); Global.Access <RefreshArgsAssemblyCommand>( Guid.Parse("4931C5C3-178F-4867-B615-215F0744C1EB"), "刷新参数总成", LogEnum.Log, action: cmd => { this.OnPropertyChanged(nameof(this.ArgsAssembly)); }); System.Timers.Timer t = new System.Timers.Timer(100); t.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { if (this._logoRotateTransformAngle > 3600000) { this._logoRotateTransformAngle = 0; } this.LogoRotateTransformAngle += 50; }; Global.Access <MineStartedEvent>( Guid.Parse("D8CC83D6-B9B5-4739-BD66-0F772A22BBF8"), "挖矿开始后将风扇转起来", LogEnum.None, action: message => { t.Start(); OnPropertyChanged(nameof(GpuStateColor)); }); Global.Access <MineStopedEvent>( Guid.Parse("0BB360E4-92A6-4629-861F-B3E4C9BE1203"), "挖矿停止后将风扇停转", LogEnum.None, action: message => { t.Stop(); OnPropertyChanged(nameof(GpuStateColor)); }); if (CommandLineArgs.IsWorker) { Server.ProfileService.GetMineWork(CommandLineArgs.WorkId, mineWorkData => { if (mineWorkData != null) { this.MineWork = mineWorkData; } }); } }