private void Button_Click(object sender, EventArgs e)
        {
            panelPresentation.SuspendLayout();

            lblActiveDemo.Text = "Presentation: " + (sender as Button).Text;

            if (panelActiveDemo != null)
            {
                panelPresentation.Children.Remove(panelActiveDemo);
                panelActiveDemo = null;
            }

            switch ((sender as Button).Text)
            {
                case "Checkbox": panelActiveDemo = new CheckboxDemo(); break;
                case "Image": panelActiveDemo = new ImageDemo(); break;
                case "Level": panelActiveDemo = new LevelDemo(); break;
                case "Panel": panelActiveDemo = new PanelDemo(); break;
                case "Slider": panelActiveDemo = new SliderDemo(); break;

            }

            if (panelActiveDemo != null)
            {
                panelActiveDemo.X = 1;
                panelActiveDemo.Y = tlb2.Height + 1;
                panelActiveDemo.Width = panelPresentation.Width - 2;
                panelActiveDemo.Height = panelPresentation.Height - tlb2.Height - 2;
                panelPresentation.Children.Add(panelActiveDemo);
            }

            panelPresentation.ResumeLayout();
        }
        public PanelDemo()
            : base(0, 0, 0, 0)
        {
            Panel pnl;

            pnl = new Panel(10, 10, 100, 40);
            pnl.Background = new LinearGradientBrush(Color.Bisque, Color.Green, 0, 500, 1000, 500);
            pnl.Background.Opacity = 80;
            pnl.Border = new Pen(Color.Blue, 2);
            Children.Add(pnl);
        }
Beispiel #3
0
        public DemoPage()
            : base(0, 0, DemoManager.Desktop.Width, DemoManager.Desktop.Height)
        {
            //Background = new SolidColorBrush(Color.CornflowerBlue) { Opacity = 256 };
            Background = new LinearGradientBrush(Color.Bisque, Color.Black, 0, 0, 1000, 1000, 220);

            btnBack = new Button(0, 0, 70, 24, DemoManager.FontCourierNew10, "Back", Color.White) { BackgroundUnpressed = DemoManager.Bar };
            btnBack.Click += btnBack_Click;
            Children.Add(btnBack);

            int y = btnBack.Height + 10;
            Content = new Panel(0, y, Width, Height - y);
            Children.Add(Content);
        }
Beispiel #4
0
        public HomePage()
            : base(0, 0, DemoManager.Desktop.Width, DemoManager.Desktop.Height)
        {
            panelNavigation = new Panel(5, 5, DemoManager.Desktop.Width - 10, DemoManager.Desktop.Height - 10)
            {
                Background = new LinearGradientBrush(Color.Bisque, Color.Black, 0, 0, 1000, 1000, 120),
                Border = new Pen(Color.Black, 1)
            };
            Children.Add(panelNavigation);

            header = new Panel(0, 0, panelNavigation.Width - 0, 25);
            header.Background = DemoManager.Bar;
            header.Children.Add(new Label(10, 5, DemoManager.FontCourierNew10, "Navigation") { ForeColor = Color.CornflowerBlue });
            header.TouchDown += delegate(object sender, TouchEventArgs e) { TouchCapture.Capture(header); p = e.Point; };
            header.TouchMove += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == header) { panelNavigation.Translate(e.Point.X - p.X, e.Point.Y - p.Y); p = e.Point; } };
            header.TouchUp += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == header) TouchCapture.ReleaseCapture(); };
            panelNavigation.Children.Add(header);

            x = margin;
            w = panelNavigation.Width / 2 - 2 * margin;
            y = header.Height + margin;
            step = h + margin;

            AddButton("Level");
            AddButton("ProgressBar");
            AddButton("Image");
            //AddButton("Panel");
            //AddButton("Checkbox");
            //AddButton("Button");
            //AddButton("MultiImage");
            //AddButton("Label");
            //AddButton("RadioButton");
            //AddButton("Slider");
            //AddButton("TextBlock");
            //AddButton("");
            //AddButton("");
            //AddButton("");
            //AddButton("");
            //AddButton("");
            //AddButton("");
        }
