Пример #1
0
        private void selectButton_Click(object sender, EventArgs e)
        {
            bool userHasSelectedComponentType = playbackComponentRadioButton.Checked || chargerRadioButton.Checked || removableStorageRadioButton.Checked || simCardRadioButton.Checked;

            if (userHasSelectedComponentType)
            {
                RichTextBoxOutput RichTextBoxOutput = new RichTextBoxOutput(outputOfSettingAndRunningComponentRichTextBox);
                TextBoxInput      TextBoxInput      = new TextBoxInput(chosenComponentTypeIndex);

                SimCorpMobile          simCorpMobile          = new SimCorpMobile(RichTextBoxOutput);
                PhoneComponentsHandler phoneComponentsHandler = new PhoneComponentsHandler(output: RichTextBoxOutput, input: TextBoxInput);

                if (playbackComponentRadioButton.Checked)
                {
                    phoneComponentsHandler.GetAndProcessUserSelectionOfPlayback(simCorpMobile);
                }

                if (chargerRadioButton.Checked)
                {
                    phoneComponentsHandler.GetAndProcessUserSelectionOfCharger(simCorpMobile);
                }

                if (removableStorageRadioButton.Checked)
                {
                    phoneComponentsHandler.GetAndProcessUserSelectionOfStorage(simCorpMobile);
                }

                if (simCardRadioButton.Checked)
                {
                    phoneComponentsHandler.GetAndProcessUserSelectionOfSimCard(simCorpMobile);
                }
            }
        }
Пример #2
0
        private DlgInput(string message, string title, Image image, string presetText)
        {
            InitializeComponent();

            if (title != null)
            {
                Title = title;
            }
            if (image != null)
            {
                Icon = image.Source;
            }
            if (presetText != null)
            {
                TextBoxInput.Text = presetText;
            }
            else
            {
                TextBoxInput.Text = "";
            }
            TextMessage.Text            = message;
            TextBoxInput.SelectionStart = TextBoxInput.Text.Length;
            TextBoxInput.Focus();

            // We need to measure the ActualHeight of TextBoxInput,
            // because it reads 0.0 if it's not set, unlesse Arrage is called.
            // And it's not set on purpose to use system default.
            TextBoxInput.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            TextBoxInput.Arrange(new Rect(TextBoxInput.DesiredSize));

            DlgHelper.Initialize(this);
            DlgHelper.CalcNeededSize(this, TextMessage, ButtonOk.Height + TextBoxInput.ActualHeight);
        }
        /// <summary>
        /// Code to execute when the dialog loads.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ContentDialog_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            // This is a hack, delay half a second so that the Focus sticks.
            await Task.Delay(500);

            TextBoxInput.Focus();
        }
Пример #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            TextBoxInput.Clear();
            TextBlockStat.Text = null;

            string NotNull = LogBox.Text;

            if (CB_Ru.IsChecked == true)
            {
                if (NotNull.Length > 0)
                {
                    LogBox.Text = string.Concat(NotNull, "\n>> Произведена очистка блоков кроме логов.");
                }
                else
                {
                    LogBox.Text = ">> Произведена очистка блоков кроме логов.";
                }
            }
            else
            {
                if (NotNull.Length > 0)
                {
                    LogBox.Text = string.Concat(NotNull, "\n>> Cleared blocks except logs.");
                }
                else
                {
                    LogBox.Text = ">> Cleared blocks except logs.";
                }
            }
        }
Пример #5
0
        private void AdjustControlsAvailability()
        {
            bool productSelected = bsProducts.Current != null;
            bool quantityMissing = TextBoxInput.MissingText(tbQuantity);

            this.btnOK.Enabled = (productSelected && !quantityMissing);
        }
Пример #6
0
 private void ClearEntryButton_Click(object sender, EventArgs e)
 {
     TextBoxInput.Clear();
     result           = 0;
     Operation        = "";
     OpClicked        = false;
     LabelOutput.Text = "";
 }
Пример #7
0
        /// <summary>
        /// Dialog box to request data from the user
        /// </summary>
        /// <param name="textPlaceholderText"></param>
        /// <param name="textButtonText"></param>
        public WindowInputDialog(string textPlaceholderText, string textButtonText)
        {
            InitializeComponent();

            //bind model and view
            InputModel       = new InputDialogModelWindow(textPlaceholderText, textButtonText, Close);
            this.DataContext = InputModel;
            TextBoxInput.Focus();
        }
Пример #8
0
        private void AdjustControlsAvailability()
        {
            bool invalidProductName = TextBoxInput.MissingText(tbProductName);
            bool invalidPrice       = TextBoxInput.MissingText(tbPrice) ||
                                      TextBoxInput.ContainsDecimalPointOnly(tbPrice) ||
                                      TextBoxInput.GreaterThanDecimalMaxValue(tbPrice);

            this.btnOK.Enabled = (invalidProductName || invalidPrice) ? false : true;
        }
