Exemplo n.º 1
0
 private void UserInputGetText()
 {
     UserInputText = UserInputTextBox.Text;
     UserInputTextBox.Clear();
     msg();
     //Send the message
     send(UserInputText);
 }
Exemplo n.º 2
0
        public override string GetPlayerName()
        {
            UserInputTextBox wizard = new UserInputTextBox("Please enter your name!");

            wizard.ShowDialog();
            string result = wizard.Value;

            wizard.Dispose();
            return(result);
        }
Exemplo n.º 3
0
 private void KeyDownComboBoxMethod(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         UserInputTextBox.Focus();
         InputCacheComboBox.IsDropDownOpen = false;
     }
     else if (e.Key != Key.Up && e.Key != Key.Down && e.Key != Key.Enter)
     {
         UserInputTextBox.Focus();
     }
 }
Exemplo n.º 4
0
 private void SelectionChangedMethod(object sender, SelectionChangedEventArgs e)
 {
     if ((sender as ComboBox).SelectedItem != null)
     {
         userUpdate                  = false;
         UserInputTextBox.Text       = (sender as ComboBox).SelectedItem.ToString();
         UserInputTextBox.CaretIndex = UserInputTextBox.Text.Length;
         UserInputTextBox.Focus();
         InputCacheComboBox.IsDropDownOpen = false;
         userUpdate = true;
     }
 }
        private void ClearFormToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UserInputTextBox.Clear();

            InitialValueLabel.Hide();
            InitialUnitsLabel.Hide();
            EqualsLabel.Hide();
            ResultingUnitsLabel.Hide();
            ResultingValueLabel.Hide();

            UserInputTextBox.Focus();
        }
Exemplo n.º 6
0
 private void KeyDownMethod(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Down)
     {
         FilterItems(string.Empty);
         InputCacheComboBox.IsDropDownOpen = true;
         InputCacheComboBox.Focus();
     }
     else if (e.Key == Key.Escape)
     {
         UserInputTextBox.Focus();
         InputCacheComboBox.IsDropDownOpen = false;
     }
 }
Exemplo n.º 7
0
        private void UserInputTextBox_GotFocus(object sender, RoutedEventArgs e)
        {
            userUpdate = true;

            if (!expanded && string.IsNullOrWhiteSpace(UserInputTextBox.Text))
            {
                FilterItems(UserInputTextBox.Text);
                if (suggestList.Count > 0)
                {
                    InputCacheComboBox.IsDropDownOpen = true;
                    UserInputTextBox.Focus();
                    expanded = true;
                }
            }
        }
        //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();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Triggered whenever the player clicks on the simulation to interact with the screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void canvasBox_Click(object sender, EventArgs e)
        {
            if (Game.IsRunning())
            {
                int count = Game.Click(PointToClient(Cursor.Position));
                if (count > 0)
                {
                    Game.IncreaseScore(count);
                }
                else //if (Game.Score == 0)
                {
                    Game.DecreaseLifeCount();
                    if (Game.IsOver())
                    {
                        Game.Stop();
                        if (!Game.CheckScore(Game.Score))
                        {
                            MessageBox.Show("Better luck next time!");
                        }
                        else
                        {
                            UserInputTextBox wizard = new UserInputTextBox("Please enter your name!", "You got a high score!");
                            wizard.ShowDialog();
                            Game.SaveScore(new HighScore(wizard.Value, Game.Score));
                        }

                        FireworkToolkit.Gaming.MainMenu menu = new FireworkToolkit.Gaming.MainMenu(Game);
                        menu.ShowDialog();
                        if (!Game.IsRunning())
                        {
                            Dispose();
                        }
                    }
                }

                /*
                 * else
                 *  Game.DecreaseScore();
                 */
            }
        }
        //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();
        }
 //Hides Converter Menu
 private void HideConverter()
 {
     CategoryLabel.Hide();
     CategoryComboBox.Hide();
     InstructionLabel.Hide();
     ValueOfLabel.Hide();
     UserInputTextBox.Hide();
     FromLabel.Hide();
     InitialUnitsComboBox.Hide();
     ToLabel.Hide();
     ResultingUnitsComboBox.Hide();
     ConvertSubmissionButton.Hide();
     BackButtonLabel.Hide();
     BackButton.Hide();
     DividerLabel.Hide();
     InitialValueLabel.Hide();
     InitialUnitsLabel.Hide();
     EqualsLabel.Hide();
     ResultingUnitsLabel.Hide();
     ResultingValueLabel.Hide();
     //When navigating back to the main menu its important to clear the field values for the ComboBoxes
     ClearUnitsComboBoxes();
 }
