Exemplo n.º 1
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box box = new Box(window);

            conformant.SetContent(box);
            box.Show();

            Box horizentalBox = new Box(window)
            {
                IsHorizontal = true,
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
            };

            horizentalBox.Show();

            Button realObject1 = new Button(window)
            {
                Text       = "It is RealObject",
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            realObject1.Show();

            Image realObject2 = new Image(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            realObject2.Load(Path.Combine(TestRunner.ResourceDir, "picture.png"));
            realObject2.Show();

            horizentalBox.PackEnd(realObject1);
            horizentalBox.PackEnd(realObject2);

            EvasImage proxyObject = new EvasImage(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 0.5,
            };
            Button toggle = new Button(window)
            {
                Text       = "Change Source",
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 0.1,
            };

            toggle.Show();

            EvasObject proxyedObject = realObject1;

            toggle.Clicked += (s, e) =>
            {
                if (proxyedObject == realObject1)
                {
                    proxyedObject = realObject2;
                }
                else
                {
                    proxyedObject = realObject1;
                }
                proxyObject.SetSource(proxyedObject);
            };


            proxyObject.IsFilled = true;
            proxyObject.SetSource(realObject1);
            proxyObject.Show();

            box.PackEnd(horizentalBox);
            box.PackEnd(proxyObject);
            box.PackEnd(toggle);
        }
Exemplo n.º 2
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box box = new Box(window);

            conformant.SetContent(box);
            box.Show();

            Image realObject2 = new Image(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            realObject2.Load(Path.Combine(TestRunner.ResourceDir, "picture.png"));
            realObject2.Show();

            EvasImage img1 = new EvasImage(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            img1.IsFilled = true;
            img1.File     = Path.Combine(TestRunner.ResourceDir, "picture.png");
            img1.Show();

            EvasImage img2 = new EvasImage(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            img2.IsFilled = true;
            img2.SetStream(new FileStream(Path.Combine(TestRunner.ResourceDir, "picture.png"), FileMode.Open, FileAccess.Read));
            img2.Show();

            EvasImage img3 = new EvasImage(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            img3.IsFilled = true;
            img3.SetSource(realObject2);
            img3.Show();
            img3.IsSourceVisible = true;

            box.PackEnd(realObject2);
            box.PackEnd(img1);
            box.PackEnd(img2);
            box.PackEnd(img3);
        }