コード例 #1
0
        public RealtorsTableViewModel(int agencyID)
        {
            DelegateCommand <object> AddNewRealtorCommand = new DelegateCommand <object>(this.AddNewRealtor, delegate { return(true); });

            MyCompanyCommands.NewRealtorAddedCommand.RegisterCommand(AddNewRealtorCommand);

            GroupCollectionCommand = new DelegateCommand <object>(this.GroupCollection, delegate { return(true); });

            List <Realtor>          rlist  = AgencyModel.GetRealtors(agencyID);
            List <RealtorViewModel> rvlist = new List <RealtorViewModel>();

            foreach (Realtor r in rlist)
            {
                rvlist.Add(new RealtorViewModel(r));
            }

            Realtors = new ListCollectionView(rvlist);
            //Realtors.GroupDescriptions.Add(new PropertyGroupDescription("Appointment"));

            OnProperyChanged("Realtors"); // FIX: may be spare
        }
コード例 #2
0
        public void SaveChanges(object param)
        {
            if (this.HasError)
            {
                string msg;
                IsValid(this.Error, out msg);

                System.Windows.MessageBox.Show(msg, "Ошибка", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                this.RaiseMoveFocus(this.Error);
                return;
            }

            System.Windows.MessageBoxResult res = System.Windows.MessageBox.Show("Вы действительно хотите сохранить внесенные изменения?", "Внимание, вопрос", System.Windows.MessageBoxButton.YesNoCancel, System.Windows.MessageBoxImage.Question);

            if (res == System.Windows.MessageBoxResult.Cancel ||
                res == System.Windows.MessageBoxResult.No)
            {
                return;
            }

            AgencyModel.UpdateAgency(_agency);
        }
コード例 #3
0
 public RealtorViewModel(int?id)
 {
     IsNotSaved = false;
     _realtor   = AgencyModel.GetRealtor(id);
 }