コード例 #1
0
        static void initJediCouncil(JediCouncil council)
        {
            Jedi anakin = new Jedi();

            anakin.Name = "Anakin Skywalker";
            anakin.MidiChlorianCount = 20000;

            Jedi obiwan = new Jedi();

            obiwan.Name = "Obi-Wan Kenobi";
            obiwan.MidiChlorianCount = 10000;

            Jedi mace = new Jedi();

            mace.Name = "Mace Windu";
            mace.MidiChlorianCount = 299;

            Jedi plo = new Jedi();

            plo.Name = "plo koon";
            plo.MidiChlorianCount = 100;

            council.Add(anakin);
            council.Add(obiwan);
            council.Add(mace);
            council.Add(plo);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: testOrgHw/feladat2_tanulo4
        static void dzsedikInicializálása(JediCouncil council)
        {
            Jedi elsoJedi = new Jedi();

            elsoJedi.Nev         = "Anakin Skywalker";
            elsoJedi.KoloniaSzam = 20000;

            Jedi masodik = new Jedi();

            masodik.Nev         = "Obi-Wan Kenobi";
            masodik.KoloniaSzam = 10000;

            Jedi mace = new Jedi();

            mace.Nev         = "Mace Windu";
            mace.KoloniaSzam = 299;

            Jedi plo = new Jedi();

            plo.Nev         = "plo koon";
            plo.KoloniaSzam = 100;

            council.Add(elsoJedi);
            council.Add(masodik);
            council.Add(mace);
            council.Add(plo);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: testOrgHw/feladat2_bobi
        static public void F4()
        {
            JediCouncil Tanács = new JediCouncil();

            Jedi jedi1 = new Jedi();

            jedi1.Name = "Égjáró Anakin";
            jedi1.MidiChlorianCount = 20000;

            Jedi jedi2 = new Jedi();

            jedi2.Name = "Pataki Attila";
            jedi2.MidiChlorianCount = 20;

            Jedi jedi3 = new Jedi();

            jedi3.Name = "Harry Potter";
            jedi3.MidiChlorianCount = 250;

            Tanács.CouncilChanged += MessageReceived;

            Tanács.Add(jedi1);
            Tanács.Add(jedi2);
            Tanács.Add(jedi3);

            foreach (var item in Tanács.GetBeginners())
            {
                Console.WriteLine(item.Name);
            }

            Tanács.Remove();
            Tanács.Remove();
            Tanács.Remove();
        }
コード例 #4
0
        public static void Feladat4()
        {
            // Tanács létrehozása
            JediCouncil council = new JediCouncil();

            council.Valtozas += MessageReceived;

            //Kezdő jedik létrehozása és a tanácshoz adása
            Jedi elso = new Jedi();

            elso.Nev         = "Kezdő Jedi 1";
            elso.KoloniaSzam = 100;
            council.Add(elso);
            Jedi ketto = new Jedi();

            ketto.Nev         = "Kezdő Jedi 2";
            ketto.KoloniaSzam = 200;
            council.Add(ketto);

            //Kezdő jedik kikeresése és tulajdonságaik kiírása
            foreach (Jedi i in council.Kezdok())
            {
                Console.WriteLine("{0}", i.Nev);
            }
        }
コード例 #5
0
        public static void Feladat_4()
        {
            // Tanács létrehozása
            JediCouncil council = new JediCouncil();

            council.CouncilChanged += MessageReceived;

            //Kezdő jedik létrehozása és a tanácshoz adása
            Jedi beginner1 = new Jedi();

            beginner1.Name = "Kezdő Jedi 1";
            beginner1.MidiChlorianCount = 100;
            council.Add(beginner1);
            Jedi beginner2 = new Jedi();

            beginner2.Name = "Kezdő Jedi 2";
            beginner2.MidiChlorianCount = 200;
            council.Add(beginner2);

            //Kezdő jedik kikeresése és tulajdonságaik kiírása
            foreach (Jedi i in council.GetBeginners())
            {
                Console.WriteLine("{0}", i.Name);
            }
        }
コード例 #6
0
 static void Init(JediCouncil council) //feltölti a tanácsot különböző emberekkel
 {
     council.Add(new Jedi("Anakin Skywalker", 20000));
     council.Add(new Jedi("Kylo Ren", 18012));
     council.Add(new Jedi("Han Solo", 200));
     council.Add(new Jedi("Jarjar Bings", 100));
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: FBenji2/C-sharp-hazi-2
 static void BeginnerTest(JediCouncil jediCouncil)
 {
     Console.WriteLine("Kezdő jedik:");
     foreach (var jedi in jediCouncil.GetBeginners())
     {
         Console.WriteLine(jedi.Name);
     }
 }
コード例 #8
0
        static void Main(string[] args)
        {
            JediCouncil council = new JediCouncil();

            feladat2();
            feladat3();
            feladat4(council);

            Console.ReadKey();
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: FBenji2/C-sharp-hazi-2
        static void Main(string[] args)
        {
            CouncilTest();

            JediCouncil jediCouncil = new JediCouncil();

            jediCouncil.Add(new Jedi());
            BeginnerTest(jediCouncil);
            Console.ReadKey();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: FBenji2/C-sharp-hazi-2
        static void CouncilTest()
        {
            JediCouncil council = new JediCouncil();

            council.CouncilChanged += MessageReceived;
            council.Add(new Jedi());
            council.Add(new Jedi());
            council.Remove();
            council.Remove();
        }
コード例 #11
0
        static void Counsel()
        {
            JediCouncil council = new JediCouncil();

            council.CouncilChanged += MessageReceived;        //feliratkozunk az eseményre

            council.Add(new Jedi("Anakin Skywalker", 20000)); //feltöltjük, majd kirugdaljuk az embereket
            council.Add(new Jedi("Kylo Ren", 18012));
            council.Remove();
            council.Remove();
            council.CouncilChanged -= MessageReceived; //leiratkozunk
        }
コード例 #12
0
        static void Beginners() //kigyűjti a kezdőket
        {
            JediCouncil council = new JediCouncil();

            Init(council);                                //feltöltjük a tanácsot tagokkal
            List <Jedi> ujoncok = council.GetBeginners(); //itt történik a szűrés

            foreach (Jedi j in ujoncok)
            {
                Console.WriteLine(j.Name); //kiírjuk a feltételnek megfelelő Jedik neveit
            }
        }
コード例 #13
0
        static void feladat4(JediCouncil council)
        {
            List <Jedi> list = new List <Jedi>();

            //Initializing the 3 jedi to the council
            Initialize(council);
            //Using the filter on the list
            list = council.GetBeginners();
            //Printing out the names
            for (int i = 0; i < list.Count; i++)
            {
                Console.WriteLine(list[i].Name);
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: testOrgHw/feladat2_tanulo4
        static void beginnersTest()
        {
            Console.WriteLine("\n4. Feladat: ");

            JediCouncil council = new JediCouncil();

            dzsedikInicializálása(council);

            //A kezdő Jedik lekérése és kilistázása
            List <Jedi> beginners = council.Kezdok();

            foreach (Jedi j in beginners)
            {
                Console.WriteLine("Nev: {0}\tMidiChlorian szam: {1}", j.Nev, j.KoloniaSzam);
            }
        }
コード例 #15
0
        static void beginnersTest()
        {
            Console.WriteLine("\n4. Feladat: ");

            JediCouncil council = new JediCouncil();

            initJediCouncil(council);

            //A kezdő Jedik lekérése és kilistázása
            List <Jedi> beginners = council.GetBeginners();

            foreach (Jedi j in beginners)
            {
                Console.WriteLine("Nev: {0}\tMidiChlorian szam: {1}", j.Name, j.MidiChlorianCount);
            }
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: testOrgHw/feladat2_tanulo4
        static void jediCouncilTest()
        {
            Console.WriteLine("\n3. Feladat: ");

            JediCouncil council = new JediCouncil();

            //A MessageReceived metódus beregisztrálása a CouncilChanging eseményre
            council.valtozas += MessageReceived;

            dzsedikInicializálása(council);

            council.Torles();
            council.Torles();
            council.Torles();
            council.Torles();

            //A MessageReceived metódus leiratkoztatása a CouncilChanging eseményre
            council.valtozas -= MessageReceived;
        }
コード例 #17
0
        static void jediCouncilTest()
        {
            Console.WriteLine("\n3. Feladat: ");

            JediCouncil council = new JediCouncil();

            //A MessageReceived metódus beregisztrálása a CouncilChanging eseményre
            council.CouncilChanging += MessageReceived;

            initJediCouncil(council);

            council.Remove();
            council.Remove();
            council.Remove();
            council.Remove();

            //A MessageReceived metódus leiratkoztatása a CouncilChanging eseményre
            council.CouncilChanging -= MessageReceived;
        }
コード例 #18
0
        static void Main(string[] args) //a három feladat függvényei hívódnak sorban
        {
            Jedi jedi = new Jedi();     //állatorvosi ló

            jedi.Name = "Obi-Wan";
            jedi.MidiChlorianAmount = 15000;

            XmlSerializer serializer = new XmlSerializer(typeof(Jedi));             //szerializáló inicializálása
            FileStream    stream     = new FileStream("jedi.txt", FileMode.Create); //stream, megadjuk, hogy hova menjen

            serializer.Serialize(stream, jedi);                                     //tényleges szerializáció
            stream.Close();

            FileStream fs    = new FileStream("jedi.txt", FileMode.Open); //kell egy másik tulajdonságú stream, ami nem új fájlt hoz létre, hanem olvas
            Jedi       clone = (Jedi)serializer.Deserialize(fs);          //deszerializálás

            fs.Close();

            Console.WriteLine("Jedi neve: {0},\tTapasztalat: {1}", clone.Name, clone.MidiChlorianAmount);
            //kiírja a console-ra a klón tulajdonságait, ez megegyezik az eredetiével
            JediCouncil council = new JediCouncil();

            council.CouncilChanged += MessageReceived;        //feliratkozunk az eseményre

            council.Add(new Jedi("Anakin Skywalker", 20000)); //feltöltjük, majd kirugdaljuk az embereket
            council.Add(new Jedi("Kylo Ren", 18012));
            council.Remove();
            council.Remove();
            council.CouncilChanged -= MessageReceived; //leiratkozunk
            JediCouncil council = new JediCouncil();

            council.Add(new Jedi("Anakin Skywalker", 20000));
            council.Add(new Jedi("Kylo Ren", 18012));
            council.Add(new Jedi("Han Solo", 200));
            council.Add(new Jedi("Jarjar Bings", 100));
            List <Jedi> ujoncok = council.GetBeginners(); //itt történik a szűrés

            foreach (Jedi j in ujoncok)
            {
                Console.WriteLine(j.Name); //kiírjuk a feltételnek megfelelő Jedik neveit
            }
        }
コード例 #19
0
        //Initalizer to avoid code duplication
        static void Initialize(JediCouncil council)
        {
            //Adding 3 jedi to the council
            Jedi anakin = new Jedi();

            anakin.Name = "Anakin";
            anakin.MidiChlorianCount = 20000;
            council.Add(anakin);

            Jedi yoda = new Jedi();

            yoda.Name = "Yoda";
            yoda.MidiChlorianCount = 19000;
            council.Add(yoda);

            Jedi luke = new Jedi();

            luke.Name = "Luke";
            luke.MidiChlorianCount = 160;
            council.Add(luke);
        }
コード例 #20
0
        public static void Feladat3()
        {
            // Tanács létrehozása
            JediCouncil council = new JediCouncil();

            council.Valtozas += MessageReceived;

            //Jedi tanács feltöltése 2 jedivel
            Jedi jedi1 = new Jedi();

            jedi1.Nev         = "Jedi 1";
            jedi1.KoloniaSzam = 5000;
            council.Add(jedi1);
            Jedi jedi2 = new Jedi();

            jedi2.Nev         = "Jedi 2";
            jedi2.KoloniaSzam = 10000;
            council.Add(jedi2);

            //Tagok törlése
            council.Remove();
            council.Remove();
        }
コード例 #21
0
        public static void Feladat_3()
        {
            // Tanács létrehozása
            JediCouncil council = new JediCouncil();

            council.CouncilChanged += MessageReceived;

            //Jedi tanács feltöltése 2 jedivel
            Jedi jedi1 = new Jedi();

            jedi1.Name = "Jedi 1";
            jedi1.MidiChlorianCount = 5000;
            council.Add(jedi1);
            Jedi jedi2 = new Jedi();

            jedi2.Name = "Jedi 2";
            jedi2.MidiChlorianCount = 10000;
            council.Add(jedi2);

            //Tagok törlése
            council.Remove();
            council.Remove();
        }
コード例 #22
0
ファイル: Program.cs プロジェクト: testOrgHw/feladat2_bobi
        static public void F3()
        {
            JediCouncil Tanács = new JediCouncil();

            Jedi jedi1 = new Jedi();

            jedi1.Name = "Égjáró Anakin";
            jedi1.MidiChlorianCount = 20000;

            Jedi jedi2 = new Jedi();

            jedi1.Name = "Pataki Attila";
            jedi1.MidiChlorianCount = 20;

            //event test, enélkül nem írt ki semmit
            Tanács.CouncilChanged += MessageReceived;

            //tanácshoz adás
            Tanács.Add(jedi1);
            Tanács.Add(jedi2);
            Tanács.Remove();
            Tanács.Remove();
        }
コード例 #23
0
        static void feladat3()
        {
            JediCouncil council = new JediCouncil();

            //Subscription
            council.CouncilChanged += MessageReceived;

            //Adding 2 jedi to the council
            Jedi anakin = new Jedi();

            anakin.Name = "Anakin";
            anakin.MidiChlorianCount = 20000;
            council.Add(anakin);

            Jedi yoda = new Jedi();

            yoda.Name = "Yoda";
            yoda.MidiChlorianCount = 19000;
            council.Add(yoda);

            //Removing the last ones
            council.Remove();
            council.Remove();
        }