private void dataGridS_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { Data data = dataGridS.SelectedItem as Data; SetQuantity setQuantity = new SetQuantity(); if (setQuantity.ShowDialog() == true) { DataC dataC = new DataC(); dataC.Id = data.Id; dataC.Name = data.Name; dataC.Now = data.Now; listС.Add(dataC); listS.Remove(data); data.Rem = data.Now; data.Now = setQuantity.Value; listR.Add(data); dataGridR.ItemsSource = null; dataGridR.ItemsSource = listR; dataGridS.Items.Refresh(); labelS.Content = "Вся комплектация на складе (" + listS.Count + " ед.)"; if (listR.Count == 0) { labelR.Content = "Комплектация \"" + name + "\""; } else { labelR.Content = "Комплектация \"" + name + "\" (" + listR.Count + " ед.)"; } } } catch { } }
void Sort() { try { progress.Value = 60; int l = listS.Count; foreach (Item item in listI) { for (int i = 0; i < l; i++) { if (listS.ElementAt(i).Name == item.Name) { Data d = listS.ElementAt(i); DataC dataC = new DataC(); dataC.Id = d.Id; dataC.Name = d.Name; dataC.Now = d.Now; listС.Add(dataC); listS.Remove(d); progress.Value += 30 / l; l--; d.Rem = d.Now; d.Now = item.Now; listR.Add(d); } } } } catch { } dataGridS.ItemsSource = null; dataGridS.ItemsSource = listS; dataGridR.ItemsSource = null; dataGridR.ItemsSource = listR; progress.Visibility = Visibility.Hidden; loading = false; labelS.Content = "Вся комплектация на складе (" + listS.Count + " ед.)"; labelR.Content = "Комплектация \"" + name + "\" (" + listR.Count + " ед.)"; }