private void spawnNode_Click(object sender, RoutedEventArgs e)
 {
     DrawNode(new Size(100, 50), (Color)ColorConverter.ConvertFromString("#FFf39204"), Mouse.GetPosition(canvas));
 }
Example #2
0
 // metodo para actualizar el Estado, cambia el texto a 'verdadero' o 'falso' y el color.
 public void status_update(bool state)
 {
     if (state == false)
     {
         PuestoState.Text       = "Inactivo";
         PuestoState.Foreground = Brushes.Red;
     }
     else if (state == true)
     {
         PuestoState.Text       = "Activo";
         PuestoState.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF2F70FE"));
     }
     else
     {
         PuestoState.Text = "Error";
     }
 }
 /// <summary>
 /// Called when player manually clicks on restart button or clicks on "OK" in the DecidePlayerTurn MessageBox.
 /// Clears the whole list and fills it with numbers from 0-8 again, clears content of all GameButtons and changes them to their default value.
 /// </summary>
 private void ClearBoard()
 {
     // Clear whole list in case of restart
     GameBoard.Clear();
     //Enables naming boxes for both players
     Player1Textbox.IsEnabled = true;
     Player2Textbox.IsEnabled = true;
     // Fill all indexes with numbers from 1 to 9 in ascending order, to make every index unlike each other and match their button's tag.
     for (int i = 0; i < 10; i++)
     {
         GameBoard.Add((i.ToString()));
         {
         }
         // Reset every GameButton to enable keyboard shortcuts and redesign text to default values.
         for (int j = 0; j < 9; j++)
         {
             GameButtons[j].FontSize   = 20.0;
             GameButtons[j].Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF05C46B"));
             GameButtons[j].Content    = ("_" + (j + 1));
         }
     }
     // Change current player image to their corresponding player
     if (CurrentPlayer % 2 != 0)
     {
         CurrentPlayerIcon.Foreground = new SolidColorBrush(Color.FromRgb(247, 54, 54));
         CurrentPlayerIcon.Content    = Player1;
     }
     else
     {
         CurrentPlayerIcon.Foreground = new SolidColorBrush(Color.FromRgb(101, 162, 247));
         CurrentPlayerIcon.Content    = Player2;
     }
 }