Esempio n. 1
0
 public void Clear()
 {
     SaveButton.Enabled   = true;
     UpdateButton.Enabled = false;
     CategoryTextBox.Clear();
     CategoryTextBox.Focus();
 }
        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);
            }
        }
        /// <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();
        }