Example #1
0
 private void ResetTextButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     CopyToBufferButton.Enabled = false;
     ActiveControl = InputTextBox;
 }
Example #2
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     arrayLengthLabel.Text = "Длина массива:";
     timeSortLabel.Text    = "Время работы сортировки:";
 }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RandomButton_Click(object sender, EventArgs e)
        {
            InputTextBox.Clear();
            OutputTextBox.Clear();
            TimeBox.Clear();
            CountText.Clear();

            int    n    = rnd.Next(2, 20);
            int    k    = rnd.Next(1, n);
            string line = null;

            for (int i = 0; i < k; i++)
            {
                int temp1 = rnd.Next(1, n);
                int temp2 = rnd.Next(1, n);
                if (temp1 != temp2)
                {
                    line += temp1 + " " + temp2 + "\n";
                    i++;
                }
            }
            if (line != null)
            {
                InputTextBox.Text = line.Trim();
            }
            CountText.Text = n + " " + k;
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ClearButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     TimeBox.Clear();
     CountText.Clear();
 }
Example #5
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            password = InputTextBox.Password;
            if (handler.authenticateAdmin(password) == 1)
            {
                Page page = null;
                switch (clicked)
                {
                case 1:
                    page = new AddJelo(service);
                    break;

                case 2:
                    page = new Vozilo(service);
                    break;

                case 3:
                    page = new AddVozac(service);
                    break;
                }
                password = null;
                NavigationService.Navigate(page);
            }
            else
            {
                MessageBoxResult box = MessageBox.Show("Netačna administratorska lozinka!");
                password = null;
                InputTextBox.Clear();
            }
            InputBox.Visibility = Visibility.Collapsed;
        }
        private void InputTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            Round round = new Round();

            round.Spin = AllRounds.Count() + 1;

            if (e.Key == Key.Enter)
            {
                if (InputValueAllowed())
                {
                    byte currentNumber = byte.Parse(InputTextBox.Text);

                    foreach (Number number in AllRouletteNumbers)
                    {
                        if (currentNumber == number.Digit)
                        {
                            round = UserInputHandler.EnterNumber(currentNumber, round, this);
                        }
                    }

                    AllRounds.Add(round);

                    NumberLogic.UpdateNumberProperties(currentNumber, this);
                    UserInputHandler.CheckIfUserHasWon(round, this);
                }

                InputTextBox.Clear();
                CascadeTextboxes();
                DisplayCurrentRound(round);

                tickSound.Play();
            }
        }
 /// <summary>
 /// EventHandler for Num_Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Num_Click(object sender, EventArgs e)
 {
     if ((InputTextBox.Text == "0") || OperatorPressed || EqualsPressed)
     {
         InputTextBox.Clear();
     }
     else /*doNothing();*/ } {
 private void InputTextBox_TextChanged(object sender, EventArgs e)
 {
     if (InputTextBox.Text != "" && Convert.ToInt32(InputTextBox.Text) == 0)
     {
         InputTextBox.Clear();
     }
 }
Example #9
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (InputTextBox.Text == String.Empty)
            {
                return;                                    //Abort if there is no input
            }
            try
            {
                //Try to get the absolute value from the input field
                double inputSum = Math.Abs(double.Parse(InputTextBox.Text));

                //Depending on the type of input, increase income or spent money on main window
                if (isIncome)
                {
                    parent.IncomeText.Text = (double.Parse(parent.IncomeText.Text) + inputSum).ToString("0.00");
                }
                else
                {
                    parent.SpentText.Text = (double.Parse(parent.SpentText.Text) - inputSum).ToString("0.00");
                }

                parent.UpdateText();
                this.Close();
            } catch
            {
                //If the user gave wrong input, tell him how to make correct input
                MessageBox.Show("The given input is not a correct amount. Please only use numbers and one point or comma!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                InputTextBox.Clear();
            }
        }
Example #10
0
        private void UpdateDisplay()
        {
            String input = InputTextBox.Text;

            DisplayBox.Text = DisplayBox.Text + input + "\n\n";
            DisplayBox.ScrollToEnd();
            InputTextBox.Clear();
        }
Example #11
0
 //очистить текстбоксы
 private void ClearButton_Click(object sender, EventArgs e)
 {
     TextBox.Clear();
     InputTextBox.Clear();
     PlusButton.Enabled          = MinusButton.Enabled = MultiplyButton.Enabled = DivideButton.Enabled = SinButton.Enabled =
         CosButton.Enabled       = TgButton.Enabled = CtgButton.Enabled = button0.Enabled = button1.Enabled = button2.Enabled =
             button3.Enabled     = button4.Enabled = button5.Enabled = button6.Enabled = button7.Enabled = button8.Enabled =
                 button9.Enabled = DegreeButton.Enabled = MunuteButton.Enabled = SecondButton.Enabled = true;
 }
 private void InputTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         e.Handled = true;
         OutputTextBox.ScrollToEnd();
         InputTextBox.Clear();
     }
 }
