Example #1
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;
        }
Example #2
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;
        }