示例#1
0
        void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var p = ((FrameworkElement)e.OriginalSource).DataContext as PersonShortViewModel;

            if (p != null)
            {
                var pw  = new PersonView();
                var db  = new ProvodnikContext();
                var pvm = new PersonViewModel(p.Id);
                pw.DataContext = pvm;

                if (pw.ShowDialog() == true)
                {
                    var ind = vm.PersonList.IndexOf(p);
                    vm.PersonList.RemoveAt(ind);

                    p = MainWindow.Mapper.Value.Map <PersonShortViewModel>(new ProvodnikContext().Persons.First(pp => pp.Id == p.Id));
                    vm.PersonList.Insert(ind, p);
                    //vm.RefreshPersonList();
                    //TODO goto if exist or add anyway and goto
                    vm.InitCollectionsForCombo();

                    Helper.SetPersonShortIndexes(PersonsListView);
                }
            }
        }
示例#2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var pw = new PersonView();

            pw.DataContext = new PersonViewModel(null);// new ProvodnikContext().Persons.FirstOrDefault()==null?(int?)null:1);
            if (pw.ShowDialog() == true)
            {
                vm.PersonSearch = pw.vm.Fio; //vm.RefreshPersonList();

                //TODO goto if exist or add anyway and goto
                vm.InitCollectionsForCombo();
            }
        }
示例#3
0
        private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var pe = ((FrameworkElement)e.OriginalSource).DataContext as AlarmViewModel;

            if (pe != null)
            {
                var vm  = this.DataContext as SendGroupViewModel;
                var pw  = new PersonView();
                var db  = new ProvodnikContext();
                var pvm = new PersonViewModel(pe.Id);
                pw.DataContext = pvm;
                if (pw.ShowDialog() == true)
                {
                    RefreshList();
                }
            }
        }
        void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var pe = ((FrameworkElement)e.OriginalSource).DataContext as MedKomZayavkaPersonViewModel;

            if (pe != null)
            {
                var vm  = this.DataContext as MedKomZayavkaViewModel;
                var pw  = new PersonView();
                var db  = new ProvodnikContext();
                var pvm = new PersonViewModel(pe.PersonId);
                pw.DataContext = pvm;
                if (pw.ShowDialog() == true)
                {
                    var ppp = new ProvodnikContext().Persons.First(pp => pp.Id == pe.PersonId);
                    var tmp = MainWindow.Mapper.Value.Map(ppp, pe);

                    var ind = vm.Persons.IndexOf(pe);
                    vm.Persons.RemoveAt(ind);
                    vm.Persons.Insert(ind, pe);
                    //vm.RefreshPersonList();
                    //TODO goto if exist or add anyway and goto
                }
            }
        }