示例#1
0
        private void AddWork(object parameter)
        {
            var model = new WorksInfoDataCostViewModel
            {
                Name      = SelectedWork.Name,
                IdWork    = SelectedWork.idWork,
                IsChanged = true,
                Mark      = Mark != null ? Mark.Name : AllCar,
                Model     = Model != null ? Model.Name : "",
                ID        = CarWorks.Count,
                CostWork  = NHCost
            };

            model.IsRoot = model.Mark.Equals(AllCar);
            var exist = CarWorks.FirstOrDefault(o => o.Equals(model));

            CompleteSaveEnabled = true;
            if (exist != null)
            {
                SelectedCarWorks = exist;
                return;
            }
            model.PropertyChanged += model_PropertyChanged;
            CarWorks.Add(model);
            SelectedCarWorks = model;
        }
示例#2
0
 public SlideWorksSettingsViewModel()
 {
     _storage.Update();
     _storage.UpdateWorks();
     _storage.UpdateWorkTypes();
     _carstorage.LoadComplete           += _carstorage_LoadComplete;
     _storage.LoadModelsComplete        += _storage_LoadModelsComplete;
     _storage.LoadWorkPartsListComplete += Instance_LoadWorkPartsListComplete;
     Cars.Add(new CarListBaseDataModel {
         Mark = AllCar, ID = 0, Model = ""
     });
     if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
     {
         Cars.Add(new CarListBaseDataModel {
             CarNumber = "qqqq", Mark = "Audio", Model = "A3"
         });
         CarWorks.Add(new WorksInfoDataCostViewModel {
             Name = "To All", Model = "", Mark = AllCar, ID = 0
         });
         CarWorks.Add(new WorksInfoDataCostViewModel {
             Name = "To Audi", Model = "A4", Mark = "Audi", ID = 1
         });
     }
 }