public CarZonesErrorViewModel() { _instance = this; if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { var el = new CarInOutViewModel() { CarID = "1", CarNumber = "AS12341", ZoneId = 1, ZoneName = "OPT", InZoneDate = DateTime.Now, OutZoneDate = DateTime.Now }; el.PropertyChanged += CarInOut_PropertyChanged; CarsInOut.Add(el); } _carHandler = CarsHandler.Instance; _carHandler.CarsRefreshed += Instance_CarsRefreshed; if (!_carHandler.Cars.Any()) { _carHandler.Update(); } _zoneHandler = ZonesHandler.Instance; if (!_zoneHandler.Zones.Any()) { _zoneHandler.Update(); } }
private void AddCarToErrorLog(DISP_Car car, VmPolyline zone, DateTime dt) { var el = new CarInOutViewModel() { CarID = car.ID, CarNumber = car.Name, ZoneId = zone.ID, ZoneName = zone.Name, OutZoneDate = dt }; el.PropertyChanged += CarInOut_PropertyChanged; Application.Current.Dispatcher.BeginInvoke(new Action(() => CarsInOut.Add(el))); }
private void AddCarToErrorLog(DISP_Car car, VmPolyline zone) { var el = new CarInOutViewModel() { CarID = car.ID, CarNumber = car.Name, ZoneId = zone.ID, ZoneName = zone.Name, OutZoneDate = ToDate(car.Data.DateUpdate) }; el.PropertyChanged += CarInOut_PropertyChanged; CarsInOut.Add(el); _inErrorCars.Add(car); }