Пример #9
0
 private void frmEditUser_Load(object sender, EventArgs e)
 {
     TextBoxInput.InitializeErrorProvider();
     SetFormTitle();
     if (user.UserID > 0)
     {
         FillUserInfo();
     }
     AdjustControlsAvailability();
 }
Пример #10
0
 private void frmEditSupplier_Load(object sender, EventArgs e)
 {
     SetFormTitle();
     TextBoxInput.InitializeErrorProvider();
     if (supplier.SupplierID != 0)
     {
         FillSupplierInfo();
     }
     AdjustControlsAvailability();
 }
Пример #11
0
 private void frmEditProduct_Load(object sender, EventArgs e)
 {
     SetFormTitle();
     TextBoxInput.InitializeErrorProvider();
     if (product.ProductID > 0)
     {
         FillProductInfo();
     }
     AdjustControlsAvailability();
 }
Пример #12
0
 private void frmEditSalesItem_Load(object sender, EventArgs e)
 {
     SetFormInfo();
     LoadSuppliersData();
     LoadProductsData();
     TextBoxInput.InitializeErrorProvider();
     AdjustControlsAvailability();
     this.bsSuppliers.CurrentChanged += new EventHandler(bsSuppliers_CurrentChanged);
     this.bsProducts.CurrentChanged  += new EventHandler(bsProducts_CurrentChanged);
 }
Пример #13
0
        private void AdjustControlsAvailability()
        {
            bool usernameMissing  = TextBoxInput.MissingText(tbUserName);
            bool passwordMissing  = TextBoxInput.MissingText(tbPassword);
            bool roleMissing      = UserRoleMissing();
            bool firstNameMissing = TextBoxInput.MissingText(tbFirstName);
            bool lastNameMissing  = TextBoxInput.MissingText(tbLastName);
            bool addressMissing   = TextBoxInput.MissingText(tbAddress);

            this.btnOK.Enabled = !(usernameMissing || passwordMissing ||
                                   roleMissing || firstNameMissing ||
                                   lastNameMissing || addressMissing);
        }
Пример #14
0
        private void BClean_Click(object sender, RoutedEventArgs e)
        {
            TextBoxInput.Clear();
            LogBox.Text        = null;
            TextBlockStat.Text = null;

            if (CB_Ru.IsChecked == true)
            {
                LogBox.Text = ">> Произведена очистка всех блоков.";
            }
            else
            {
                LogBox.Text = ">> All blocks are cleared.";
            }
        }
Пример #15
0
 private void tbPrice_KeyDown(object sender, KeyEventArgs e)
 {
     e.SuppressKeyPress = true;
     if (InputKey.ValidNumberKey(e))
     {
         e.SuppressKeyPress = false;
     }
     else if (InputKey.IsDecimalPoint(e))
     {
         if (!TextBoxInput.ContainsDecimalPoint(tbPrice) ||
             TextBoxInput.AllTextSelected(tbPrice) ||
             TextBoxInput.SelectionContainsDecimalPoint(tbPrice))
         {
             e.SuppressKeyPress = false;
         }
     }
 }
Пример #16
0
        void equals()                                           //void untuk sama dengan
        {
            Double SecondNumber;                                //secondnumber adalah untuk inputan angka kedua

            SecondNumber = Convert.ToDouble(TextBoxInput.Text); //convert fungsinya untuk merubah tipe data
            TextBoxInput.Clear();                               //mengclearkan textbox
            LabelOutput.Text = "";                              //mengclearkan label
            switch (Operation)
            {
            case "add":                                                                                                                        //jika Operation=="add"
            {
                result            = FirstNumber + SecondNumber;                                                                                //rumus tambah
                TextBoxInput.Text = Convert.ToString(result);                                                                                  //menapilkan di textbox
                LabelOutput.Text  = Convert.ToString(FirstNumber) + " + " + Convert.ToString(SecondNumber) + " = " + Convert.ToString(result); //menampilkan di label
                break;                                                                                                                         //break aritnya switch case ini selesai
            }

            case "min":
            {
                result            = FirstNumber - SecondNumber;                                                                                //rumus kurang
                TextBoxInput.Text = Convert.ToString(result);                                                                                  //menampilkan di textbox
                LabelOutput.Text  = Convert.ToString(FirstNumber) + " - " + Convert.ToString(SecondNumber) + " = " + Convert.ToString(result); //menampilkan di label
                break;                                                                                                                         //break artinya switch case ini selesai
            }

            case "div":
            {
                result            = FirstNumber / SecondNumber;                                                                                //rumus kali
                TextBoxInput.Text = Convert.ToString(result);                                                                                  //menampilkan di textbox
                LabelOutput.Text  = Convert.ToString(FirstNumber) + " / " + Convert.ToString(SecondNumber) + " = " + Convert.ToString(result); //menampilkan di label
                break;                                                                                                                         //break artinya switch case ini selesai
            }

            case "mul":
            {
                result            = FirstNumber * SecondNumber;                                                                                //rumus kali
                TextBoxInput.Text = Convert.ToString(result);
                LabelOutput.Text  = Convert.ToString(FirstNumber) + " * " + Convert.ToString(SecondNumber) + " = " + Convert.ToString(result); //menampilkan di label
                break;                                                                                                                         //break artinya switch case ini selesai
            }
            }
        }
