Inheritance: PrinterWindows
コード例 #1
0
        public static void IMPAbstractFactory()
        {
            //Google
            IMobilePhone googleMobilePhone = new Google();
            MobileClient googleClient      = new MobileClient(googleMobilePhone);

            Console.WriteLine("******* Google **********");
            Console.WriteLine(googleClient.GetSmartPhoneModelDetails());
            Console.WriteLine(googleClient.GetNormalPhoneModelDetails());

            //NOKIA
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());



            //SAMSUNG
            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("SamsungId,imageName,SamsungAciklama,SamsungFiyat")] Samsung samsung)
        {
            if (id != samsung.SamsungId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(samsung);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SamsungExists(samsung.SamsungId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(samsung));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Samsung samsung = db.Samsungs.Find(id);

            db.Samsungs.Remove(samsung);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        static void Main(string[] args)
        {
            #region Example01
            Console.WriteLine("********* Example01 **********");
            ContinentFactory africa = new AfricaFactory();
            AnimalWorld      world  = new AnimalWorld(africa);
            world.RunFoodChain();


            ContinentFactory america = new AmericaFactory();
            world = new AnimalWorld(america);
            world.RunFoodChain();

            #endregion

            Console.WriteLine("");

            #region Example02
            Console.WriteLine("********* Example02 **********");
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());

            #endregion

            Console.WriteLine("");

            #region Example03
            Console.WriteLine("********* Example03 **********");
            Document[] documents = new Document[2];

            documents[0] = new Resume();
            documents[1] = new Report();

            // Display document pages

            foreach (Document document in documents)
            {
                Console.WriteLine("\n" + document.GetType().Name + "--");
                foreach (Page page in document.Pages)
                {
                    Console.WriteLine(" " + page.GetType().Name);
                }
            }
            #endregion

            Console.ReadKey();
        }
コード例 #5
0
 // GET: /Action/GoSmart
 public ActionResult GoSmart()
 {
     Screen.EnsureScreenOn(false);
     Running.StartStream("SmartTv");
     Screen.WaitForScreenOn();
     Receiver.SelectTvInput();
     Receiver.SelectTVOutput();
     Samsung.SendKey("CONTENTS");
     return(Content(""));
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: otimucin/abstractexample
        static void Main(string[] args)
        {
            Iphone iphone = new Iphone();

            iphone.Fiyat();

            Samsung samsung = new Samsung();

            samsung.Fiyat();
        }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "phones,Galaxy1,Galaxy2,Galaxy3")] Samsung samsung)
 {
     if (ModelState.IsValid)
     {
         db.Entry(samsung).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(samsung));
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: RomanArhipov/New
    static void Main(string[] args)
    {
        AppleStore appleStore = new AppleStore();
        Samsung    samsung    = new Samsung();

        appleStore.Catalog();
        samsung.Catalog();

        Console.Read();
    }
コード例 #9
0
        public async Task <IActionResult> Create([Bind("SamsungId,Name,Model,Year")] Samsung samsung)
        {
            if (ModelState.IsValid)
            {
                _context.Add(samsung);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(samsung));
        }
コード例 #10
0
        public ActionResult Create([Bind(Include = "phones,Galaxy1,Galaxy2,Galaxy3")] Samsung samsung)
        {
            if (ModelState.IsValid)
            {
                db.Samsungs.Add(samsung);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(samsung));
        }
コード例 #11
0
        public void SamsungPhoneTest()
        {
            IMobilePhone SamsungMobilePhone = new Samsung();
            MobileClient SamsungClient      = new MobileClient(SamsungMobilePhone);

            var descriptionNormalPhone = SamsungClient.GetNormalPhoneModelDetails();
            var descriptionSmartPhone  = SamsungClient.GetSmartPhoneModelDetails();

            descriptionNormalPhone.Equals(Description.SamsungGuru).Should().BeTrue();
            descriptionSmartPhone.Equals(Description.SamsungGalaxy).Should().BeTrue();
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: Mas3oude/DesignPattrens
        static void Main(string[] args)
        {
            #region 01 Creation Patterns
            #region 01 Abstract Factory
            //ISmartPhone smartPhone;
            //INormalPhone normalPhone;

            IMobilePhone nokiaPhone = new Nokia();

            Console.WriteLine(nokiaPhone.GetNormalPhone().GetModelDetials());
            Console.WriteLine(nokiaPhone.GetSmartPhone().GetModelDetials());


            IMobilePhone samsungPhone = new Samsung();
            Console.WriteLine(samsungPhone.GetNormalPhone().GetModelDetials());
            Console.WriteLine(samsungPhone.GetSmartPhone().GetModelDetials());
            #endregion


            #region 02 Factory Method
            //Document[] documents = new Document[2];
            var documents = new List <Document>();
            documents.Add(new Resume());
            documents.Add(new Report());

            foreach (var item in documents)
            {
                Console.WriteLine("-" + item.GetType().Name);
                foreach (var page in item.Pages)
                {
                    Console.WriteLine("   -" + page.GetType().Name);
                }
            }
            #endregion

            #endregion

            #region 02 Structural Patterns
            #region 07 Proxy
            IMath proxy = new MathProxy();

            Console.WriteLine("4 + 2 = " + proxy.Add(4, 2));
            Console.WriteLine("4 - 2 = " + proxy.Sub(4, 2));
            Console.WriteLine("4 * 2 = " + proxy.Mul(4, 2));
            Console.WriteLine("4 / 2 = " + proxy.Div(4, 2));
            #endregion
            #endregion

            #region 03 Behavioral Patterns
            #endregion
            FinishProgram();
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: MegaDr/Abstraction
        static void Main(string[] args)
        {
            Smartphone smartphone;

            smartphone = new xiaomi();
            smartphone.Beroperasi();

            Console.WriteLine();
            smartphone = new Samsung();
            smartphone.Beroperasi();

            Console.ReadKey();
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: arifenha/Abstraction
        static void Main(string[] args)
        {
            ISmartphone ismartphone;


            ismartphone = new Iphone();
            ismartphone.Merk();

            Console.WriteLine();
            ismartphone = new Samsung();
            ismartphone.Merk();
            Console.ReadKey();
        }
コード例 #15
0
        static void Main(string[] args)
        {
            //Abstract Factorys.
            var nokiaFactory   = new Nokia();
            var samsungFactory = new Samsung();

            var nokiaClient   = new MobileClient(nokiaFactory);
            var samsungClient = new MobileClient(samsungFactory);

            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.ReadLine();
        }
コード例 #16
0
        public static Samsung CreateJ5Samsung(string countryOrigin)
        {
            var samsungJ5 = new Samsung()
            {
                Battery         = "3000 mAh",
                Camera          = "13px",
                Display         = "fewfew",
                OperatingSystem = "Android",
                CountryOrigin   = countryOrigin
            };

            return(samsungJ5);
        }
コード例 #17
0
 public TV BuildTV(Brands thisKind) {
     TV newSet;
     
     switch (thisKind) {
         case Brands.Samsung :
             Samsung aSamsungTV = new Samsung();
             aSamsungTV.BacklightIntensity = double.MinVal;
             aSamsungTV.AutoShutdownTime = 45;    //oops! I made a magic number. My bad
             newSet = aSamsungTV;
             SetAutoShutDownTime = new delegate (newSet.SetASDT);
             break;
         . . .
     } // switch
 }
コード例 #18
0
        // GET: Samsungs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Samsung samsung = db.Samsungs.Find(id);

            if (samsung == null)
            {
                return(HttpNotFound());
            }
            return(View(samsung));
        }
コード例 #19
0
        static void InheritanceExample1()
        {
            Samsung samsung = new Samsung();

            samsung.Display();
            samsung.Manufacturer     = "Samsung";
            samsung.Model            = "S8";
            samsung.OperatingSystem  = "Oreo";
            samsung.ScreenSize       = 6.2;
            samsung.RezolutionHeight = 2960;
            samsung.RezolutionWidth  = 1440;
            samsung.Display();

            Console.ReadKey();
        }
コード例 #20
0
        static void Main(string[] args)
        {
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());

            Console.Read();
        }
コード例 #21
0
        static void Main(string[] args)
        {
            Iphone iphone = new Iphone();

            iphone.Fiyat = 4000;
            iphone.Bilgiler();

            Console.WriteLine("----");

            Samsung samsung = new Samsung();

            samsung.Fiyat = 2000;
            samsung.Bilgiler();

            Console.ReadLine();
        }
コード例 #22
0
        public static void AbstractFactory()
        {
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());
        }
コード例 #23
0
        static void Main(string[] args)
        {
            //AbtractionClass

            //Handphone handphone;

            //Console.WriteLine();
            //handphone = new Samsung();
            //handphone.Buatan();

            //Console.WriteLine();
            //handphone = new Vivo();
            //handphone.Buatan();

            //Console.WriteLine();
            //handphone = new Xiaomi();
            //handphone.Buatan();



            //Interface

            IHandphone handphone;
            ILokasi    lokasi;

            handphone = new Samsung();
            handphone.Buatan();
            lokasi = new Samsung();
            lokasi.Kota();

            Console.WriteLine();
            handphone = new Vivo();
            handphone.Buatan();
            lokasi = new Vivo();
            lokasi.Kota();

            Console.WriteLine();
            handphone = new Xiaomi();
            handphone.Buatan();
            lokasi = new Xiaomi();
            lokasi.Kota();



            Console.ReadKey();
        }
コード例 #24
0
        public static string MainFn()
        {
            string       result           = string.Empty;
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            result += nokiaClient.GetSmartPhoneModelDetails();
            result += nokiaClient.GetNormalPhoneModelDetails();

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            result += samsungClient.GetSmartPhoneModelDetails();
            result += samsungClient.GetNormalPhoneModelDetails();

            return(result);
        }
コード例 #25
0
ファイル: Program.cs プロジェクト: Cabodevel/DesignPatterns
        private static void GetAbstractFactoryPattern()
        {
            ImobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            ImobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());

            Console.ReadKey();
        }
