Beispiel #1
0
        /// <summary>
        /// Handler of addition of new product, makes new window.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addLineButton_Click(object sender, RoutedEventArgs e)
        {
            ProductData = null;
            if (treeView.SelectedItem == null)
            {
                MessageBox.Show("Для того чтобы добавить товар, сначала выберете раздел", "Ошибка");
                return;
            }
            ProductCard productCard = new ProductCard();

            productCard.Owner   = this;
            productCard.Closed += (sender, e) => IsEnabled = true;
            productCard.Closed += WriteProduct;
            productCard.Show();
            IsEnabled = false;
        }
Beispiel #2
0
        /// <summary>
        /// Handler of editing product.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editProduct_Click(object sender, RoutedEventArgs e)
        {
            if (treeView.SelectedItem == null || productsGrid.SelectedItem == null)
            {
                MessageBox.Show("Вы должны выбрать раздел и товар", "Ошибка");
                return;
            }
            ProductData = null;
            Product     curProduct  = productsGrid.SelectedItem as Product;
            ProductCard productCard = new ProductCard(curProduct);

            productCard.Owner   = this;
            productCard.Closed += (sender, e) => IsEnabled = true;
            productCard.Closed += EditProduct;
            productCard.Show();
            IsEnabled = false;
        }