public void RunUI() { string userAction = string.Empty; while (true) { userAction = string.Empty; OutputToConsole( @"Hello and Welcome to the garage what is your license plate number? Notice: since you can have multiple cars in our garage we need the license plate of your main vehicle:"); m_MainClientLicensePlate = InputFromConsole(); m_CurrentVehicleLicensePlate = m_MainClientLicensePlate; if (!this.m_GarageManager.ClientExists(m_MainClientLicensePlate)) { OutputToConsole("your car is'nt in our garage."); ///create a new client profile this.m_CurrentClient = EnterNewClient(m_MainClientLicensePlate); ///enter the new client to our data structure this.m_GarageManager.AddClient(m_MainClientLicensePlate, this.m_CurrentClient); OutputClearConsole(); OutputToConsole(string.Format("****Thank you! We've entered your details into our system****{0}", Environment.NewLine)); } else { OutputClearConsole(); OutputToConsole(string.Format("****Thank you! We've found your details in our system****{0}", Environment.NewLine)); } ChooseUserActions(m_MainClientLicensePlate); } }
private void InitGarage() { //_GarageCore = new GarageAppCore("http://pizzohome.ddns.net:5000", "Testing123"); try { _GarageCore = new GarageClient(UserSettings.GarageApiEndpoint, UserSettings.Token); Button garageButton = FindViewById <Button>(Resource.Id.toggleBtn); Button statusButton = FindViewById <Button>(Resource.Id.refresh); _GarageStatusTxt = FindViewById <TextView>(Resource.Id.statusLbl); if (!_EventsSubscribed) { garageButton.Click += ToggleGarage; statusButton.Click += GetGarageStatus; _EventsSubscribed = true; } GetGarageStatus(this, null); } catch { Toast.MakeText(this, "Please make sure Garage settings are correct.", ToastLength.Long).Show(); } }
public static void CheckIfRepowerArgsExceptions(string i_LicensePlate, float i_RepowerAmount, bool i_IsFuelEngine, GarageManager i_GarageManager, string i_MainClientLicensePlate, FueledEngine.eFuelType i_FuelType = FueledEngine.eFuelType.None) { GarageClient o_Client = null; GarageClient.SingleVehicleInfo o_InnerDict = null; if (i_GarageManager.m_GarageDictonary.TryGetValue(i_MainClientLicensePlate, out o_Client)) { if (!o_Client.m_Vehicles.TryGetValue(i_LicensePlate, out o_InnerDict)) { throw new Exception("license plate was not found in the garage"); } } if (o_InnerDict.m_Vehicle.m_Engine.GetEngineType() == Engine.eEngineType.Electric && i_IsFuelEngine) { throw new Exception("vehicle cannot be charged because it is not a fueled vehicle"); } if (o_InnerDict.m_Vehicle.m_Engine.GetEngineType() == Engine.eEngineType.Fuel && !i_IsFuelEngine) { throw new Exception("vehicle cannot be charged because it is not an electric vehicle"); } if (i_RepowerAmount > o_InnerDict.m_Vehicle.m_Engine.getMaxPowerAmount()) { if (i_IsFuelEngine) { throw new Exception("Fuel amount requested is greater than the fuel tank capacity"); } else { throw new Exception("charge time requested is greater than the max charge time possible"); } } if (o_InnerDict.m_Vehicle.m_Engine is FueledEngine) { FueledEngine currentFueledEngine = (FueledEngine)o_InnerDict.m_Vehicle.m_Engine; if (currentFueledEngine.GetFuelType() != i_FuelType) { throw new Exception(string.Format("Fuel type requested, does not match the fuel type of this vehicle ({0}).", currentFueledEngine.GetFuelType())); } } }
public UI() { this.m_GarageManager = new GarageManager(); this.m_CurrentClient = null; }