private void AddMeterOfPole() { if (SelectType.Equals("Pole")) { MetersOfPole.Add(new MeterOfPoleViewModel { MeterId = "" }); } else { MetersOfPole = new ObservableCollection <MeterOfPoleViewModel>(); } }
public MeterViewModel(EnergyMeter item, EnergyMetersService Service, MainViewModel MainView) { mainView = MainView; service = Service; Type = item.Type; SerialId = item.SerialId; Count = item.Count; UserId = item.UserId; SwitchState = item.SwitchState; foreach (var i in item.Meters) { MetersOfPole.Add(new MeterOfPoleViewModel { MeterId = i.MeterId }); } DeleteCommand = new Command(async() => await Delete(), () => true); SwitchCommand = new Command(async() => await Switch(), () => true); GetCountCommand = new Command(async() => await GetCount(), () => true); UpdateCommand = new Command(async() => await Update(), () => true); }