Esempio n. 1
0
        private model.Boat DoBoatForm(model.Boat a_defaultValues)
        {
            string lengthStr = "";

            model.Boat.Type boatType = model.Boat.Type.BT_Motor;
            if (a_defaultValues != null)
            {
                boatType  = a_defaultValues.GetTypeOfBoat();
                lengthStr = Convert.ToString(a_defaultValues.GetLength());
            }
            ;

            if (DoBoatTypeField(out boatType, boatType) != true ||
                DoFormField(out lengthStr, lengthStr, "Längd") != true)
            {
                return(null);
            }

            double length;

            if (Double.TryParse(lengthStr, out length) != true)
            {
                return(null);
            }

            return(new model.Boat(boatType, length));
        }
Esempio n. 2
0
 /// <summary>
 /// Displays a boat to the user
 /// </summary>
 /// <param name="a_boat">model.Boat. The boat to be displayed</param>
 public void DisplayBoat(model.Boat a_boat)
 {
     System.Console.WriteLine("BoatID: {0}", a_boat.GetBoatID());
     System.Console.WriteLine("Type: {0}", a_boat.GetBoatType());
     System.Console.WriteLine("Length: {0}", a_boat.GetLength());
 }
Esempio n. 3
0
        public BoatMenuChoice DoBoatMenu(model.Boat a_boat)
        {
            Console.Clear();
            Console.Out.WriteLine("Båt");
            Console.Out.WriteLine("Typ: {0}\tLängd:{1}", BoatTypeToString(a_boat.GetTypeOfBoat()), a_boat.GetLength());


            String[] menuStrings = new String[] { "Ändra", "Ta Bort", "Tillbaka" };

            return(DoMenu <BoatMenuChoice>(menuStrings, BoatMenuChoice.Invalid, "Båtmeny"));
        }