Ejemplo n.º 1
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (textBoxName.Text.Length == 0 || textBoxTradeAllowance.Text.Length == 0)
            {
                MessageBox.Show("Complete mandatory fields!");
                return;
            }

            if (FieldValidation.IsValidDoubleNumericField(textBoxTradeAllowance.Text) == false)
            {
                MessageBox.Show("Invalid value for trade allowance! Type another!");
                return;
            }
            Image icon;

            if (listViewIcons.SelectedItem != null)
            {
                icon = listViewIcons.SelectedItem as Image;
            }
            else
            {
                if (customIcon != null)
                {
                    icon = customIcon;
                }
                else
                {
                    icon = defaultIcon;
                }
            }

            CurrentCategory = new Category <FurnitureObject>(textBoxName.Text, icon.Tag.ToString(), textBoxDescription.Text, Convert.ToDouble(textBoxTradeAllowance.Text));
            ClearAllFields();
            if (this.StatusUpdated != null)
            {
                this.StatusUpdated(this, new EventArgs());
            }
        }