public void addNewVehicle() { DataInputScreen dataInputScreen = r_Screens[eUIScreens.DataInput] as DataInputScreen; NumericalInputScreen numericalInputScreen = r_Screens[eUIScreens.NumericalInput] as NumericalInputScreen; ScreenUtils.Clear(); dataInputScreen.SetMassageToDisplay("Enter Vehicle License Number"); dataInputScreen.Display(out string licenseNumber); r_GarageManager.AddVehicle(licenseNumber); VehicleInfo vehicleInfo = r_GarageManager.GetVehicleInfo(licenseNumber); try { string userData; dataInputScreen.SetMassageToDisplay("Enter Vehicle Owner Name"); dataInputScreen.Display(out userData); vehicleInfo.VehicleOwnerName = userData; numericalInputScreen.SetMassageToDisplay("Enter Vehicle Owner Phone Number"); numericalInputScreen.Display(out userData); vehicleInfo.VehicleOwnerPhoneNumber = userData; vehicleInfo.Vehicle = getNewVehicleFromUser(licenseNumber); } catch (Exception i_Exception) { ScreenUtils.Display(i_Exception.ToString()); ScreenUtils.Freeze(); } }
private void displayVehicleActions() { string licenseNumber; DataInputScreen screen = r_Screens[eUIScreens.DataInput] as DataInputScreen; ScreenUtils.Clear(); screen.SetMassageToDisplay("Enter Vehicle License Number"); screen.Display(out licenseNumber); try { VehicleInfo vehicleInfo = r_GarageManager.GetVehicleInfo(licenseNumber); if (vehicleInfo != null) { MenuScreen menu; if (vehicleInfo.Vehicle.EnergySource is Battery) { menu = r_Screens[eUIScreens.ElectricityVehicleActions] as MenuScreen; } else { menu = r_Screens[eUIScreens.FuelVehicleActions] as MenuScreen; } bool back = false; while (!back) { menu.Display(out string userInput); vehicleActionHandler(vehicleInfo, userInput, out back); } } } catch (Exception i_Exception) { ScreenUtils.Display(i_Exception.ToString()); ScreenUtils.Freeze(); } }