Ejemplo n.º 1
0
 public static void Toogle(this IShow thisShow)
 {
     if (thisShow.Shown)
     {
         thisShow.Hide();
     }
     else
     {
         thisShow.Show();
     }
 }
Ejemplo n.º 2
0
        public static void Task1()
        {
            Circle C = new Circle {
                R = 1
            };

            // C.Show();
            TestIShow(C);
            TestICharacterGeometri(C);
            Rectangle R = new Rectangle {
                a = 2, b = 5
            };

            //    R.Show();
            TestIShow(R);
            TestICharacterGeometri(R);
            Human H = new Human {
                Name = "Petro", Bday = new DateTime(1996, 5, 23)
            };

            //   H.Show();
            TestIShow(H);
            // TestICharacterGeometri(H);

            IShow ishow = H;

            ishow.Show();

            Human H2 = (Human)ishow;

            if (ishow is Human H3)
            {
                H3.Name = "Igor";
            }

            // H2.Name = "Ivan";
            // ishow.Name = "";
            ishow.Show();
            //ishow = C;
            //ishow = R;
        }
Ejemplo n.º 3
0
        public void RedirectToWindow(User user)
        {
            switch (user.Role)
            {
            case Roles.Klient:
                _klientView.Show(_top, user);
                break;

            case Roles.Pracownik:
                _pracownikView.Show(_top, user);
                break;
            }
            Application.Run();
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.ShowDialog();
            Assembly ass = Assembly.LoadFrom(openFileDialog1.FileName);

            foreach (Type type in ass.GetTypes())
            {
                if (type.GetInterface("IShow") != null)
                {
                    try
                    {
                        IShow ishow = Activator.CreateInstance(type) as IShow;
                        ishow.Show();
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        static void Main()
        {
            Rect rt = new Rect();

            Console.WriteLine(rt.GetPoint() + "\t" + rt.Points + "\t" + rt[0]);
            Figure[] fg = { new Rect(), new Rect(), new Circle(), new Hexagon() };
            for (int i = 0; i < fg.Length; i++)
            {
                if (fg[i] is IPoint)
                {
                    IPoint ip = fg[i] as IPoint;
                    Console.WriteLine(ip.GetPoint());
                }
                else
                {
                    Console.WriteLine("Not found ");
                }
            }
            IPoint[] arr = { new Hexagon(), new Rect(), new Knife(), new Mountian(), new Circle() as IPoint, new Knife() };



            foreach (var item in arr)
            {
                if (item == null)
                {
                    Console.WriteLine("ArgumentNullException");
                }
                else
                {
                    Console.WriteLine(item.Points);
                }
            }
            var rty = new Rect();

            rty.Show();
            IShow ish = rty;

            ish.Show();
        }
Ejemplo n.º 6
0
 public void Show()
 {
     _show.Show();
 }
Ejemplo n.º 7
0
 public static void TestIShow(IShow ishow)
 {
     ishow.Show();
 }
Ejemplo n.º 8
0
        //static void DengJi(Person c)
        //{
        //    Console.WriteLine("====开始登记====");
        //    c.Show();
        //}

        static void DengJi(IShow c)
        {
            Console.WriteLine("====开始登记====");
            c.Show();
        }