Example #13
0
        //Reset Button

        private void button2_Click(object sender, EventArgs e)
        {
            InputTextBox.Clear();
            OutputTextBox.Clear();
            FahrenheitToCelciusRadioButton.Checked = false;
            CelciusToFahrenheitRadioButton.Checked = false;
            CelciusToKelvinRadioButton.Checked     = false;
            KelvinToCelciusRadioButton.Checked     = false;
            FahrenheitToKelvinRadioButton.Checked  = false;
        }
Example #14
0
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            CurrentAnswer.Value = InputTextBox.Text;
            if (String.IsNullOrEmpty(CurrentAnswer.Value))
            {
                Rule newRule = GetNextRule(Targets.Peek());
                WorkWithNewRule(newRule);
            }
            else
            {
                Context.Add(new Property(CurrentAnswer.Key, CurrentAnswer.Value));
                Logger.Info(CurrentAnswer.Key + " - " + CurrentAnswer.Value + " : помещены в контекстный стек");
                Targets.Pop();
                Rule currentRule = GetNextRule(Targets.Peek());
                if (currentRule == null)
                {
                    Flag = true;
                }
                else if (GetNextVerifiableProperty(currentRule) != null)
                {
                    Targets.Push(GetNextVerifiableProperty(currentRule).Key);
                    Logger.Info(GetNextVerifiableProperty(currentRule).Key + " : помещена в стек целей");
                    CurrentAnswer.Key        = GetNextVerifiableProperty(currentRule).Key;
                    PropertyKeyLabel.Content = Char.ToUpper(CurrentAnswer.Key[0]) + CurrentAnswer.Key.Substring(1) + ":";
                    InputTextBox.Clear();
                }
                else
                {
                    Context.Add(new Property(currentRule.Target.Key, currentRule.Target.Value));
                    Logger.Info(currentRule.Target.Key + " - " + currentRule.Target.Value + " : сделан вывод");
                    Targets.Pop();
                    if (Targets.Any())
                    {
                        Rule newRule = GetNextRule(Targets.Peek());
                        WorkWithNewRule(newRule);
                    }
                    else
                    {
                        Flag = true;
                    }
                }
            }

            if (Flag)
            {
                if (Context.Select(x => x.Key).Contains(MainTarget))
                {
                    AnswerLabel.Content = MainTarget + " - " + Context.First(x => x.Key == MainTarget).Value;
                }
                else
                {
                    AnswerLabel.Content = "Ответа нет.";
                }
            }
        }
Example #15
0
        private void SendMessageButtonOnClick(object sender, RoutedEventArgs e)
        {
            var chatViewModel = DataContext as CappuChatViewModelBase;

            chatViewModel?.SendMessageCommand?.Execute(InputTextBox.Text);

            InputTextBox.Clear();
            InputTextBox.Focus();

            chatViewModel?.SendMessageCommand?.RaiseCanExecuteChanged();
        }
Example #16
0
        private void ClearHighlighting()
        {
            var selectedRange    = InputTextBox.Selection;
            var visibleRange     = InputTextBox.VisibleRange;
            var firstVisibleLine = Math.Min(visibleRange.Start.iLine, visibleRange.End.iLine);

            var txt = InputTextBox.Text;

            InputTextBox.Clear();
            InputTextBox.Text = txt; //remove all old highlighting

            InputTextBox.SetVisibleState(firstVisibleLine, FastColoredTextBoxNS.VisibleState.Visible);
            InputTextBox.Selection = selectedRange;
        }
