public EditBeaconViewModel(Beacon beacon) { //if no beacon - we create new temporary beacon without ID to determine on this page closing is this beacon should be saved _model = beacon ?? new Beacon(); //we never save beacon without a name, so if no beacon - it is creating of new Title = _model.Name ?? Resources.Strings.AddBeaconTitle; Name = _model.Name; Device = new BeaconDeviceViewModel(); Device.Set(_model.Device); Category = _model.Category != null?_model.Category.GetFullPath() : Resources.Strings.SelectCategoryTitle; EditCategoryCommand = new Command(EditCategoryCommandExecute); ChangeBeaconCommand = new Command(ChangeBeaconCommandExecute); }
public EditBeaconViewModel (Beacon beacon) { //if no beacon - we create new temporary beacon without ID to determine on this page closing is this beacon should be saved _model = beacon ?? new Beacon (); //we never save beacon without a name, so if no beacon - it is creating of new Title = _model.Name ?? Resources.Strings.AddBeaconTitle; Name = _model.Name; Device = new BeaconDeviceViewModel (); Device.Set (_model.Device); Category = _model.Category != null ? _model.Category.GetFullPath () : Resources.Strings.SelectCategoryTitle; EditCategoryCommand = new Command (EditCategoryCommandExecute); ChangeBeaconCommand = new Command (ChangeBeaconCommandExecute); }