Beispiel #5
0
        public static void Demo1()
        {
            GraphicsManager gm = new GraphicsManager(800, 480);

            Desktop desktop = gm.Desktop;

            int k = desktop.Height / 240;
            Font font = Resources.GetFont(Resources.FontResources.CourierNew_10);

            desktop.SuspendLayout();

            ImageBrush brush = new ImageBrush(GetBitmap(Resources.BinaryResources.Background_800_600, Bitmap.BitmapImageType.Jpeg));
            brush.Stretch = Stretch.Fill;
            desktop.Background = brush;

            int statusbarHeight = 24;
            Panel statusbar = new Panel(0, desktop.Height - statusbarHeight, desktop.Width, statusbarHeight);
            statusbar.Background = new ImageBrush(GetBitmap(Resources.BinaryResources.Bar, Bitmap.BitmapImageType.Bmp));
            desktop.Children.Add(statusbar);

            Label lblClock = new Label(statusbar.Width - 70, 4, font, "00:00:00");
            lblClock.ForeColor = Color.White;
            statusbar.Children.Add(lblClock);

            Level lvl2 = new Level(statusbar.Width - 120, 7, 40, 10, Orientation.Horizontal, 10);
            lvl2.Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Black);
            lvl2.Value = 50;
            statusbar.Children.Add(lvl2);

            statusbar.Children.Add(new Image(statusbar.Width - 160, 1, 23, 23, GetBitmap(Resources.BinaryResources.Drive, Bitmap.BitmapImageType.Gif)));
            statusbar.Children.Add(new Image(statusbar.Width - 185, 1, 23, 23, GetBitmap(Resources.BinaryResources.Mouse, Bitmap.BitmapImageType.Gif)));
            statusbar.Children.Add(new Image(statusbar.Width - 210, 1, 23, 23, GetBitmap(Resources.BinaryResources.Keyboard, Bitmap.BitmapImageType.Gif)));

            ////ToolButton btnHome = new ToolButton(10, 0, 70, statusbar.Height);
            //Button btnHome = new Button(10, 0, 70, statusbar.Height, null, "", Color.Black);
            //btnHome.Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Home));
            //btnHome.Border = null;
            ////btnHome.Enabled = false;
            //statusbar.Children.Add(btnHome);

            //-------------------------------

            //desktop.Children.Add(new Checkbox(20*k, 20*k, 20*k, 20*k));
            desktop.Children.Add(new Checkbox(20, 20, 20, 20));

            //return;
            desktop.Children.Add(new TextBlock(50, 10, 100, 100, font, "Hello world! I'm a text block. I'm very cool!")
            {
                ForeColor = Color.White,
                Background = new LinearGradientBrush(Color.Aquamarine, Color.Yellow) { Opacity = 70 },
                TextAlignment = TextAlignment.Center,
                TextVerticalAlignment = VerticalAlignment.Top,
                TextWrap = true
            });

            //    Level lvl = new Level(20, 40, 60, 20, Orientation.Horizontal, 10);
            //    lvl.Foreground = new LinearGradientBrush(Color.Blue, Color.Black);
            //    //lvl.Value = 0;
            //    Children.Add(lvl);

            ProgressBar pg = new ProgressBar(20, 80, 100, 10);
            pg.Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Red);
            //pg.Foreground.Opacity = 220;
            desktop.Children.Add(pg);

            //    Panel pnl = new Panel(20, 100, 100, 100);
            //    pnl.Background = new LinearGradientBrush(Color.Blue, Color.LimeGreen);
            //    //pnl.Background.Opacity = 80;
            //    Children.Add(pnl);

            //    Button btn = new Button(20, 220, 80, 30, font, "<", Color.White);
            //    Children.Add(btn);

            //    Button btn2 = new Button(60, 0, 80, 25, font, "Button 2 wwwwwwww", Color.White)
            //    {
            //        //BackgroundUnpressed = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.ButtonBackground)) { Opacity = 100 };
            //        //BackgroundPressed = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.ButtonBackground)) { Opacity = 220 };
            //    };
            //    btn2.Click += delegate(object sender, EventArgs e)
            //    {
            //        wndModal dlg = new wndModal(0, 0, 0, 0);
            //        dlg.ShowModal();

            //        int a = 0;
            //        int b = a;

            //        //Close();
            //    };
            //    statusbar.Children.Add(btn2);

            //    RadioButtonGroup rbg = new RadioButtonGroup(20, 260, 25, 70);
            //    rbg.Background = new LinearGradientBrush(Color.White, Color.DarkGray);
            //    //rbg.Background.Opacity = 120;
            //    rbg.AddRadioButton(new RadioButton(5, 5, 15, true));
            //    rbg.AddRadioButton(new RadioButton(5, 25, 15));
            //    rbg.AddRadioButton(new RadioButton(5, 45, 15));
            //    Children.Add(rbg);

            //    ToolButton tbtn;

            //    tbtn = new ToolButton(300, 150, 128, 128);
            //    //tbtn.BackgroundUnpressed = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.ButtonBackground)) { Opacity = 100 };
            //    //tbtn.BackgroundPressed = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.ButtonBackground)) { Opacity = 220 };
            //    tbtn.Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Database));
            //    tbtn.Foreground.Opacity = 200;
            //    Children.Add(tbtn);

            //    tbtn = new ToolButton(450, 150, 128, 128);
            //    tbtn.Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Operation));
            //    tbtn.Foreground.Opacity = 200;
            //    Children.Add(tbtn);

            //    tbtn = new ToolButton(600, 150, 128, 128);
            //    tbtn.Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Settings));
            //    tbtn.Foreground.Opacity = 200;
            //    Children.Add(tbtn);

            desktop.Children.Add(new Slider(250, 20, 150, 30, 15, Orientation.Horizontal)
            {
                Value = 80,
                Background = new ImageBrush(GetBitmap(Resources.BinaryResources.Bar, Bitmap.BitmapImageType.Bmp)),
                Foreground = new LinearGradientBrush(Color.LightGray, Color.Black) { Opacity = 50 }
            });
            desktop.Children.Add(new Slider(200, 20, 30, 150, 12, Orientation.Vertical)
            {
                Value = 70,
                Background = new SolidColorBrush(Color.White) { Opacity = 100 }
            });

            //    Slider slider = new Slider(250, 60, 150, 30, 30, Orientation.Horizontal)
            //    {
            //        Value = 80,
            //        Background = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Bar)),
            //        Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.GHILogo)) { Opacity = 200 },
            //    };
            //    Children.Add(slider);
            //    Label lbl = new Label(250, 100, font, slider.Value.ToString()) { ForeColor = Color.White };
            //    Children.Add(lbl);
            //    slider.ValueChanged += delegate(object sender, ValueChangedEventArgs e) { lbl.Text = e.Value.ToString(); };

            new Thread(delegate()
            {
                int v = 0;
                while (true)
                {
                    desktop.SuspendLayout();

                    DateTime dt = DateTime.Now;

                    string hour = (dt.Hour < 10) ? "0" + dt.Hour.ToString() : dt.Hour.ToString();
                    string minute = (dt.Minute < 10) ? "0" + dt.Minute.ToString() : dt.Minute.ToString();
                    string second = (dt.Second < 10) ? "0" + dt.Second.ToString() : dt.Second.ToString();
                    string result = hour + ":" + minute + ":" + second;
                    lblClock.Text = result;

                    v += 10;
                    if (v > 100)
                        v = 0;

                    //lvl.Value = v;
                    pg.Value = v;
                    lvl2.Value = v;

                    //Color temp = ((LinearGradientBrush)pnl.Background).StartColor;
                    //((LinearGradientBrush)pnl.Background).StartColor = ((LinearGradientBrush)pnl.Background).EndColor;
                    //((LinearGradientBrush)pnl.Background).EndColor = temp;
                    //pnl.Invalidate();

                    desktop.ResumeLayout();

                    Thread.Sleep(500);
                }
            }).Start();

            //wndModal wndModal = new wndModal();
            //wndModal.Show();

            desktop.ResumeLayout();
        }