コード例 #26
0
        private static void Main()
        {
            IMobilePhone nokiaMobilePhone = new Nokia();
            var          nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            IMobilePhone samsungMobilePhone = new Samsung();
            var          samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());

            Console.ReadKey();
        }
コード例 #27
0
        static void Main(string[] args)
        {
            ITelemovel      nokiaTelemovel = new Nokia();
            TelemovelClient nokiaClient    = new TelemovelClient(nokiaTelemovel);

            Console.WriteLine("*************** NOKIA ***************");
            Console.WriteLine(nokiaClient.BuscarSmartPhoneModeloDetalhes());
            Console.WriteLine(nokiaClient.BuscarNormalPhoneModeloDetalhes());

            ITelemovel      samsungTelemovel = new Samsung();
            TelemovelClient samsungClient    = new TelemovelClient(samsungTelemovel);

            Console.WriteLine("*************** SAMSUNG ***************");
            Console.WriteLine(samsungClient.BuscarSmartPhoneModeloDetalhes());
            Console.WriteLine(samsungClient.BuscarNormalPhoneModeloDetalhes());

            Console.ReadKey();
        }
コード例 #28
0
        static void Main(string[] args)
        {
            IObserverUser mehmet = new ObserverUser();
            IObserverUser derya  = new ObserverUser();
            IObserverUser sema   = new ObserverUser();
            IObserverUser aleyna = new ObserverUser();


            // İzlenecek olan sınıf örneği.
            Samsung samsung = new Samsung();

            // İzlenecek olan sınıfa etkilenecek olan nesnelerin atanması.
            samsung.AddObserver(mehmet);
            samsung.AddObserver(derya);
            samsung.AddObserver(sema);
            samsung.AddObserver(aleyna);

            samsung.ChangePrice();
        }