Example #17
0
        private void Fill_MasRandom_Click(object sender, EventArgs e)
        {
            //Очистка списка элементов исходного массива
            InputTextBox.Clear();
            Random rd = new Random();
            int    n  = rd.Next(4, 1000);

            int[] arr = new int[n];
            for (int i = 0; i < arr.Length - 1; ++i)
            {
                arr[i]             = rd.Next(1, 1000);
                InputTextBox.Text += arr[i].ToString() + " ";
            }
            arr[arr.Length - 1]   = rd.Next(1, 1000);
            InputTextBox.Text    += Convert.ToString(arr[arr.Length - 1]);
            arrayLengthLabel.Text = "Длина массива: " + n;
        }
Example #18
0
        private void InputTextBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar == (char)Keys.Return) && (Waiting == false))
            {
                e.Handled = true;

                if (InputTextBox.Text.ToLower() == CurrentDictionary[Questions[QuestionCurrent]][1])
                {
                    InputTextBox.Clear();
                    RightAnswer();
                }
                else
                {
                    InputTextBox.Clear();
                    WrongAnswer();
                }
            }
        }
Example #19
0
        //операции: сложение, вычитание, умножение, деление, тригонометрические функции
        private void PlusButton_Click(object sender, EventArgs e)
        {
            if (!rgx.IsMatch(InputTextBox.Text))
            {
                MessageBox.Show("Введены недопустимые символы", "Ошибка!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                InputTextBox.Clear();
            }

            else
            {
                InputTextBox.Text += " + ";
                TextBox.Text      += InputTextBox.Text;
                InputTextBox.Clear();
                PlusButton.Enabled    = MinusButton.Enabled = MultiplyButton.Enabled = DivideButton.Enabled = SinButton.Enabled =
                    CosButton.Enabled = TgButton.Enabled = CtgButton.Enabled = false;
            }
        }
Example #20
0
        private void button1_Click(object sender, EventArgs e) // This is clear button which clears the data on the form
        {
            chart1.Series["Series"].Points.Clear();            //This clears the chart series in chart 1

            chart2.Series["Series1"].Points.Clear();           //This clears the chart series in chart 2
            //The following deselects the radio buttons if they are checked
            barChart.Checked    = false;
            columnChart.Checked = false;
            pieChart.Checked    = false;
            lineChart.Checked   = false;
            InputTextBox.Clear();                       //It clears the textbox
            fileRead();                                 //It calls the file read function
            flag = false;
            chart1.Series["Series"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Bar;

            chart2.Series["Series1"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Bar;

            i = 1;
        }
Example #21
0
 private void ResetUI()
 {
     if (!EncryptRadio.Enabled)
     {
         DecryptRadio.Checked = true;
     }
     else if (!DecryptRadio.Enabled)
     {
         EncryptRadio.Checked = true;
     }
     else
     {
         EncryptRadio.Checked = false;
         DecryptRadio.Checked = false;
     }
     InputTextBox.Clear();
     OutputTextBox.Clear();
     CopyToBufferButton.Enabled = false;
 }
Example #22
0
        private async void TextBox_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode != Keys.Enter)
                {
                    return;
                }

                var command = InputTextBox.Text;

                InputTextBox.Clear();

                await RunAsync(command);
            }
            catch (Exception exception)
            {
                OnExceptionOccurred(exception);
            }
        }
Example #23
0
        //framework for getting gif info and displaying it
        private async void QuerySearch()
        {
            DisplayGifBox.Hide();
            TextLabel.Show();

            string          query       = InputTextBox.Text;
            Task <original> gifInfoTask = SearchGif(query);

            TextLabel.Text = loadingText;
            InputTextBox.Clear();
            original gifInfo   = await gifInfoTask;
            int      gifWidth  = int.Parse(gifInfo.width);
            int      gifHeight = int.Parse(gifInfo.height);

            FormResize(gifWidth, gifHeight);
            DisplayGifBox.LoadAsync(gifInfo.url);

            TextLabel.Hide();
            DisplayGifBox.Show();
        }
Example #24
0
        private void button4_Click(object sender, EventArgs e)  // This button is used to add a Random Value to the series
        {
            if (i == 1)
            {
                barChart.Checked = true;
                i = 0;
            }

            InputTextBox.Clear();                                // This clears the input text box
            Random r   = new Random();
            double rnd = r.NextDouble() * (10.00 - 0.00) + 0.00; //This generates random values

            if (flag == false)
            {
                chart1.Series["Series"].Points.AddXY(0, rnd);  // It adds random values to the series in chart 1
            }
            if (flag == true)
            {
                chart2.Series["Series1"].Points.AddXY(0, rnd);  // It adds random values to the series in chart 2
            }
        }