Beispiel #6
0
        public void CrashDemo()
        {
            Panel pnl = new Panel(0, 0, 150, 150);
            //Panel pnl = new Panel(0, 0, 50, 50);
            pnl.Background = new SolidColorBrush(Color.CornflowerBlue);

            int translateValue = 3;

            Desktop.SuspendLayout();
            for (int i = 0; i < 10; i++)
                pnl.Children.Add(new TextBlock(10, 15 * i, 140, 20, FontRegular, "label" + i.ToString()) { ForeColor = Color.Brown });
            Desktop.Children.Add(pnl);
            Desktop.ResumeLayout();

            new Thread(delegate()
            {
                //int n = 0;
                while (true)
                {
                    Desktop.SuspendLayout();

                    DateTime dt = DateTime.Now;
                    int c = pnl.Children.Count;
                    for (int j = 0; j < c; j++)
                    {
                        //dt0 = DateTime.Now;

                        //Label lbl = (Label)Children.GetAt(j);
                        TextBlock lbl = (TextBlock)pnl.Children[j];
                        //Debug.Print("Label text set");
                        lbl.Text = dt.Ticks.ToString();
                        //Thread.Sleep(10);

                        //ts = DateTime.Now - dt0;
                        //n++;
                        //sum += ts;

                        //Debug.Print("MFE: " + ts.ToString());
                        //Debug.Print("MFE (average): " + new TimeSpan(sum.Ticks / n).ToString());
                    }

                    pnl.Translate(translateValue, translateValue);
                    if (pnl.X + pnl.Width >= Desktop.Width - 1)
                        pnl.X = 0;
                    if (pnl.Y + pnl.Height >= Desktop.Height - 1)
                        pnl.Y = 0;

                    Desktop.ResumeLayout();
                }
            }
            ).Start();

            //new Thread(delegate()
            //{
            //    while (true)
            //    {
            //        pnl.Translate(1, 1);

            //        if (pnl.X + pnl.Width >= desktop.Width - 1)
            //            pnl.X = 0;
            //        if (pnl.Y + pnl.Height >= desktop.Height - 1)
            //            pnl.Y = 0;

            //        //Thread.Sleep(100);
            //    }
            //}).Start();
        }
