Esempio n. 1
0
 public Image(int x, int y, int width, int height, Bitmap bitmap, ushort opacity)
     : base(x, y, width, height)
 {
     brush = new ImageBrush(bitmap);
     brush.Stretch = Stretch.Fill;
     Opacity = opacity;
 }
Esempio n. 2
0
        private void InitUI()
        {
            ImageBrush brush = new ImageBrush(Program.Background);
            //brush.Opacity = 150;// 70;
            brush.Stretch = Stretch.Fill;
            Background = brush;

            #region Title
            //TextFlow textTitle = new TextFlow();
            //textTitle.HorizontalAlignment = HorizontalAlignment.Left;
            //textTitle.TextAlignment = TextAlignment.Left;
            //textTitle.SetMargin(50,150,0,10);
            //Children.Add(textTitle);

            //textTitle.TextRuns.Add("Typhoon", Program.FontCourierNew12, Colors.White);
            //textTitle.TextRuns.Add(" " + Program.Info.Version, Program.FontRegular, Program.LabelTextColor);
            ////textTitle.TextRuns.Add(TextRun.EndOfLine);
            ////textTitle.TextRuns.Add("© Konstantin Kolesnik", Program.FontRegular, Colors.White);
            #endregion

            #region Menu
            //StackPanel panelMenu = new StackPanel(Orientation.Horizontal);
            //panelMenu.HorizontalAlignment = HorizontalAlignment.Right;
            //panelMenu.SetMargin(0, 10, 0, 0);
            //Children.Add(panelMenu);

            int x = 200;
            CreateToolButton(ref x, "scDatabase", "База данных", Program.ImageDatabase);
            CreateToolButton(ref x, "scOperation", "Управление", Program.ImageOperation);
            CreateToolButton(ref x, "scTopology", "Топология", Program.ImageLayout);
            CreateToolButton(ref x, "scSettings", "Настройки", Program.ImageSettings);
            #endregion
        }
Esempio n. 3
0
        public DemoManager(int width, int height, RenderRequestEventHandler renderHandler = null)
        {
            FontRegular = Resources.GetFont(Resources.FontResources.LucidaSansUnicode_8);
            FontCourierNew10 = Resources.GetFont(Resources.FontResources.CourierNew_10);
            FontTitle = Resources.GetFont(Resources.FontResources.SegoeUI_BoldItalian_32);

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

            gm = new GraphicsManager(width, height);
            Desktop = gm.Desktop;
            if (renderHandler != null)
                gm.OnRenderRequest += renderHandler;
        }
Esempio n. 4
0
        static UIManager()
        {
            //if (Mainboard.NativeBitmapConverter == null)
            //    Mainboard.NativeBitmapConverter = new Gadgeteer.Mainboard.BitmapConvertBPP(delegate(byte[] bitmapBytes, byte[] pixelBytes, GT.Mainboard.BPP bpp)
            //    {
            //        if (bpp != GT.Mainboard.BPP.BPP16_BGR_BE)
            //            throw new ArgumentOutOfRangeException("bpp", "Only BPP16_BGR_LE supported");

            //        Util.BitmapConvertBPP(bitmapBytes, pixelBytes, Util.BPP_Type.BPP16_BGR_BE);
            //    });

            //display = new DisplayS22(1);

            // Usage example #1. Passing a Bitmap to the driver.
            //Bitmap bitmap = new Bitmap(Resources.GetBytes(Resources.BinaryResources.test_24b), Bitmap.BitmapImageType.Bmp);
            //display.Draw(bitmap);

            //display.SimpleGraphics.DisplayImage(bitmap, 0, 0);
            ////display.SimpleGraphics.BackgroundColor = GT.Color.Green;
            //display.SimpleGraphics.DisplayText("Igor, mi bogati!", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 5, 5);
            //display.SimpleGraphics.DisplayText("Pivo v studiyu!", Resources.GetFont(Resources.FontResources.small), GT.Color.Red, 5, 25);
            ////Thread.Sleep(2000);
            ////display.SimpleGraphics.Clear();
            //display.SimpleGraphics.DisplayEllipse(GT.Color.Blue, 120, 160, 30, 20);
            //Thread.Sleep(2000);

            //DisplayDemo(display);


            FontRegular = Resources.GetFont(Resources.FontResources.LucidaSansUnicode_8);
            FontCourierNew10 = Resources.GetFont(Resources.FontResources.CourierNew_10);
            FontTitle = Resources.GetFont(Resources.FontResources.SegoeUI_BoldItalian_32);

            gm = new GraphicsManager(320, 240);
            //gm = new GraphicsManager(480, 272);
            //gm = new GraphicsManager(800, 480);
            Desktop = gm.Desktop;

            //desktop.SuspendLayout();

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

            DebugPage = new DebugPage();
            SplashPage = new SplashPage();
            

            //desktop.ResumeLayout();
        }
Esempio n. 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();
        }
Esempio n. 6
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();
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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;
        }
Esempio n. 9
0
        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;
        }
Esempio n. 10
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();
        }