Exemple #1
0
        static void CreateTestVehicles()
        {
            Util.PrintClear();
            //if (GarageHandler.GarageMissing())
            //{
            //    Util.MsgBox("Message", "Garage is missing");
            //    return;
            //}
            //if (GarageHandler.GarageIsFull())
            //{
            //    Util.MsgBox("Message", "Garage is full");
            //    return;
            //}
            var    cnt      = 0;
            string errLst   = "";
            var    vehicles = VehicleHandler.GetTestVehicles();

            foreach (var v in vehicles)
            {
                if (GarageHandler.AddVehicle(v, out var err))
                {
                    cnt++;
                }
                else
                {
                    errLst += "\n" + err;
                }
            }
            Util.MsgBox("Create test vehicles", string.Format($"Succesfully created {cnt} (of {vehicles.Length}) vehicles. {errLst}"));
        }
Exemple #2
0
        //if (GarageHandler.GarageMissing())
        //{
        //    Util.MsgBox("Message", "Garage is missing");
        //    return;
        //}


        static void AddVehicle()
        {
            Util.PrintClear();
            //if (GarageHandler.GarageMissing())
            //{
            //    Util.MsgBox("Message", "Garage is missing");
            //    return;
            //}
            //if (GarageHandler.GarageIsFull())
            //{
            //    Util.MsgBox("Message", "Garage is full");
            //    return;
            //}
            string  errMsg  = "";
            var     type    = Util.Input("1. Airplane (ai)\n2. Motorcycle (mo)\n3. Car (ca)\n4. Bus (bu)\n5. Boat (bo)\n\nPlease specify type of Vehicle: ");
            Vehicle vehicle = (Vehicle)VehicleHandler.BuildVehicle(type, out errMsg);
            string  str;

            if (errMsg == "" && GarageHandler.AddVehicle(vehicle, out errMsg))
            {
                str = string.Format($"Adding vehicle was succesfull");
            }
            else
            {
                str = string.Format($"Sorry, adding of vehicle faild. {errMsg}");
            }
            Util.MsgBox("Add Vehicle", str);
        }