private void PopulateCurrentStatus() { try { DashboardModuleInfo dashInfo = _dashboardClient.PopulateContent(_ip); dashInfoDbg = dashInfo; _lastConnectionTime = DateTime.Now; System.Diagnostics.Debug.WriteLine("New Status In " + _lastConnectionTime.ToString()); if (dashInfo.LiveClientStatus == EnumsLiveClientStatus.GAMEOVER_FOR_CLEANING) { this.InvokeUI(() => { ShowWaitingCleaning(); }); } else if (dashInfo.LiveClientStatus == EnumsLiveClientStatus.CLEANING_DONE) { _tutorialShowed = false; this.InvokeUI(() => { ShowReady(); }); } else if (dashInfo.LiveClientStatus == EnumsLiveClientStatus.IN_GAME || dashInfo.LiveClientStatus == EnumsLiveClientStatus.IN_GAME_SELECTOR) { if (dashInfo.IsRequireAssistant) { this.InvokeUI(() => { ShowHelpRequested(dashInfo.CurrentRunningTitle); }); } else { this.InvokeUI(() => { ShowUsing(); }); } } else { this.InvokeUI(() => { HideAll(); _currWindowState = CurrentWindowState.None; }); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error in PopulateCurrentStatus: " + ex.ToString()); } }
private void ShowWaitingCleaning() { if (_currWindowState != CurrentWindowState.Cleaning) { _currWindowState = CurrentWindowState.Cleaning; HideAll(); tableLayoutPanelWaitingCleaning.Dock = DockStyle.Fill; tableLayoutPanelWaitingCleaning.Visible = true; BackgroundImage = Properties.Resources._3; } }
private void ShowReady() { if (_currWindowState != CurrentWindowState.Ready) { _currWindowState = CurrentWindowState.Ready; HideAll(); tableLayoutPanelReady.Dock = DockStyle.Fill; tableLayoutPanelReady.Visible = true; BackgroundImage = Properties.Resources.HTC; } }
private void ShowInstVideo() { if (_currWindowState != CurrentWindowState.InstVideo) { _currWindowState = CurrentWindowState.InstVideo; HideAll(); tableLayoutPanelInstVideo.Dock = DockStyle.Fill; tableLayoutPanelInstVideo.Visible = true; BackgroundImage = Properties.Resources._2; } }
private void ShowHelpRequested(string gameInfo) { if (_currWindowState != CurrentWindowState.HelpRequested) { _currWindowState = CurrentWindowState.HelpRequested; HideAll(); tableLayoutPanelHelpRequest.Dock = DockStyle.Fill; tableLayoutPanelHelpRequest.Visible = true; BackgroundImage = Properties.Resources._0; labelHelpRequestCurrentPlaying.Text = gameInfo; } }
private void ShowUsing() { if (!_tutorialShowed) { ShowInstVideo(); } else { if (_currWindowState != CurrentWindowState.Using) { _currWindowState = CurrentWindowState.Using; HideAll(); tableLayoutPanelUsing.Dock = DockStyle.Fill; tableLayoutPanelUsing.Visible = true; BackgroundImage = Properties.Resources._1; } } }
private void OnTimer2sEvent(object sender, ElapsedEventArgs e) { PopulateCurrentStatus(); if (_currWindowState != CurrentWindowState.None) { if (DateTime.Now.Subtract(_lastConnectionTime).Seconds > 10) { this.InvokeUI(() => { HideAll(); _currWindowState = CurrentWindowState.None; }); } } else { this.InvokeUI(() => { SetDefaultLable(); }); } }