Exemple #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var pw = new SendGroupView();

            pw.DataContext = new SendGroupViewModel(null);// new ProvodnikContext().Persons.FirstOrDefault()==null?(int?)null:1);
            if (pw.ShowDialog() == true)
            {
                groups.Clear();
                var db = new ProvodnikContext();
                var qq = (from g in db.SendGroups select g);

                foreach (var q in qq)
                {
                    groups.Add(MainWindow.Mapper.Value.Map <SendGroupViewModel>(q));
                }
            }
        }
Exemple #2
0
        void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var p = ((FrameworkElement)e.OriginalSource).DataContext as SendGroupViewModel;

            if (p != null)
            {
                var pw = new SendGroupView();
                pw.DataContext = new SendGroupViewModel(p.Id);// new ProvodnikContext().Persons.FirstOrDefault()==null?(int?)null:1);
                if (pw.ShowDialog() == true)
                {
                    var ind = groups.IndexOf(p);
                    groups.RemoveAt(ind);


                    p = MainWindow.Mapper.Value.Map <SendGroupViewModel>(new ProvodnikContext().SendGroups.First(pp => pp.Id == p.Id));
                    groups.Insert(ind, p);
                    //vm.RefreshPersonList();
                    //TODO goto if exist or add anyway and goto
                    /**/
                }
            }
        }