Exemplo n.º 12
0
 private void txtSelectSource_DoubleClick(object sender, EventArgs e)
 {
     UserInputTextBox.SelectAll();
 }
Exemplo n.º 13
0
 //событие при наведении пользователем мышкой на текстбокс очищает его
 private void UserInputTextBox_MouseEnter(object sender, MouseEventArgs e)
 {
     UserInputTextBox.Clear();
 }
Exemplo n.º 14
0
        //add to order button event handling
        private void AddToOrderButton_Click(object sender, EventArgs e)
        {
            //declaration
            int Identify;


            //gets the available stock for the choosen option
            AvailableStock = (StockList2DArray[GetMealSizeIndex, GetMealTypeIndex]);

            try
            {                              //tries to parse user input to an integer
                UserInputQuantity = int.Parse(UserInputTextBox.Text);
                if (UserInputQuantity > 0) //checks if the input is greater than zero
                {
                    //if what the user enters is equal to or less than the avalable stock
                    if (UserInputQuantity <= AvailableStock)
                    {
                        DisplayPrice.Text = (UserInputQuantity * Cost).ToString();

                        MealTypeChoosen.Add((MealTypeListBox.SelectedItem).ToString());
                        MealSizeChoosen.Add((MealSizeListBox.SelectedItem).ToString());
                        QuantityChoosen.Add(UserInputQuantity);
                        PriceOfChoice.Add(decimal.Parse(DisplayPrice.Text));



                        RunningTotal += UserInputQuantity * Cost;



                        TotalPriceLabel.Text = RunningTotal.ToString();

                        CompleteOrderButton.Enabled = true;
                        ClearButton.Enabled         = true;

                        //-------------------------------------
                        for (Identify = MealTypeChoosen.Count - 1; Identify != MealTypeChoosen.Count; Identify++)
                        {
                            OrderListBox.Items.Add(MealTypeChoosen.ElementAt(Identify) + "\t" + MealSizeChoosen.ElementAt(Identify) +
                                                   "\t" + QuantityChoosen.ElementAt(Identify) + "\t"
                                                   + Cost.ToString() + "\t" + PriceOfChoice.ElementAt(Identify).ToString("C"));


                            (StockList2DArray[GetMealSizeIndex, GetMealTypeIndex]) = AvailableStock - UserInputQuantity;// this should work else i am in for it
                        }
                        //OrderListBox.ClearSelected();


                        MealTypeListBox.SelectedIndex = -1;
                        MealSizeListBox.SelectedIndex = -1;
                        DisplayPrice.Text             = "";
                        UserInputTextBox.Text         = "";
                    }
                    else// if the user input doesn't meet the above conditions i.e, greater than the available stock
                    {
                        MessageBox.Show("the available stock is:" + AvailableStock, "Warning",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        UserInputTextBox.Text = AvailableStock.ToString();
                        UserInputTextBox.Focus();
                        UserInputTextBox.SelectAll();
                        DisplayPrice.Text = "";
                    }
                }
                else
                {
                    //if the user input is negative or inavlid
                    MessageBox.Show("Please enter a valid quantity", "Invalid input",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    UserInputTextBox.Focus();
                    UserInputTextBox.SelectAll();
                }
            }
            catch //if user input can't be parsed
            {
                MessageBox.Show("Please enter a quantity greater than 1", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                UserInputTextBox.Focus();
                UserInputTextBox.SelectAll();
            }
        }