private void QuitButton_Click(object sender, EventArgs e) { try { Program.gameController.QuitGame(_state.GetValue().id, Program.infoController.profile.id); ExitGame(); } catch (FaultException <PlayerNotInSpecifiedGameFault> ) { UpdateTimer.Enabled = false; MessageBox.Show("Player not in specified game!"); ExitGame(); } catch (FaultException <EmptyResultsFault> ) { UpdateTimer.Enabled = false; MessageBox.Show("Game is not available!"); ExitGame(); } catch (CommunicationException) { UpdateTimer.Enabled = false; MessageBox.Show("Unable to connect to server!\nPlease try again Later."); BackButton.Show(); } catch (Exception ex) { UpdateTimer.Enabled = false; MessageBox.Show("Unforseen error!, " + ex.Message); BackButton.Show(); } }
public TestSceneBackButton() { Child = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(300), Masking = true, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.SlateGray }, button = new BackButton { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Action = () => button.Hide(), } } }; AddStep("show button", () => button.Show()); AddStep("hide button", () => button.Hide()); }
private void PlayerMove(MovePosition move) { try { Program.gameController.PlayerMove( _state.GetValue().id, Program.infoController.profile.id, move); } catch (FaultException <WaitingForPlayersFault> ) { MessageBox.Show("Waiting for an opponent!"); } catch (FaultException <GameIsOverFault> ) { UpdateTimer.Enabled = false; MessageBox.Show("Game is over!"); BackButton.Show(); } catch (FaultException <PlayerNotInSpecifiedGameFault> ) { UpdateTimer.Enabled = false; MessageBox.Show("Not in game!"); ExitGame(); } catch (FaultException <NotPlayersTurnFault> ) { MessageBox.Show("Not Your Turn!"); } catch (FaultException <InvalidPlayerMoveFault> ) { MessageBox.Show("Bad Move!"); } catch (FaultException <EmptyResultsFault> ) { UpdateTimer.Enabled = false; MessageBox.Show("Game not found!"); ExitGame(); } catch (CommunicationException) { UpdateTimer.Enabled = false; MessageBox.Show("Unable to connect to server!\nPlease try again Later."); BackButton.Show(); } catch (Exception ex) { UpdateTimer.Enabled = false; MessageBox.Show("Unforseen error!, " + ex.Message); BackButton.Show(); } }
// Håndtere klikket i tabelen der skifter til visning af stræk private void DataTable_CellClick(object sender, DataGridViewCellEventArgs e) { if (!isLeg) { for (int i = 0; i < Legs.Count; i++) { if (i == e.ColumnIndex - headers) { DataTable.ColumnCount = headers; isLeg = true; Put_Data(Legs[i]); BackButton.Show(); } } } }
protected void OnAddButtonClicked(object sender, EventArgs e) { DoneLabel.Hide(); NameLabel.Show(); NameBox.Show(); TypeLabeld.Show(); Typebox.Show(); OwnerLabel.Show(); OwnerBox.Show(); AddButton.Hide(); ViewButton.Hide(); BackButton.Show(); DoneButton.Show(); HoursBox.Show(); HoursLabel.Show(); }
//Shows Converter Menu private void ShowConverter() { //Show the converter menu's controls and labels CategoryLabel.Show(); CategoryComboBox.Show(); InstructionLabel.Show(); ValueOfLabel.Show(); UserInputTextBox.Show(); FromLabel.Show(); InitialUnitsComboBox.Show(); ToLabel.Show(); ResultingUnitsComboBox.Show(); BackButtonLabel.Show(); BackButton.Show(); DividerLabel.Show(); UserInputTextBox.Focus(); }
private void TicTacToePage_Load(object sender, EventArgs e) { try { Program.gameController.JoinGame(GameType.TicTacToe, Program.infoController.profile.id); _state.Subscribe(Program.gameController.gameState); } catch (CommunicationException) { UpdateTimer.Enabled = false; MessageBox.Show("Unable to connect to server!\nPlease try again Later."); BackButton.Show(); } catch (Exception ex) { UpdateTimer.Enabled = false; MessageBox.Show("Unforseen error!, " + ex.Message); BackButton.Show(); } }
private void ExcuseButton_Click(object sender, EventArgs e) { if (Count > 0) { BackBox.Items.Insert(0, ExcuseText.Text); BackBox.EndUpdate(); } ExcuseNotification.ForeColor = Color.BlanchedAlmond; ExcuseNotification.Text = "Excuse #" + (Settings.Default.CurrentExcuse + 1).ToString() + "/" + TotExcuses; CopyButton.Show(); SendToEmail.Show(); BackButton.Show(); ForwardButton.Show(); string excuse = getExcuse(); ExcuseText.Text = excuse; Count += 1; ForwardBox.Items.Clear(); ForwardBox.EndUpdate(); }
//Overrided method accepting a category parameter obtained from menu selection private void ShowConverter(String category) { //Shows the converter menu's controls and labels CategoryLabel.Show(); CategoryComboBox.Show(); InstructionLabel.Show(); ValueOfLabel.Show(); UserInputTextBox.Show(); FromLabel.Show(); InitialUnitsComboBox.Show(); ToLabel.Show(); ResultingUnitsComboBox.Show(); ConvertSubmissionButton.Show(); BackButtonLabel.Show(); BackButton.Show(); DividerLabel.Show(); //Selects the category field in the converter CategoryComboBox.SelectedIndex = CategoryComboBox.FindStringExact(category); //Shows the default units of measurement ShowDefaultUnits(category); UserInputTextBox.Focus(); }
protected virtual void ScreenChanged(IScreen current, IScreen newScreen) { switch (newScreen) { case IntroScreen intro: introScreen = intro; break; case MainMenu menu: menuScreen = menu; break; } if (newScreen is IOsuScreen newOsuScreen) { OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode; if (newOsuScreen.HideOverlaysOnEnter) { CloseAllOverlays(); } else { Toolbar.Show(); } if (newOsuScreen.AllowBackButton) { BackButton.Show(); } else { BackButton.Hide(); } } }
private void UpdateState() { try { Program.gameController.UpdateMatchState(_state.GetValue().id); } catch (FaultException <EmptyResultsFault> ) { MessageBox.Show("Empty Results!"); ExitGame(); } catch (CommunicationException) { UpdateTimer.Enabled = false; MessageBox.Show("Unable to connect to server!\nPlease try again Later."); BackButton.Show(); } catch (Exception ex) { UpdateTimer.Enabled = false; MessageBox.Show("Unforseen error!, " + ex.Message); BackButton.Show(); } }
/// <summary> /// Realiza la navegación al siguiente Panel T, transmitiéndole información /// para su inicialización. /// </summary> /// <typeparam name="T">Tipo del Panel.</typeparam> /// <param name="data">Información a enviar al Panel durante su inicialización.</param> /// <returns>Devuelve la instancia del nuevo Panel, ya inicializado.</returns> public T NextPanel <T>() where T : UserControl { // Revisar si es necesaio un Invoke. if (InvokeRequired) { return((T)Invoke( new Func <UserControl>(() => NextPanel <T>()) )); } UserControl nextPanel = null; UserControl currentPanel = null; var initializePanel = false; var hidePreviousButton = false; if (m_currentPanelNode == null || m_currentPanelNode.Value == null) { // Insertar el nuevo Panel como primer elemento de la lista. nextPanel = Activator.CreateInstance <T>() as UserControl; m_currentPanelNode = m_panelHistory.AddFirst(nextPanel); initializePanel = true; hidePreviousButton = true; } else { currentPanel = m_currentPanelNode.Value; if (m_currentPanelNode.Next == null || m_currentPanelNode.Next.Value == null || !(m_currentPanelNode.Next.Value is T)) { // Insertar el nuevo Panel como el siguiente del Panel actual. nextPanel = Activator.CreateInstance <T>() as UserControl; m_currentPanelNode = m_panelHistory.AddAfter(m_currentPanelNode, nextPanel); initializePanel = true; } else { // Navegar al siguiente Panel que ya se encuentra en memoria. m_currentPanelNode = m_currentPanelNode.Next; nextPanel = m_currentPanelNode.Value; } } Trace.WriteLine("Panel switch [>] " + nextPanel.ToString()); // Mostrar u ocultar el botón Atrás según sea necesario. if (nextPanel is Panels.IPanelNoBackButton || hidePreviousButton) { BackButton.Hide(); } else { BackButton.Show(); } // Preparar las animaciones de los Paneles. nextPanel.Parent = MainPanel; nextPanel.Top = 0; nextPanel.Left = nextPanel.Width + 30; nextPanel.Enabled = true; nextPanel.CreateControl(); nextPanel.Show(); nextPanel.BringToFront(); var animateNext = new EventHandler((Object s1, EventArgs e1) => { MainPanel.StopAnimation("Height", "Width"); if (nextPanel.Width != MainPanel.Width) { MainPanel.AnimateProperty <Animation.EaseInOutBack>("Width", nextPanel.Width); } MainPanel.AnimateProperty <Animation.EaseInOutBack>("Height", nextPanel.Height).AnimationFinished += (Object s2, EventArgs e2) => { nextPanel.AnimateProperty <Animation.EaseInOutElastic>("Left", 0).AnimationFinished += (Object s3, EventArgs e3) => { // Inicializar el siguiente Panel si es necesario. if (initializePanel) { nextPanel.SizeChanged += Panel_SizeChanged; } if (initializePanel && nextPanel is Panels.IPanelInitialize) { (nextPanel as Panels.IPanelInitialize).Initialize(); } // Ejecutar el evento de navegación en el Panel anterior. if (currentPanel is Panels.IPanelNextEvent) { (currentPanel as Panels.IPanelNextEvent).OnNextPanelNavigation(); } }; }; }); if (currentPanel == null) { animateNext(null, null); } else { var animator = currentPanel.GetCurrentAnimator("Left"); currentPanel.Enabled = false; nextPanel.Left = (currentPanel.Left > 0 ? CurrentPanel.Left : 0) + currentPanel.Width + 30; if (animator == null) { animator = currentPanel.AnimateProperty <Animation.EaseInOutElastic>("Left", -currentPanel.Width); animator.AnimationFinished += animateNext; } else { animator.AnimationFinished += (Object s2, EventArgs e2) => currentPanel.AnimateProperty <Animation.EaseInOutElastic>("Left", -currentPanel.Width).AnimationFinished += animateNext; } } return((T)nextPanel); }
/// <summary> /// Realiza la navegación al Panel anterior. /// </summary> /// <returns>Devuelve la instancia del Panel anterior.</returns> public UserControl PreviousPanel() { // Revisar si es necesaio un Invoke. if (InvokeRequired) { return((UserControl)Invoke( new Func <UserControl>(() => PreviousPanel()) )); } if (m_currentPanelNode == null || m_currentPanelNode.Value == null) { throw new InvalidOperationException("There is exactly NO f*****g panels in history."); } if (m_currentPanelNode.Previous == null || m_currentPanelNode.Previous.Value == null) { throw new InvalidOperationException("There is no panel to go back to."); } UserControl currentPanel = m_currentPanelNode.Value; UserControl previousPanel = m_currentPanelNode.Previous.Value; m_currentPanelNode = m_currentPanelNode.Previous; Trace.WriteLine("Panel switch [<] " + previousPanel.ToString()); // Mostrar u ocultar el botón Atrás según sea necesario. if (previousPanel is Panels.IPanelNoBackButton || m_currentPanelNode.Previous == null) { BackButton.Hide(); } else { BackButton.Show(); } // Preparar las animaciones de los Paneles. previousPanel.Left = -previousPanel.Width; previousPanel.Enabled = true; previousPanel.CreateControl(); previousPanel.Show(); previousPanel.BringToFront(); currentPanel.Enabled = false; var animateNext = new EventHandler((Object s1, EventArgs e1) => { MainPanel.StopAnimation("Height", "Width"); MainPanel.AnimateProperty <Animation.EaseInOutBack>("Width", previousPanel.Width); MainPanel.AnimateProperty <Animation.EaseInOutBack>("Height", previousPanel.Height).AnimationFinished += (Object s2, EventArgs e2) => { previousPanel.AnimateProperty <Animation.EaseInOutElastic>("Left", 0).AnimationFinished += (Object s3, EventArgs e3) => { // Ejecutar el evento de navegación en el Panel anterior. if (currentPanel is Panels.IPanelPreviousEvent) { (currentPanel as Panels.IPanelPreviousEvent).OnPreviousPanelNavigation(); } }; }; }); var animator = currentPanel.GetCurrentAnimator("Left"); var currentPanelOffset = (currentPanel.Width > previousPanel.Width ? currentPanel.Width : previousPanel.Width) + 30; if (animator == null) { animator = currentPanel.AnimateProperty <Animation.EaseInOutElastic>("Left", currentPanelOffset); animator.AnimationFinished += animateNext; } else { animator.AnimationFinished += (Object s2, EventArgs e2) => currentPanel.AnimateProperty <Animation.EaseInOutElastic>("Left", currentPanelOffset).AnimationFinished += animateNext; } return(previousPanel); }
private void UpdateView() { if (_gameOver) { return; } UpdateState(); var match = _state.GetValue(); if (match.operationState == GameOperationState.WaitingForPlayers) { GameStatusLabel.Text = "Waiting for an opponent."; } else if (match.playerTurnId == Program.infoController.profile.id) { GameStatusLabel.Text = "Your Turn."; } else { GameStatusLabel.Text = "Opponents Turn."; } var board = new List <Button> { TopLeftButton, TopCenterButton, TopRightButton, MiddleLeftButton, MiddleCenterButton, MiddleRightButton, BottomLeftButton, BottomCenterButton, BottomRightButton, }; for (int i = 0; i < 9; i++) { var mark = match.inGameState.board[i]; if (mark == PlayerMark.X) { board[i].Text = "X"; } else if (mark == PlayerMark.O) { board[i].Text = "O"; } } if (match.operationState == GameOperationState.Completed) { _gameOver = true; UpdateTimer.Enabled = false; QuitButton.Hide(); if (match.winnerId == Program.infoController.profile.id) { MessageBox.Show("Congratulations you won!"); GameStatusLabel.Text = "You Won!"; } else { MessageBox.Show("Congratulations you lost!"); GameStatusLabel.Text = "You Lost!"; } BackButton.Show(); _state.Dispose(); } }