Exemplo n.º 1
0
        private void AddAll_Button(object sender, RoutedEventArgs e)
        {
            var products = from pr in prodList select pr.Products;

            foreach (Products item in ProductsLVS.Items)
            {
                if (!products.Contains(item))
                {
                    ProductsLists pl = new ProductsLists
                    {
                        Lists    = list,
                        Products = item
                    };
                    prodList.Add(pl);
                }
            }
        }
Exemplo n.º 2
0
        private void Amount_LostFocus(object sender, RoutedEventArgs e)
        {
            TextBox tb = sender as TextBox;

            if (!Regex.IsMatch(tb.Text, "^[0-9]{1,}$"))
            {
                MessageBox.Show("Wprowadzona wartość nie jest liczbą", "Uwaga", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                tb.Text = "0";
            }
            else
            {
                ListViewItem lvI = GetAncestorOfType <ListViewItem>(tb);
                if (lvI != null)
                {
                    ProductsLists pl = lvI.Content as ProductsLists;
                    pl.Amount = int.Parse(tb.Text);
                }
            }
        }