public MinerProfileDual() { this.DataContext = MinerProfileViewModel.Instance; InitializeComponent(); this.PopupDualCoinPool.Closed += Popup_Closed; this.PopupDualCoin.Closed += Popup_Closed; this.PopupDualCoinWallet.Closed += Popup_Closed; this.RunOneceOnLoaded((window) => { window.On <LocalContextVmsReInitedEvent>("本地上下文视图模型集刷新后刷新界面上的popup", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { if (Vm.MineWork != null) { return; } if (this.PopupDualCoinPool != null) { this.PopupDualCoinPool.IsOpen = false; OpenDualCoinPoolPopup(); } if (this.PopupDualCoin != null) { this.PopupDualCoin.IsOpen = false; OpenDualCoinPopup(); } if (this.PopupDualCoinWallet != null) { this.PopupDualCoinWallet.IsOpen = false; OpenDualCoinWalletPopup(); } }); }); }); }
public KernelsWindow() { InitializeComponent(); if (DevMode.IsDevMode) { this.Width += 600; } this.WindowContextEventPath <MineStopedEvent>("当内核宝库窗口开着时如果是本地手动停止的挖矿则引发UserActionEvent事件", LogEnum.DevConsole, action: message => { if (message.StopReason == StopMineReason.LocalUserAction) { VirtualRoot.RaiseEvent(new UserActionEvent()); } }); this.WindowContextEventPath <ServerContextVmsReInitedEvent>("ServerContext的Vm集刷新后刷新内核宝库", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { Vm.OnPropertyChanged(nameof(Vm.QueryResults)); }); }); AppContext.Instance.KernelVms.PropertyChanged += Current_PropertyChanged; NotiCenterWindow.Bind(this); if (!Vm.MinerProfile.IsMining) { VirtualRoot.RaiseEvent(new UserActionEvent()); } }
public void ShowMainWindow(bool isToggle) { UIThread.Execute(() => { if (_mainWindow == null) { lock (_locker) { if (_mainWindow == null) { _mainWindow = CreateMainWindow(); _mainWindow.Show(); // 激活从而切换NotiCenterWindow的Owner _mainWindow.Activate(); VirtualRoot.RaiseEvent(new MainWindowShowedEvent()); } } } else { AppContext.Enable(); bool needActive = _mainWindow.WindowState != WindowState.Minimized; _mainWindow.ShowWindow(isToggle); if (needActive) { _mainWindow.Activate(); } } }); }
public void ShowMainWindow(bool isToggle) { UIThread.Execute(() => { if (_mainWindow == null) { lock (_locker) { if (_mainWindow == null) { _mainWindow = CreateMainWindow(); Application.Current.MainWindow = _mainWindow; _mainWindow.Show(); AppContext.Enable(); NTMinerRoot.IsUiVisible = true; NTMinerRoot.MainWindowRendedOn = DateTime.Now; VirtualRoot.Happened(new MainWindowShowedEvent()); _mainWindow.Closed += (object sender, EventArgs e) => { NTMinerRoot.IsUiVisible = false; _mainWindow = null; }; } } } else { bool needActive = _mainWindow.WindowState != WindowState.Minimized; _mainWindow.ShowWindow(isToggle); if (needActive) { _mainWindow.Activate(); } } }); }
public static void ShowWindow() { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "管理本机 IP", IconName = "Icon_Ip", Width = 450, IsDialogWindow = true, FooterVisible = Visibility.Collapsed, CloseVisible = Visibility.Visible }, ucFactory: (window) => { var uc = new LocalIpConfig(); LocalIpConfigViewModel vm = (LocalIpConfigViewModel)uc.DataContext; vm.CloseWindow = window.Close; uc.ItemsControl.MouseDown += (object sender, MouseButtonEventArgs e) => { if (e.LeftButton == MouseButtonState.Pressed) { window.DragMove(); } }; window.WindowContextEventPath <LocalIpSetRefreshedEvent>("本机IP集刷新后刷新IP设置页", LogEnum.DevConsole, action: message => { UIThread.Execute(() => vm.Refresh()); }); return(uc); }, fixedSize: true); }
void InstancePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { UIThread.Execute(() => { if (e.PropertyName.Equals("AverageClientFps")) { var fps = PerformanceMonitor.CurrentInstance.AverageClientFps; FPS.Text = String.Format(" : {0}", double.IsNaN(fps)?"?": string.Format("{0:0}", fps)); } else if (e.PropertyName.Equals("AverageImageSize")) { AveImageSize.Text = String.Format(" : {0:0.0} KB", PerformanceMonitor.CurrentInstance.AverageImageSize / 1024); } else if (e.PropertyName.Equals("AverageMouseMoveMsgRTTWithResponse")) { double rtt = PerformanceMonitor.CurrentInstance.AverageMouseMoveMsgRTTWithResponse; AveRTT.Text = rtt > 1000 ? String.Format("{0:0.0} ms", rtt) : String.Format(" : {0:0.0} ms", PerformanceMonitor.CurrentInstance.AverageMouseMoveMsgRTTWithResponse); } else if (e.PropertyName.Equals("LastImageSize")) { LastImageSize.Text = String.Format(" : {0:0.0} KB", PerformanceMonitor.CurrentInstance.LastImageSize / 1024); } else if (e.PropertyName.Equals("SpeedInMbps")) { Speed.Text = PerformanceMonitor.CurrentInstance.SpeedInMbps > 0 ? String.Format(" : {0:0.0} Mpbs", PerformanceMonitor.CurrentInstance.SpeedInMbps) : "Unknown"; } }); }
private void KbNoButton_Click(object sender, RoutedEventArgs e) { if (Vm.OnNo != null) { if (Vm.IsConfirmNo && !Vm.NoText.StartsWith("请再点一次")) { string noText = Vm.NoText; TimeSpan.FromSeconds(4).Delay(perSecondCallback: n => { UIThread.Execute(() => { Vm.NoText = $"请再点一次({n.ToString()})"; }); }).ContinueWith(t => { UIThread.Execute(() => { Vm.NoText = noText; }); }); } else if (Vm.OnNo.Invoke()) { this.Close(); } } else { this.Close(); } }
private Calc() { InitializeComponent(); this.RunOneceOnLoaded(() => { var window = Window.GetWindow(this); window.On <CalcConfigSetInitedEvent>("收益计算器数据集刷新后刷新VM", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { foreach (var coinVm in Vm.CoinVms.AllCoins) { coinVm.CoinIncomeVm.Refresh(); } }); }); window.On <Per1MinuteEvent>("当收益计算器页面打开着的时候周期刷新", LogEnum.None, action: message => { if (Vm.CoinVms.AllCoins.Count == 0) { return; } if (Vm.CoinVms.AllCoins.Max(a => a.CoinIncomeVm.ModifiedOn).AddMinutes(10) < DateTime.Now) { NTMinerRoot.Instance.CalcConfigSet.Init(forceRefresh: true); } }); foreach (var coinVm in Vm.CoinVms.AllCoins) { coinVm.CoinIncomeVm.Refresh(); } }); }
private void KbOkButton_Click(object sender, RoutedEventArgs e) { if (_check != null) { string message = _check.Invoke(TbText.Text); if (string.IsNullOrEmpty(message)) { this.Close(); _onOk.Invoke(this.TbText.Text); } else { this.TbMessage.Text = message; this.TbMessage.Visibility = Visibility.Visible; 4.SecondsDelay().ContinueWith(t => { UIThread.Execute(() => () => { this.TbMessage.Text = string.Empty; this.TbMessage.Visibility = Visibility.Hidden; }); }); } } else { this.Close(); _onOk.Invoke(this.TbText.Text); } }
private void KbNoButton_Click(object sender, RoutedEventArgs e) { if (Vm.OnNo != null) { if (Vm.IsConfirmNo && !Vm.NoText.StartsWith("请再点一次")) { string noText = Vm.NoText; int n = 4; Vm.NoText = $"请再点一次({n.ToString()})"; this.AddViaTimesLimitPath <Per1SecondEvent>("倒计时'请再点一次'", LogEnum.None, message => { UIThread.Execute(() => () => { n--; Vm.NoText = $"请再点一次({n.ToString()})"; if (n == 0) { Vm.NoText = noText; } }); }, viaTimesLimit: n, this.GetType()); } else if (Vm.OnNo.Invoke()) { this.Close(); } } else { this.Close(); } }
private void Callback(IAsyncResult ar) { ScanArgs data = ((ScanArgs)ar.AsyncState); try { if (data.IsTimeouted) { return; } data.Set.Set(); if (!IsScanning) { return; } data.Soket.EndConnect(ar); UIThread.Execute(() => () => { _results.Add(new IpResult(data.Ip, this._selfIp)); }); } catch (Exception e) { Console.WriteLine(e.Message); } finally { data.Soket.Close(); int count = Interlocked.Increment(ref _count); Percent = count * 100 / data.Ips.Length; if (count == data.Ips.Length) { IsScanning = false; } } }
public static void Login(Action onLoginSuccess) { if (!IsLogined()) { UIThread.Execute(() => { var topWindow = WpfUtil.GetTopWindow(); LoginWindow window = new LoginWindow(onLoginSuccess); if (topWindow != null && topWindow.GetType() != typeof(NotiCenterWindow)) { window.Owner = topWindow; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; } window.Closing += (sender, e) => { if (IsLogined()) { onLoginSuccess?.Invoke(); } }; window.ShowSoftDialog(); window.PasswordFocus(); }); } else { onLoginSuccess?.Invoke(); } }
private void BtnLogin_OnClick(object sender, RoutedEventArgs e) { string passwordSha1 = HashUtil.Sha1(_vm.Password); Server.ControlCenterService.LoginAsync(_vm.LoginName, passwordSha1, (response, exception) => { UIThread.Execute(() => { if (response == null) { _vm.ShowMessage("服务器忙"); return; } if (response.IsSuccess()) { SingleUser.LoginName = _vm.LoginName; SingleUser.SetPasswordSha1(passwordSha1); this.DialogResult = true; this.Close(); } else if (_vm.LoginName == "admin" && response.StateCode == 404) { _vm.IsPasswordAgainVisible = Visibility.Visible; _vm.ShowMessage(response.Description); this.PbPasswordAgain.Focus(); } else { _vm.IsPasswordAgainVisible = Visibility.Collapsed; _vm.ShowMessage(response.Description); } }); }); }
private void OnApplicationStoppedEventReceived(ApplicationStoppedEvent applicationStoppedEvent) { try { UIThread.Execute(() => { if (ServerApplicationStopped != null) { ServerApplicationStopped(this, new ServerApplicationStopEventArgs { ServerEvent = applicationStoppedEvent }); } else { HandleCriticalError(applicationStoppedEvent.Message); } }); } finally { if (!Faulted) { _sender.Disconnect(SR.ApplicationHasStopped); } StopThreads(); } }
public KernelsWindow() { // 为了使设计视图的宽高生效以下几个属性的赋值挪到这里 Width = AppRoot.MainWindowWidth; Height = AppRoot.MainWindowHeight; MinHeight = 430; MinWidth = 640; InitializeComponent(); if (DevMode.IsDevMode) { this.Width += 600; } this.TbUcName.Text = nameof(KernelsWindow); this.AddEventPath <MineStopedEvent>("当内核宝库窗口开着时如果是本地手动停止的挖矿则引发UserActionEvent事件", LogEnum.DevConsole, action: message => { if (message.StopReason == StopMineReason.LocalUserAction) { VirtualRoot.RaiseEvent(new UserActionEvent()); } }, location: this.GetType()); this.AddEventPath <ServerContextVmsReInitedEvent>("ServerContext的Vm集刷新后刷新内核宝库", LogEnum.DevConsole, action: message => { UIThread.Execute(() => () => { Vm.OnPropertyChanged(nameof(Vm.QueryResults)); }); }, location: this.GetType()); AppRoot.KernelVms.PropertyChanged += Current_PropertyChanged; NotiCenterWindow.Bind(this); if (!Vm.MinerProfile.IsMining) { VirtualRoot.RaiseEvent(new UserActionEvent()); } }
public static void Close() { UIThread.Execute(delegate() { HtmlPage.Window.Eval("window.open('','_self');window.close();"); }); }
public static void ShowWindow() { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "管理本机 IP", IconName = "Icon_Ip", Width = 450, IsMaskTheParent = true, FooterVisible = Visibility.Collapsed, CloseVisible = Visibility.Visible }, ucFactory: (window) => { var uc = new LocalIpConfig(); window.AddOnecePath <CloseWindowCommand>("处理关闭窗口命令", LogEnum.DevConsole, action: message => { window.Close(); }, pathId: uc.Vm.Id, location: typeof(LocalIpConfig)); uc.ItemsControl.MouseDown += (object sender, MouseButtonEventArgs e) => { if (e.LeftButton == MouseButtonState.Pressed) { window.DragMove(); } }; window.AddEventPath <LocalIpSetInitedEvent>("本机IP集刷新后刷新IP设置页", LogEnum.DevConsole, action: message => { UIThread.Execute(() => uc.Vm.Refresh()); }, location: typeof(LocalIpConfig)); return(uc); }, fixedSize: true); }
private void BtnMinerClientFinder_Click(object sender, RoutedEventArgs e) { if (this.MinerClientFinderIcon.Visibility == Visibility.Visible) { Process process = Process.GetProcessesByName(NTKeyword.MinerClientFinderProcessName).FirstOrDefault(); if (process == null) { this.MinerClientFinderIcon.Visibility = Visibility.Collapsed; this.MinerClientFinderLoadingIcon.Visibility = Visibility.Visible; // 这里的逻辑是每100毫秒检查一次MinerClientFinder进程是否存在,每检查一次将loading图标 // 旋转30度,如果MinerClientFinder进程存在了或者已经检查了3秒钟了则停止检查。 VirtualRoot.SetInterval( per: TimeSpan.FromMilliseconds(100), perCallback: () => { UIThread.Execute(() => () => { ((RotateTransform)this.MinerClientFinderLoadingIcon.RenderTransform).Angle += 30; }); }, stopCallback: () => { UIThread.Execute(() => () => { this.MinerClientFinderIcon.Visibility = Visibility.Visible; this.MinerClientFinderLoadingIcon.Visibility = Visibility.Collapsed; ((RotateTransform)this.MinerClientFinderLoadingIcon.RenderTransform).Angle = 0; }); }, timeout: TimeSpan.FromSeconds(3), requestStop: () => { return(Process.GetProcessesByName(NTKeyword.MinerClientFinderProcessName).FirstOrDefault() != null); } ); } } }
private void Scan(string[] ipList) { if (ipList.Length != 0) { IsScanning = true; } _count = 0; Percent = 0; foreach (var ip in ipList) { Task.Factory.StartNew(() => { try { using (TcpClient client = new TcpClient(ip, 3337)) { if (client.Connected) { UIThread.Execute(() => { _results.Add(ip); }); } } } catch { } finally { Interlocked.Increment(ref _count); Percent = _count * 100 / ipList.Length; if (_count == ipList.Length) { IsScanning = false; } } }); } }
public UserPage() { if (WpfUtil.IsInDesignMode) { return; } this.Vm = new UserPageViewModel(); this.DataContext = this.Vm; InitializeComponent(); this.OnLoaded(window => { window.AddEventPath <Per20SecondEvent>("外网群控用户列表页面打开着时周期刷新", LogEnum.DevConsole, action: message => { Vm.Refresh(); }, this.GetType()); window.AddEventPath <UserEnabledEvent>("外网群控用户列表页面打开着时,用户启用后刷新Vm内存", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { var userVm = Vm.QueryResults.FirstOrDefault(a => a.LoginName == message.Source.LoginName); if (userVm != null) { userVm.IsEnabled = true; } }); }, this.GetType()); window.AddEventPath <UserDisabledEvent>("外网群控用户列表页面打开着时,用户禁用后刷新Vm内存", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { var userVm = Vm.QueryResults.FirstOrDefault(a => a.LoginName == message.Source.LoginName); if (userVm != null) { userVm.IsEnabled = false; } }); }, this.GetType()); }); }
public MinerProfileDual() { this.DataContext = MinerProfileViewModel.Instance; InitializeComponent(); this.OnLoaded((window) => { window.BuildEventPath <LocalContextReInitedEventHandledEvent>("本地上下文视图模型集刷新后刷新界面上的popup", LogEnum.DevConsole, path: message => { UIThread.Execute(() => { if (Vm.MineWork != null) { return; } if (this.PopupDualCoinPool.Child != null && this.PopupDualCoinPool.IsOpen) { OpenDualCoinPoolPopup(); } if (this.PopupDualCoin.Child != null && this.PopupDualCoin.IsOpen) { OpenDualCoinPopup(); } if (this.PopupDualCoinWallet.Child != null && this.PopupDualCoinWallet.IsOpen) { OpenDualCoinWalletPopup(); } }); }, location: this.GetType()); }); }
public void ShowMainWindow(Application app, NTMinerAppType appType) { try { switch (appType) { case NTMinerAppType.MinerClient: RpcRoot.Client.MinerClientService.ShowMainWindowAsync((isSuccess, exception) => { if (!isSuccess) { RestartNTMiner(); } UIThread.Execute(() => app.Shutdown()); }); break; case NTMinerAppType.MinerStudio: RpcRoot.Client.MinerStudioService.ShowMainWindowAsync((isSuccess, exception) => { if (!isSuccess) { RestartNTMiner(); } UIThread.Execute(() => app.Shutdown()); }); break; default: break; } } catch (Exception e) { RestartNTMiner(); Logger.ErrorDebugLine(e); } }
public StateBar() { InitializeComponent(); this.On <Per1SecondEvent>("挖矿计时秒表", LogEnum.None, action: message => { DateTime now = DateTime.Now; Vm.BootTimeSpan = now - NTMinerRoot.Instance.CreatedOn; if (NTMinerRoot.IsAutoStart && VirtualRoot.SecondCount <= 10 && !NTMinerRoot.IsAutoStartCanceled) { return; } var mineContext = NTMinerRoot.Instance.CurrentMineContext; if (mineContext != null) { Vm.MineTimeSpan = now - mineContext.CreatedOn; if (!Vm.MinerProfile.IsMining) { Vm.MinerProfile.IsMining = true; } } else { if (Vm.MinerProfile.IsMining) { Vm.MinerProfile.IsMining = false; } } }); this.On <ServerVersionChangedEvent>("发现了服务端新版本", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { if (NTMinerRoot.CurrentVersion.ToString() != NTMinerRoot.ServerVersion) { Vm.CheckUpdateForeground = new SolidColorBrush(Colors.Red); } else { Vm.CheckUpdateForeground = new SolidColorBrush(Colors.Black); } }); }); var gpuSet = NTMinerRoot.Instance.GpuSet; // 建议每张显卡至少对应4G虚拟内存,否则标红 if (NTMinerRoot.OSVirtualMemoryMb < gpuSet.Count * 4) { BtnShowVirtualMemory.Foreground = new SolidColorBrush(Colors.Red); } if (!gpuSet.Has20NCard()) { string nvDriverVersion = gpuSet.DriverVersion; double driverNum; if (double.TryParse(nvDriverVersion, out driverNum) && driverNum >= 400) { TextBlockDriverVersion.Foreground = new SolidColorBrush(Colors.Red); TextBlockDriverVersion.ToolTip = "如果没有20系列的N卡,挖矿建议使用3xx驱动。"; } } }
public StateBar() { InitializeComponent(); if (Design.IsInDesignMode) { return; } this.RunOneceOnLoaded((window) => { window.Activated += (object sender, EventArgs e) => { Vm.OnPropertyChanged(nameof(Vm.IsAutoAdminLogon)); Vm.OnPropertyChanged(nameof(Vm.AutoAdminLogonToolTip)); Vm.OnPropertyChanged(nameof(Vm.IsRemoteDesktopEnabled)); Vm.OnPropertyChanged(nameof(Vm.RemoteDesktopToolTip)); }; window.WindowContextEventPath <LocalIpSetRefreshedEvent>("本机IP集刷新后刷新状态栏", LogEnum.DevConsole, action: message => { UIThread.Execute(() => Vm.RefreshLocalIps()); }); window.WindowContextEventPath <MinutePartChangedEvent>("时间的分钟部分变更过更新计时器显示", LogEnum.None, action: message => { Vm.UpdateDateTime(); }); window.WindowContextEventPath <Per1SecondEvent>("挖矿计时秒表", LogEnum.None, action: message => { DateTime now = DateTime.Now; Vm.UpdateBootTimeSpan(now - NTMinerRoot.Instance.CreatedOn); var mineContext = NTMinerRoot.Instance.CurrentMineContext; if (mineContext != null) { Vm.UpdateMineTimeSpan(now - mineContext.CreatedOn); } }); window.WindowContextEventPath <AppVersionChangedEvent>("发现了服务端新版本", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { Vm.SetCheckUpdateForeground(isLatest: MainAssemblyInfo.CurrentVersion >= NTMinerRoot.ServerVersion); }); }); window.WindowContextEventPath <KernelSelfRestartedEvent>("内核自我重启时刷新计数器", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { Vm.OnPropertyChanged(nameof(Vm.KernelSelfRestartCountText)); }); }); window.WindowContextEventPath <MineStartedEvent>("挖矿开始后将内核自我重启计数清零", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { Vm.OnPropertyChanged(nameof(Vm.KernelSelfRestartCountText)); }); }); }); var gpuSet = NTMinerRoot.Instance.GpuSet; // 建议每张显卡至少对应4G虚拟内存,否则标红 if (NTMinerRoot.OSVirtualMemoryMb < gpuSet.Count * 4) { BtnShowVirtualMemory.Foreground = WpfUtil.RedBrush; } }
private void OnSessionUpdated(object sender, ServerEventArgs ev) { UIThread.Execute(() => { var @event = ev.ServerEvent as SessionUpdatedEvent; ApplicationBridge.Current.OnViewerSessionUpdated(this, @event); }); }
private void PopUpgrade_Closed(object sender, EventArgs e) { TimeSpan.FromMilliseconds(100).Delay().ContinueWith(t => { UIThread.Execute(() => () => { MenuItemUpgrade.Visibility = Visibility.Visible; }); }); }
private void PopupMineWork_Closed(object sender, System.EventArgs e) { TimeSpan.FromMilliseconds(100).Delay().ContinueWith(t => { UIThread.Execute(() => () => { MenuItemMineWork.Visibility = Visibility.Visible; }); }); }
public static void ShowSuccessMessage(this INotificationMessageManager manager, string message) { UIThread.Execute(() => { var builder = NotificationMessageBuilder.CreateMessage(manager); builder.Success(message) .Dismiss() .WithDelay(TimeSpan.FromSeconds(4)) .Queue(); }); }
private void MenuItemUpgrade_Click(object sender, RoutedEventArgs e) { RpcRoot.OfficialServer.FileUrlService.GetNTMinerFilesAsync(NTMinerAppType.MinerClient, (ntMinerFiles, ex) => { UIThread.Execute(() => { Vm.NTMinerFileList = (ntMinerFiles ?? new List <NTMinerFileData>()).OrderByDescending(a => a.GetVersion()).ToList(); }); }); PopUpgrade.IsOpen = !PopUpgrade.IsOpen; }
public StateBar() { InitializeComponent(); this.RunOneceOnLoaded(() => { var window = Window.GetWindow(this); window.On <Per1SecondEvent>("挖矿计时秒表", LogEnum.None, action: message => { DateTime now = DateTime.Now; Vm.BootTimeSpan = now - NTMinerRoot.Instance.CreatedOn; if (NTMinerRoot.IsAutoStart && VirtualRoot.SecondCount <= 10 && !NTMinerRoot.IsAutoStartCanceled) { return; } var mineContext = NTMinerRoot.Instance.CurrentMineContext; if (mineContext != null) { Vm.MineTimeSpan = now - mineContext.CreatedOn; if (!Vm.MinerProfile.IsMining) { Vm.MinerProfile.IsMining = true; } } else { if (Vm.MinerProfile.IsMining) { Vm.MinerProfile.IsMining = false; } } }); window.On <Per10SecondEvent>("周期轮播挖状态栏的矿信息和公告信息", LogEnum.None, action: message => { if (Vm.IsNoticeVisible == Visibility.Visible) { Vm.IsNoticeVisible = Visibility.Collapsed; } else { Vm.IsNoticeVisible = Visibility.Visible; } }); window.On <ServerVersionChangedEvent>("发现了服务端新版本", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { if (NTMinerRoot.CurrentVersion.ToString() != NTMinerRoot.ServerVersion) { Vm.CheckUpdateForeground = new SolidColorBrush(Colors.Red); } else { Vm.CheckUpdateForeground = new SolidColorBrush(Colors.Black); } }); }); }); }