示例#1
0
 public void Clear()
 {
     SaveButton.Enabled   = true;
     UpdateButton.Enabled = false;
     CategoryTextBox.Clear();
     CategoryTextBox.Focus();
 }
示例#2
0
 private void BeginEdit()
 {
     if (CanEdit != null && !CanEdit())
     {
         InEditMode = false;
         return;
     }
     CategoryTextBlock.Visibility = Visibility.Collapsed;
     CategoryTextBox.Visibility   = Visibility.Visible;
     CategoryTextBox.Focusable    = true;
     _oldText = ItemText;
     CategoryTextBox.SelectAll();
     Keyboard.Focus(CategoryTextBox);
 }
        private void UpdateDataCategory_Click(object sender, RoutedEventArgs e)
        {
            CategoryController CallCategory = new CategoryController();

            if (CategoryTextBox.Text.Length == 0)
            {
                CategoryNameErrorMessage.Text = "You Must Enter Category Name!";
                CategoryTextBox.Focus();
            }
            else
            {
                string Cname = CategoryTextBox.Text;

                CallCategory.UpdateCategory(Convert.ToInt16((DataGridCategory.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text), Cname);
            }
        }
        private void AddDataCategory_Click(object sender, RoutedEventArgs e)
        {
            CategoryController CallCategory = new CategoryController();

            if (CategoryTextBox.Text.Length == 0)
            {
                CategoryNameErrorMessage.Text = "You Must Enter Category Name!";
                CategoryTextBox.Focus();
            }
            else
            {
                string Cname = CategoryTextBox.Text;

                CallCategory.AddCategory(Cname);
            }
        }
示例#5
0
        private void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            DB db = DB.Instance;

            if (Product.ValidPrice(PriceTextBox.GetLineText(0)))
            {
                Product product = new Product(
                    NameTextBox.GetLineText(0),
                    PriceTextBox.GetLineText(0),
                    CategoryTextBox.GetLineText(0),
                    BrandTextBox.GetLineText(0)
                    );
                product.AddToDB();
                Close();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void KeyDown_Typed(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key != Key.Enter && e.PlatformKeyCode != 0x0A)
            {
                return;
            }
            switch (textboxWithFocus.Name)
            {
            case "AccountTextBox":
                PayeeTextBox.Focus();
                break;

            case "PayeeTextBox":
                if (CategoryTextBox.Visibility == Visibility.Visible)
                {
                    CategoryTextBox.Focus();
                }
                else
                {
                    CategoryListPicker.Focus();
                }
                break;

            case "CategoryTextBox":
                MemoTextBox.Focus();
                break;

            case "MemoTextBox":
                OutflowButton.Focus();
                break;

            case "AmountTextBox":
                AmountTextBox.Focus();
                break;
            }
            CommitItemWithFocus();
        }