void CreateNewBatteryType() { BatteryTypeClass newBatteryType = new BatteryTypeClass(); BatteryTypeViewModel workspace = new BatteryTypeViewModel(newBatteryType, _repositories._batterytypeRepository); this.Workspaces.Add(workspace); this.SetActiveWorkspace(workspace); }
public BatteryTypeViewModel(BatteryTypeClass batterytype, BatteryTypeRepository batteryModelRepository) { if (batterytype == null) { throw new ArgumentNullException("batterytype"); } if (batteryModelRepository == null) { throw new ArgumentNullException("batteryModelRepository"); } _batterytype = batterytype; _batterytypeRepository = batteryModelRepository; }
/// <summary> /// Create a new battery type, based on the given value. This method is invoked by the SaveAsCommand. /// </summary> public void SaveAs() { BatteryTypeClass newBatteryType = new BatteryTypeClass( this._batterytype.Manufactor, this._batterytype.Name, this._batterytype.Material, this._batterytype.LimitedChargeVoltage, this._batterytype.RatedCapacity, this._batterytype.NominalVoltage, this._batterytype.TypicalCapacity, this._batterytype.CutoffDischargeVoltage); BatteryTypeViewModel workspace = new BatteryTypeViewModel(base.mainWindowViewModel, newBatteryType, this._batterytypeRepository); this.mainWindowViewModel.Workspaces.Add(workspace); this.mainWindowViewModel.SetActiveWorkspace(workspace); }
public BatteryTypeViewModel(MainWindowViewModel mainWindowViewModel, BatteryTypeClass batterytype, BatteryTypeRepository batteryModelRepository) : this(batterytype, batteryModelRepository) { base.mainWindowViewModel = mainWindowViewModel; }