Пример #17
0
        private void AdjustControlsAvailability()
        {
            bool shippmentMissing = TextBoxInput.MissingText(tbShippment);

            this.btnOK.Enabled = shippmentMissing ? false : true;
        }
Пример #18
0
 public void SetFocus()
 {
     TextBoxInput.Focus();
 }
Пример #19
0
 private void NumericTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     TextBoxInput.RestrictToNumbers(sender, e);
 }
 private void StringInputBox_Loaded(object sender, System.Windows.RoutedEventArgs e)
 {
     Loaded -= StringInputBox_Loaded;
     TextBoxInput.Focus();
     TextBoxInput.SelectAll();
 }
Пример #21
0
 private void BExample_Click(object sender, RoutedEventArgs e)
 {
     TextBoxInput.Clear();
     TextBoxInput.Text = "d0 9f d1 80 d0 b8 d0 bc d0 b5 d1 80 20 45 78 61 6d 70 6c 65";
     ExecutionProcessing();
 }
Пример #22
0
        private DlgSearch(string presetText)
        {
            InitializeComponent();

            SearchTimer          = new DispatcherTimer();
            SearchTimer.Interval = TimeSpan.FromSeconds(1.0);
            SearchTimer.Tick    += SearchTimer_Tick;

            DlgHelper.Initialize(this);

            if (presetText != null)
            {
                TextBoxInput.Text = presetText;
            }
            else
            {
                TextBoxInput.Text = _searchString;
            }
            // Select all
            TextBoxInput.SelectAll();
            TextBoxInput.Focus();

            CheckNodeTag.IsChecked     = _checkNodeTag;
            CheckNodeText.IsChecked    = _checkNodeText;
            CheckAttribName.IsChecked  = _checkAttribName;
            CheckAttribValue.IsChecked = _checkAttribValue;

            if (TextBoxInput.Text.Length > 2)
            {
                Search();
                foreach (TreeViewItem item in Tree.Items)
                {
                    if (item.DataContext == _selectedItem)
                    {
                        item.IsSelected = true;
                    }
                    foreach (TreeViewItem sub in item.Items)
                    {
                        if (sub.DataContext == _selectedItem)
                        {
                            sub.IsSelected = true;
                        }
                    }
                }
            }


            if (_width > 0 && _height > 0)
            {
                Width  = _width;
                Height = _height;
            }

            // Scroll to selected item
            if (Tree.SelectedItem is TreeViewItem)
            {
                (Tree.SelectedItem as TreeViewItem).BringIntoView();
            }

            // We need to measure the ActualHeight of TextBoxInput,
            // because it reads 0.0 if it's not set, unlesse Arrage is called.
            // And it's not set on purpose to use system default.
            //TextBoxInput.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            //TextBoxInput.Arrange(new Rect(TextBoxInput.DesiredSize));

            //DlgHelper.CalcNeededSize(this, TextMessage, ButtonOk.Height + TextBoxInput.ActualHeight);
        }
Пример #23
0
        private void AdjustControlsAvailability()
        {
            bool invalidSupplierName = TextBoxInput.MissingText(tbSupplierName);

            this.btnOK.Enabled = invalidSupplierName ? false : true;
        }
Пример #24
0
 private void toolStripMenuItemClearText_Click(object sender, EventArgs e)
 {
     TextBoxInput.Clear();
 }
Пример #25
0
 private void RadioButtonEncrypt_CheckedChanged(object sender, EventArgs e)
 {
     TextBoxInput.Clear();
     TextBoxOutput.Clear();
 }
Пример #26
0
 private void ButtonClear_Click(object sender, RoutedEventArgs e)
 {
     TextBoxInput.Clear();
 }
Пример #27
0
 private void frmEditShippment_Load(object sender, EventArgs e)
 {
     TextBoxInput.InitializeErrorProvider();
     FillProductInfo();
 }
Пример #28
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     TextBoxInput.Clear();
 }
Пример #29
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     TextBoxInput.Text = string.Empty;
     TextBoxInput.Focus();
 }
Пример #30
0
 private void MessageComponent_Loaded(object sender, RoutedEventArgs e)
 {
     TextBoxInput.Focus();
 }