Beispiel #7
0
        public void QuickDemo()
        {
            //CheckCalibration();

            Desktop.SuspendLayout();

            ImageBrush brush = new ImageBrush(GetBitmap(Resources.BinaryResources.reWalls, Bitmap.BitmapImageType.Jpeg));
            brush.Stretch = Stretch.Fill;
            Desktop.Background = brush;

            ImageBrush bar = new ImageBrush(GetBitmap(Resources.BinaryResources.Bar, Bitmap.BitmapImageType.Bmp));

            int statusbarHeight = 24;
            Panel statusbar = new Panel(0, Desktop.Height - statusbarHeight, Desktop.Width, statusbarHeight);
            statusbar.Background = bar;
            Desktop.Children.Add(statusbar);

            Label lblClock = new Label(statusbar.Width - 50, 4, FontRegular, "00:00:00");
            lblClock.ForeColor = Color.White;
            statusbar.Children.Add(lblClock);

            Level lvl2 = new Level(statusbar.Width - 100, 7, 40, 10, Orientation.Horizontal, 10)
            {
                Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Black),
                Value = 0
            };
            statusbar.Children.Add(lvl2);

            Image img;
            int size = 100;
            Bitmap bmp = GetBitmap(Resources.BinaryResources.Operation, Bitmap.BitmapImageType.Gif);
            //img = new Image(20, 10, size, size, bmp);
            //desktop.Children.Add(img);
            //img = new Image(150, 10, size + 100, size, bmp);
            //desktop.Children.Add(img);
            //img = new Image(20, 150, size, size, bmp) { Border = new Pen(Color.Red, 2) };
            //desktop.Children.Add(img);
            //img = new Image(150, 150, size, size, bmp) { Opacity = 80 };
            //desktop.Children.Add(img);
            img = new Image(20, 20, size, size, bmp)
            {
                Opacity = 210,
                Background = new LinearGradientBrush(Color.LimeGreen, Color.CornflowerBlue) { Opacity = 180 }
            };
            Desktop.Children.Add(img);

            Slider sl = new Slider(160, 20, 30, 100, 12, Orientation.Vertical)
            {
                Value = 0,
                //Background = new SolidColorBrush(Color.CornflowerBlue) { Opacity = 100 }
                Background = bar,
            };
            Desktop.Children.Add(sl);

            Level lvl = new Level(20, 150, 30, 60, Orientation.Vertical, 10)
            {
                Value = 0,
                Background = new LinearGradientBrush(Color.LimeGreen, Color.CornflowerBlue) { Opacity = 180 },
                Foreground = new LinearGradientBrush(Color.Blue, Color.Red) { Opacity = 210 }
            };
            Desktop.Children.Add(lvl);

            Desktop.Children.Add(new Button(120, 170, 90, 24, FontRegular, "Click me", Color.White) { BackgroundUnpressed = bar });

            Desktop.ResumeLayout();

            new Thread(() =>
            {
                int v = 0;
                string hour;
                string minute;
                string second;

                while (true)
                {
                    Desktop.SuspendLayout();

                    //DateTime dt = RealTimeClock.GetTime();
                    DateTime dt = DateTime.Now;

                    hour = (dt.Hour < 10) ? "0" + dt.Hour.ToString() : dt.Hour.ToString();
                    minute = (dt.Minute < 10) ? "0" + dt.Minute.ToString() : dt.Minute.ToString();
                    second = (dt.Second < 10) ? "0" + dt.Second.ToString() : dt.Second.ToString();
                    lblClock.Text = hour + ":" + minute + ":" + second;

                    v += 10;
                    if (v > 100)
                        v = 0;

                    lvl.Value = v;
                    //pg.Value = v;
                    lvl2.Value = v;
                    sl.Value = v;

                    Color temp = ((LinearGradientBrush)img.Background).StartColor;
                    ((LinearGradientBrush)img.Background).StartColor = ((LinearGradientBrush)img.Background).EndColor;
                    ((LinearGradientBrush)img.Background).EndColor = temp;

                    Desktop.ResumeLayout();

                    //Thread.Sleep(200);
                }
            }).Start();
        }
        private void Demo()
        {
            Background = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.reWalls)) { Stretch = Stretch.Fill };

            ImageBrush bar = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Bar));

            // left panel
            Panel panelNavigation = new Panel(10, 10, 150, 460);
            panelNavigation.Background = new LinearGradientBrush(Color.Bisque, Color.Black, 0, 500, 1000, 500);
            panelNavigation.Background.Opacity = 120;
            panelNavigation.Border = new Pen(Color.Black, 1);
            Children.Add(panelNavigation);

            Panel tlb = new Panel(1, 1, panelNavigation.Width - 2, 25);
            tlb.Background = bar;
            tlb.Children.Add(new Label(10, 5, fontCourierNew10, "Navigation") { ForeColor = Color.CornflowerBlue });
            tlb.TouchDown += delegate(object sender, TouchEventArgs e) { TouchCapture.Capture(tlb); p = e.Point; };
            tlb.TouchMove += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == tlb) { panelNavigation.Translate(e.Point.X - p.X, e.Point.Y - p.Y); p = e.Point; } };
            tlb.TouchUp += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == tlb) TouchCapture.ReleaseCapture(); };
            panelNavigation.Children.Add(tlb);

            //int d = 15;
            //int x = 0;
            ////int y = 5;
            //RadioButtonGroup rbgNavigation = new RadioButtonGroup(10, 30, 15, panelNavigation.Height - 40);
            //panelNavigation.Children.Add(rbgNavigation);
            //rbgNavigation.AddRadioButton(new RadioButton(x, 5, d, true));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 25, d));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 45, d));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 65, d));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 85, d));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 105, d));

            //panelNavigation.Children.Add(new Label(30, 35, fontCourierNew10, "Checkboxes") { ForeColor = Color.White });
            //panelNavigation.Children.Add(new Label(30, 55, fontCourierNew10, "Buttons") { ForeColor = Color.White });

            int x = 5;
            int w = panelNavigation.Width - 2 * x;
            int h = 18;
            int y = 35;
            int step = h + 5;

            //Font fnt = fontRegular;
            Font fnt = fontCourierNew10;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Checkbox", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Button", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Image", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Label", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Level", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "MultiImage", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Panel", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "ProgressBar", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "RadioButton", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Slider", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "TextBlock", Color.White) { BackgroundUnpressed = bar }); y += step;
            //panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "", Color.White) { BackgroundUnpressed = bar }); y += step;
            //panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "", Color.White) { BackgroundUnpressed = bar }); y += step;

            foreach (Control ctrl in panelNavigation.Children)
            {
                if (ctrl is Button)
                    (ctrl as Button).Click += new EventHandler(Button_Click);
            }

            // title
            TextBlock txtTitle = new TextBlock(200, panelNavigation.Y, 590, 60, fontTitle, "MFE graphics");
            txtTitle.ForeColor = Color.CornflowerBlue;
            txtTitle.TextAlignment = TextAlignment.Center;
            txtTitle.TextVerticalAlignment = VerticalAlignment.Center;
            Children.Add(txtTitle);

            // right panel
            int yy = txtTitle.Height + 10;
            panelPresentation = new Panel(txtTitle.X, panelNavigation.Y + yy, txtTitle.Width, panelNavigation.Height - yy);
            panelPresentation.Background = new SolidColorBrush(Color.Black);
            panelPresentation.Background.Opacity = 50;
            panelPresentation.Border = new Pen(Color.Black, 1);
            Children.Add(panelPresentation);

            tlb2 = new Panel(1, 1, panelPresentation.Width - 2, 25);
            tlb2.Background = bar;
            tlb2.Children.Add(lblActiveDemo = new Label(10, 5, fontCourierNew10, "Presentation: [Please select control type on the left]") { ForeColor = Color.CornflowerBlue });
            tlb2.TouchDown += delegate(object sender, TouchEventArgs e) { TouchCapture.Capture(tlb2); p = e.Point; };
            tlb2.TouchMove += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == tlb2) { panelPresentation.Translate(e.Point.X - p.X, e.Point.Y - p.Y); p = e.Point; } };
            tlb2.TouchUp += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == tlb2) TouchCapture.ReleaseCapture(); };
            panelPresentation.Children.Add(tlb2);
        }
        private Control InitStatusBar()
        {
            Panel statusPanel = new Panel(0, Height - 32, Width, 32);
            statusPanel.Background = new ImageBrush(Program.ToolbarBackground) { Opacity = Program.ToolbarOpacity, Stretch = Stretch.Fill };

            // left part
            btnHome = new Button(0, 0, 70, 32) { Foreground = new ImageBrush(Program.ImageHome) };//, new Image(Program.ImageHome, 22));
            btnHome.Border = null;
            btnHome.Click += new EventHandler(btnHome_Click);
            statusPanel.Children.Add(btnHome);

            // right part
            int x = statusPanel.Width - 400;

            iconUSBMassSrorage = new Image(x, 0, Program.ButtonLargeIconSize, Program.ButtonLargeIconSize, Program.ImageDrive);
            iconUSBMassSrorage.Visible = USBDeviceManager.GetCount(USBH_DeviceType.MassStorage) != 0;
            statusPanel.Children.Add(iconUSBMassSrorage);
            x += iconUSBMassSrorage.Width + 4;

            iconUSBMouse = new Image(x, 0, Program.ButtonLargeIconSize, Program.ButtonLargeIconSize, Program.ImageMouse);
            iconUSBMouse.Visible = USBDeviceManager.GetCount(USBH_DeviceType.Mouse) != 0;
            statusPanel.Children.Add(iconUSBMouse);
            x += iconUSBMouse.Width + 4;

            iconUSBKeyboard = new Image(x, 0, Program.ButtonLargeIconSize, Program.ButtonLargeIconSize, Program.ImageKeyboard);
            iconUSBKeyboard.Visible = USBDeviceManager.GetCount(USBH_DeviceType.Keyboard) != 0;
            statusPanel.Children.Add(iconUSBKeyboard);
            x += iconUSBKeyboard.Width + 4;

            iconNetwork = new MultiImage(x, 0, Program.ButtonLargeIconSize, Program.ButtonLargeIconSize);
            iconNetwork["NetworkOn"] = new ImageBrush(Program.ImageNetworkOn);
            iconNetwork["NetworkOff"] = new ImageBrush(Program.ImageNetworkOff);
            iconNetwork.ActiveBrushID = "NetworkOff";
            statusPanel.Children.Add(iconNetwork);
            x += iconNetwork.Width + 8;

            statusPanel.Children.Add(InitBoosterUIBlock(ref x, out iconMainBooster1State, out lblMainBooster1Current, out lvlMainBooster1Current));
            statusPanel.Children.Add(InitBoosterUIBlock(ref x, out iconMainBooster2State, out lblMainBooster2Current, out lvlMainBooster2Current));
            statusPanel.Children.Add(InitBoosterUIBlock(ref x, out iconProgBoosterState, out lblProgBoosterCurrent, out lvlProgBoosterCurrent));

            x += 4;
            btnPower = new Button(x, 0, 70, Program.ButtonLargeIconSize);
            btnPower.Foreground = new ImageBrush(Program.ImagePowerOff);
            btnPower.Border = null;
            btnPower.Click += new EventHandler(btnPower_Click);
            statusPanel.Children.Add(btnPower);
            x += btnPower.Width + 10;

            lblClock = new Label(x, 9, Program.FontRegular, "00:00:00") { ForeColor = Program.LabelTextColor };
            statusPanel.Children.Add(lblClock);

            return statusPanel;
        }
        private Control InitBoosterUIBlock(ref int x, out MultiImage miconBoosterState, out Label lblBoosterCurrent, out Level lvlBoosterCurrent)
        {
            Panel panelBooster = new Panel(x, 0, 30, 32);

            miconBoosterState = new MultiImage(9, 0, 12, 12);
            miconBoosterState["LedGray"] = new ImageBrush(Program.ImageLedGray);
            miconBoosterState["LedGreen"] = new ImageBrush(Program.ImageLedGreen);
            miconBoosterState["LedRed"] = new ImageBrush(Program.ImageLedRed);
            miconBoosterState.ActiveBrushID = "LedGray";
            panelBooster.Children.Add(miconBoosterState);

            lvlBoosterCurrent = new Level(0, 13, 30, 10, Orientation.Horizontal, 10);
            lvlBoosterCurrent.Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Black);
            panelBooster.Children.Add(lvlBoosterCurrent);

            lblBoosterCurrent = new Label(0, 24, Program.FontRegular, "0000 mA") { ForeColor = Program.LabelTextColor };//, Program.LabelTextColor);
            //lblBoosterCurrent.Width = 45;
            //panelBooster.Children.Add(lblBoosterCurrent);

            x += 30 + 8;

            return panelBooster;
        }