Example #25
0
        private async void OpenFile_Click(object sender, EventArgs e)
        {
            openFileDialog.Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*|Docx(*.docx)|*.docx";

            if (openFileDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            string fileName = openFileDialog.FileName;

            InputTextBox.Clear();

            using (FileStream fileStream = new FileStream(fileName, FileMode.Open))
            {
                using (StreamReader streamReader = new StreamReader(fileStream))
                {
                    InputTextBox.Text = await streamReader.ReadToEndAsync();
                }
            }
        }
Example #26
0
        /// <summary>
        /// InputTextBox receives String[] from Text file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenTextFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog {
                Filter = "txt files (*.txt)|*.txt",
                Title  = "Open Text file for decluttering:"
            };

            openFileDialog.ShowDialog();

            if (openFileDialog.FileName != String.Empty)               // Checking for empty names
            {
                System.IO.FileStream fileStream = (System.IO.FileStream)openFileDialog.OpenFile();

                TextReader textReader = new StreamReader(fileStream);
                InputTextBox.Clear();
                InputTextBox.AppendText(textReader.ReadToEnd());

                // Closing
                textReader.Close();
                fileStream.Close();
            }
        }
Example #27
0
        private void button_SendMesage_OnClick(object sender, RoutedEventArgs e)
        {
            string text = InputTextBox.Text;

            if (!string.IsNullOrEmpty(text) && text != "...enter your message")
            {
                ShowText(text, ETextAligment.eLeft);
            }
            //TODO send message to selected Client

            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            byte[] byteData = Encoding.ASCII.GetBytes(text);
            IntPtr ptr      = Marshal.UnsafeAddrOfPinnedArrayElement(byteData, 0);

            Native.ClientSendMessage(ClientInfo.Name, (int)Native.EMessageType.eBroadcastMessage, ptr, byteData.Length);

            InputTextBox.Clear();
        }
Example #28
0
        private void InputTextBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (!IsConnected)
            {
                return;
            }
            if (String.IsNullOrEmpty(InputTextBox.Text))
            {
                return;
            }

            try
            {
                if (e.Key == Key.Enter)
                {
                    packet.Message = InputTextBox.Text;
                    InputTextBox.Clear();
                    SendMessage(clientStream, packet);
                }
            }
            catch (Exception exception) { MessageBox.Show(exception.Message); }
        }
Example #29
0
        /// <summary>
        /// Performs conversions based on associated values and selected radio button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ConvertButton_Click(object sender, EventArgs e)
        {
            double convertNumber = 0.0;

            if (!double.TryParse(InputTextBox.Text, out convertNumber))
            {
                InputTextBox.Clear();
                InputTextBox.Focus();
            } //else number is valid, DoNothing();

            if (this.ConvertToRadioButton.Checked)
            {
                this.OutputTextBox.Text = $"{convertNumber:F4} {conversions.ConversionObjects[ConversionSelectionBox.SelectedIndex].FromUnit} = {conversions.ConversionObjects[ConversionSelectionBox.SelectedIndex].ConvertTo(convertNumber):F4} {conversions.ConversionObjects[ConversionSelectionBox.SelectedIndex].ToUnit}";
            }
            else if (this.ConvertFromRadioButton.Checked)
            {
                this.OutputTextBox.Text = $"{convertNumber:F4} {conversions.ConversionObjects[ConversionSelectionBox.SelectedIndex].ToUnit} = {conversions.ConversionObjects[ConversionSelectionBox.SelectedIndex].ConvertFrom(convertNumber):F4} {conversions.ConversionObjects[ConversionSelectionBox.SelectedIndex].FromUnit}";
            }
            else
            {
                OutputTextBox.Text = "Must select Convert To or Convert From";
            }
        }
Example #30
0
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            if (!IsConnected)
            {
                return;
            }
            if (String.IsNullOrEmpty(InputTextBox.Text))
            {
                return;
            }

            try
            {
                packet.Message = InputTextBox.Text;
                InputTextBox.Clear();
                SendMessage(clientStream, packet);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                logger.Write("Sending crashed.", exception);
            }
        }