コード例 #29
0
    static void Main(string[] args)
    {
        Director director = new Director();

        Samsung samsung = new Samsung();

        director.Builder = samsung;

        Console.WriteLine("Basic samsung complectation:\n");
        director.Basic();
        Console.WriteLine(samsung.GetComplectation().ListParts());

        Console.WriteLine("Standard samsung complectation:\n");
        director.Standart();
        Console.WriteLine(samsung.GetComplectation().ListParts());

        Console.WriteLine("Lux samsung complectation:\n");
        director.Lux();
        Console.WriteLine(samsung.GetComplectation().ListParts());

        Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-\n");

        Nokia nokia = new Nokia();

        director.Builder = nokia;

        Console.WriteLine("Basic nokia complectation:\n");
        director.Basic();
        Console.WriteLine(nokia.GetComplectation().ListParts());

        Console.WriteLine("Standard nokia complectation:\n");
        director.Standart();
        Console.WriteLine(nokia.GetComplectation().ListParts());

        Console.WriteLine("Lux nokia complectation:\n");
        director.Lux();
        Console.WriteLine(nokia.GetComplectation().ListParts());



        Console.ReadLine();
    }
コード例 #30
0
        private static void Observer()
        {
            // Güncellemeden etkilenecek olan sınıf örnekleri.
            IObserverUser mehmet = new ObserverUser();
            IObserverUser derya  = new ObserverUser();
            IObserverUser sema   = new ObserverUser();
            IObserverUser aleyna = new ObserverUser();


            // İzlenecek olan sınıf örneği.
            Samsung samsung = new Samsung();

            // İzlenecek olan sınıfa etkilenecek olan nesnelerin atanması.
            samsung.AddObserver(mehmet);
            samsung.AddObserver(derya);
            samsung.AddObserver(sema);
            samsung.AddObserver(aleyna);

            samsung.ChangePrice();
        }
コード例 #31
0
ファイル: SamsungTVSetup.cs プロジェクト: yartat/Auto3D
        public void TVAdded(ref Samsung.iRemoteWrapper.TVInfo info)
        {
            comboBoxTV.Items.Add(info);

              String tv = comboBoxTV.Items[0].ToString();

              using (Settings reader = new MPSettings())
              {
            tv = reader.GetValueAsString("Auto3DPlugin", "SamsungAddress", info.ToString());
              }

              foreach (Samsung.iRemoteWrapper.TVInfo item in comboBoxTV.Items)
              {
            if (item.ToString() == info.ToString())
            {
              comboBoxTV.SelectedItem = item;
              break;
            }
              }

              comboBoxTV.SelectedItem = info;
        }
コード例 #32
0
ファイル: SamsungTVSetup.cs プロジェクト: yartat/Auto3D
        public void TVRemoved(ref Samsung.iRemoteWrapper.TVInfo info)
        {
            int i = comboBoxTV.FindStringExact(info.ToString());

              if (i > 0)
            comboBoxTV.Items.RemoveAt(i);
        }