Example #1
0
 /// <summary>
 /// 处理高级页的添加
 /// </summary>
 private void UCAdvanced_Add()
 {
     if (this.ucAdvanced1.Check())
     {
         AirbusA320 a320 = ucAdvanced1.GetAdvancedData();
         richTextBox1.AppendText(a320.OutputAll());
     }
 }
Example #2
0
        private void pictureBoxOK_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();

            if (this.ucBasic1.Check() && this.ucAdvanced1.Check())
            {
                BasicData basicData = ucBasic1.GetBasicData();
                richTextBox1.AppendText(basicData.Output());

                AirbusA320 a320 = ucAdvanced1.GetAdvancedData();
                richTextBox1.AppendText(a320.OutputAll());
            }
        }
Example #3
0
        public static void Execute()
        {
            ConsoleExtension.WriteSeparator("Air traffic control example");

            var airTraficControl = new FrankfurtAirTrafficControl();

            // Register flights to air trafic control
            var flight1 = new AirbusA320("ARB320", 28000, airTraficControl);
            var flight2 = new Boeing737("BNG737", 29000, airTraficControl);
            var flight3 = new Boeing777("BNG777", 35000, airTraficControl);

            Console.WriteLine($"\nChanging altitude for {flight1.CallSign}...");
            flight1.Altitude += 1000;
        }
        public AirbusA320 GetAdvancedData()
        {
            SelfWeight selfWeight = this.GetSelfWeight();

            Fuel takeoffFuel = this.GetTakeoffFuel();

            Fuel landingFuel = this.GetLandingFuel();

            Cargo cargo1 = this.GetCargo1();

            Cargo cargo3 = this.GetCargo3();

            Cargo cargo4 = this.GetCargo4();

            Cargo cargo5 = this.GetCargo5();

            PSGComp psgOA = this.GetPsgOA();

            PSGComp psgOB = this.GetPsgOB();

            PSGComp psgOC = this.GetPsgOC();

            AirbusA320 a320 = new AirbusA320
            {
                SelfWeight  = selfWeight,
                TakeoffFuel = takeoffFuel,
                LandingFuel = landingFuel,
                Cargo1      = cargo1,
                Cargo3      = cargo3,
                Cargo4      = cargo4,
                Cargo5      = cargo5,
                PsgOA       = psgOA,
                PsgOB       = psgOB,
                PsgOC       = psgOC
            };

            a320.Calc();

            return(a320);
        }
Example #5
0
        static void Main(string[] args)
        {
            // Mediator patterns defines an object that encapsulates how a set of objects interact between themselves.
            // Communication between objects is encapsulated in a mediator object. Objects do not communicate directly with each other, but through the mediator.
            var airbusGaruda    = new AirbusA320("Garuda Indonesia", 10000);
            var airbusThai      = new AirbusA320("Thai Airways", 25000);
            var boeingSingapore = new Boeing777("Singapore Airlines", 35000);

            var trafficController = new AirTrafficController();

            trafficController.Register(airbusGaruda);
            trafficController.Register(airbusThai);
            trafficController.Register(boeingSingapore);

            airbusThai.SendMessage(trafficController, "Sawasdee krab");
            airbusGaruda.SendMessage(trafficController, "Apa kabar");

            Console.WriteLine("======================================================");
            Console.WriteLine("Note: Singapore Airlines does not sending any messages");
            Console.WriteLine("======================================================");
            Console.ReadKey();
        }