Beispiel #11
0
        public void Demo22()
        {
            display = new Display_SP22(1);

            gm = new GraphicsManager(240, 320);
            gm.OnRender += delegate(Bitmap bitmap, Rect dirtyArea)
            {
                display.SimpleGraphics.DisplayImage(bitmap, (uint)dirtyArea.X, (uint)dirtyArea.Y, (uint)dirtyArea.X, (uint)dirtyArea.Y, (uint)dirtyArea.Width, (uint)dirtyArea.Height);
            };

            desktop.SuspendLayout();

            ImageBrush brush = new ImageBrush(Program.GetBitmap(Resources.BinaryResources.reWalls, Bitmap.BitmapImageType.Jpeg));
            brush.Stretch = Stretch.Fill;
            //desktop.Background = brush;

            int statusbarHeight = 24;
            Panel statusbar = new Panel(0, desktop.Height - statusbarHeight, desktop.Width, statusbarHeight);
            statusbar.Background = new ImageBrush(new Bitmap(Resources.GetBytes(Resources.BinaryResources.Bar), Bitmap.BitmapImageType.Bmp));
            desktop.Children.Add(statusbar);

            Label lblClock = new Label(statusbar.Width - 70, 4, fontRegular, "00:00:00");
            lblClock.ForeColor = Color.White;
            statusbar.Children.Add(lblClock);

            Level lvl2 = new Level(statusbar.Width - 120, 7, 40, 10, Orientation.Horizontal, 10);
            lvl2.Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Black);
            lvl2.Value = 50;
            statusbar.Children.Add(lvl2);

            desktop.ResumeLayout();

            new Thread(() =>
            {
                int v = 0;
                while (true)
                {
                    desktop.SuspendLayout();

                    DateTime dt = DateTime.Now;

                    string hour = (dt.Hour < 10) ? "0" + dt.Hour.ToString() : dt.Hour.ToString();
                    string minute = (dt.Minute < 10) ? "0" + dt.Minute.ToString() : dt.Minute.ToString();
                    string second = (dt.Second < 10) ? "0" + dt.Second.ToString() : dt.Second.ToString();
                    string result = hour + ":" + minute + ":" + second;
                    lblClock.Text = result;

                    v += 10;
                    if (v > 100)
                        v = 0;

                    //lvl.Value = v;
                    //pg.Value = v;
                    lvl2.Value = v;

                    //Color temp = ((LinearGradientBrush)pnl.Background).StartColor;
                    //((LinearGradientBrush)pnl.Background).StartColor = ((LinearGradientBrush)pnl.Background).EndColor;
                    //((LinearGradientBrush)pnl.Background).EndColor = temp;
                    //pnl.Invalidate();

                    desktop.ResumeLayout();

                    Thread.Sleep(500);
                }
            }).Start();
        }