示例#1
0
 void _battery_init()
 {
     if (pBattery == null)
         pBattery = new Panel();
     panel_init(ref pBattery);
     _BatBar = new ProgressODoom.ProgressBarEx();
     _BatProg = new ProgressODoom.PlainProgressPainter();
     ProgressODoom.PlainBorderPainter _BatBorder = new ProgressODoom.PlainBorderPainter(Color.FromArgb(0, 0, 1));
     ProgressODoom.PlainBackgroundPainter _BatBack = new ProgressODoom.PlainBackgroundPainter(Color.FromArgb(90,90,140));
     ProgressODoom.RoundGlossPainter _BatGloss = new ProgressODoom.RoundGlossPainter();
     _BatGloss.Color = Color.WhiteSmoke;
     _BatGloss.TaperHeight = 7;
     _BatGloss.Style = ProgressODoom.GlossStyle.Top;
     _BatProg.GlossPainter = _BatGloss;
     _BatBack.GlossPainter = _BatGloss;
     _BatBar.Width = 110;
     _BatBar.Height = 15;
     _BatBar.Left = 0;
     _BatBar.ProgressPainter = _BatProg;
     _BatBar.BackgroundPainter = _BatBack;
     _BatBar.ForeColor = Color.FromArgb(10, 10, 20);
     _BatBar.Padding = new Padding(0);
     _BatBar.Margin = new Padding(0);
     _BatBar.MouseEnter += new EventHandler(this.pbar_MouseEnter);
     _BatBar.MouseLeave += new EventHandler(this.pbar_MouseLeave);
     _BatBar.MouseDown += new MouseEventHandler(EM_MouseDown);
     _BatBar.MouseMove += new MouseEventHandler(EM_MouseMove);
     _BatBar.DoubleClick += new System.EventHandler(this.lable_DoubleClick);
     lBatLabel = new Label();
     label_init(ref lBatLabel);
     lBatLabel.Text = sTitle[14];
     pBattery.Controls.Add(lBatLabel);
     pBattery.Controls.Add(_BatBar);
 }
示例#2
0
 //init Diskspace progress bar
 void _hddBarInit()
 {
     _pHddGloss.Color = Color.WhiteSmoke;
     _pHddGloss.TaperHeight = 7;
     _pHddGloss.Style = ProgressODoom.GlossStyle.Top;
     _pHddBack.GlossPainter = _pHddGloss;
     for (int i = 0; i < 10; i++)
     {
         if (_hddBar[i] != null)
             _hddBar[i].Dispose();
         _hddBar[i] = new ProgressODoom.ProgressBarEx();
         //_pBar[i].Font =
         // _pBar[i].BorderPainter = _pBorder;
         if (_pHddProg[i] != null)
             _pHddProg[i].Dispose();
         _pHddProg[i] = new ProgressODoom.PlainProgressPainter();
         _pHddProg[i].GlossPainter = _pHddGloss;
         //_pProg[i].ProgressBorderPainter = _pBorder;
         _hddBar[i].Visible = false;
         _hddBar[i].Width = 110;
         _hddBar[i].Height = 15;
         _hddBar[i].Left = 0;
         _hddBar[i].ProgressPainter = _pHddProg[i];
         _hddBar[i].BackgroundPainter = _pHddBack;
         _hddBar[i].ForeColor = Color.FromArgb(10, 10, 20);
         _hddBar[i].Padding = new Padding(0);
         _hddBar[i].Margin = new Padding(0);
         _hddBar[i].MouseEnter +=new EventHandler(this.pbar_MouseEnter);
         _hddBar[i].MouseLeave += new EventHandler(this.pbar_MouseLeave);
         this._hddBar[i].DoubleClick += new System.EventHandler(this.lable_DoubleClick);
      //               this._hddBar[i].MouseDown += new System.Windows.Forms.MouseEventHandler(this.PBAR_MOUSE_DOWN);
         this._hddBar[i].Click += new System.EventHandler(PBAR_MOUSE_DOWN); //has higher priority than MouseDown - important for shell context menu
         pPBar.Controls.Add(_hddBar[i]);
     }
 }
示例#3
0
        /// <summary>
        /// Enables the controls on the form. Do NOT call this function from within a Try Catch statement since it does an Application.Restart.
        /// This should only be called from Backgroundworker ProgressChanged since it access UI elements.
        /// </summary>
        private void EnableControls()
        {
            if (!_isEngineConnected) return; // We only enable controls if the engine is connected

            if (this.WindowState == FormWindowState.Minimized) return; // We don't need to burn CPU cycles updating the GUI if it's minimized

            // Someone changed the configuration remotely or DisableControls was called and the GUI needs to be restart and reset otherwise the size gets messed up
            if ((_maxActiveJobs > 0) && (_maxActiveJobs != MCEBuddyConf.GlobalMCEConfig.GeneralOptions.maxConcurrentJobs))
            {
                _exit = true;
                Application.Restart();
            }

            if (_jobStatus == null) // Do we need to setup the job objects
            {
                _maxActiveJobs = MCEBuddyConf.GlobalMCEConfig.GeneralOptions.maxConcurrentJobs;

                // Before doing anything, unanchor the bottom control from the bottom and anchor to the top otherwise is messes up the layout
                AnchorBottomControls(AnchorStyles.Bottom, false);
                AnchorBottomControls(AnchorStyles.Top, true);
                currentQueue.Anchor &= ~AnchorStyles.Bottom; // Unhinge the bottom to avoid issues

                // Set the new height before adding components to avoid GUI issues
                this.Height = priorityBox.Bottom + ((_maxActiveJobs - 1) * Rescale(_separation)) + Rescale(_priorityBoxPageEndGap); // Start with adjusting the form height otherwise control won't fit, end the form relative to the priority box

                // Create new Job Status bars
                _jobStatus = new ProgressBarEx[_maxActiveJobs];
                _jobLabel = new Label[_maxActiveJobs];
                for (int i = 0; i < _maxActiveJobs; i++)
                {
                    // Label for each progress bar
                    _jobLabel[i] = new Label();
                    _jobLabel[i].Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; // Do this first to avoid issues
                    _jobLabel[i].Location = new System.Drawing.Point((errorMsgLbl.Location.X), (errorMsgLbl.Location.Y) + i * Rescale(_separation));
                    _jobLabel[i].Size = new System.Drawing.Size((errorMsgLbl.Width), Rescale(_jobLabelHeight));
                    _jobLabel[i].TextAlign = ContentAlignment.MiddleCenter;
                    _jobLabel[i].Visible = true;
                    this.Controls.Add(_jobLabel[i]);

                    // Progress bars
                    _jobStatus[i] = new ProgressODoom.ProgressBarEx();
                    _jobStatus[i].Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; // Do this first to avoid issues
                    _jobStatus[i].Location = new System.Drawing.Point((errorMsgLbl.Location.X), (errorMsgLbl.Location.Y) + i * Rescale(_separation) + Rescale(_jobLabelHeight)); // just below the label
                    _jobStatus[i].Size = new System.Drawing.Size((errorMsgLbl.Width), Rescale(_jobStatusHeight));
                    _jobStatus[i].BackgroundPainter = this.plainBackgroundPainter;
                    _jobStatus[i].BorderPainter = this.plainBorderPainter;
                    _jobStatus[i].MarqueePercentage = 25;
                    _jobStatus[i].MarqueeSpeed = 100;
                    _jobStatus[i].MarqueeStep = 1;
                    _jobStatus[i].Maximum = 100;
                    _jobStatus[i].Minimum = 0;
                    _jobStatus[i].Name = "JobStatus" + i.ToString();
                    _jobStatus[i].ProgressPadding = 0;
                    _jobStatus[i].ProgressPainter = this.plainProgressPainter;
                    _jobStatus[i].ProgressType = ProgressODoom.ProgressType.Smooth;
                    _jobStatus[i].ShowPercentage = false;
                    _jobStatus[i].TabIndex = errorMsgLbl.TabIndex; // same tab index as the error message box
                    _jobStatus[i].Value = 0;
                    _jobStatus[i].ForeColor = Color.Brown;
                    _jobStatus[i].Visible = true;
                    this.Controls.Add(_jobStatus[i]);
                }

                // Set component height
                settingsCmd.Top += (_maxActiveJobs - 1) * Rescale(_separation);
                rescanCmd.Top += (_maxActiveJobs - 1) * Rescale(_separation);
                closeCmd.Top += (_maxActiveJobs - 1) * Rescale(_separation);
                priorityBox.Top += (_maxActiveJobs - 1) * Rescale(_separation);
                PriorityLabel.Top += (_maxActiveJobs - 1) * Rescale(_separation);
                remoteEngineCmd.Top += (_maxActiveJobs - 1) * Rescale(_separation);
                serverInfoLbl.Top += (_maxActiveJobs - 1) * Rescale(_separation);
                this.MinimumSize = new Size(this.MinimumSize.Width, this.MinimumSize.Height + (_maxActiveJobs - 1) * Rescale(_separation)); // Do this after increasing the height

                // Now we are done, anchor the control as best required
                if (this.Height >= this.MaximumSize.Height) // We are at maximum size and we are scrolling, anchor to the top otherwise control will dissappear
                {
                    AnchorBottomControls(AnchorStyles.Bottom, false);
                    AnchorBottomControls(AnchorStyles.Top, true);
                }
                else // We can expand, anchor to the bottom
                {
                    AnchorBottomControls(AnchorStyles.Bottom, true);
                    AnchorBottomControls(AnchorStyles.Top, false);
                }
                currentQueue.Anchor |= AnchorStyles.Bottom; // Rehinge the bottom to expand
            }

            errorMsgLbl.Visible = false;

            if (_isEngineRunning)
            {
                startCmd.Enabled = 
                    stopCmd.Enabled =
                    currentQueue.Enabled = 
                    addFileCmd.Enabled =
                    cancelFileCmd.Enabled =
                    rescanCmd.Enabled =
                    settingsCmd.Enabled =
                    priorityBox.Enabled = true;

                settingsCmd.Image = global::MCEBuddy.GUI.Properties.Resources.stop;

                if (!_isEngineSuspended) // Engine is suspended
                {
                    startCmd.Text = Localise.GetPhrase("Pause"); // Allow for pausing
                    startCmd.Image = global::MCEBuddy.GUI.Properties.Resources.media_button_pause_yellow;
                    toolTip.SetToolTip(this.startCmd, Localise.GetPhrase("Pause conversion tasks"));
                }
                else
                {
                    startCmd.Text = " " + Localise.GetPhrase("Resume"); // User has clicked pause
                    startCmd.Image = global::MCEBuddy.GUI.Properties.Resources.media_play_green;
                    toolTip.SetToolTip(this.startCmd, Localise.GetPhrase("Resume conversion tasks"));
                }
            }
            else
            {
                if (_isEngineCrashed) // Check if the Engine has stopped due to a crash
                {
                    errorMsgLbl.Text = Localise.GetPhrase("The MCEBuddy Engine has crashed. Please send mcebuddy.log to the developers");
                    errorMsgLbl.Visible = true;
                }
                else
                    errorMsgLbl.Visible = false;

                startCmd.Enabled =
                    priorityBox.Enabled =
                    settingsCmd.Enabled = true;

                stopCmd.Enabled =
                    currentQueue.Enabled =
                    addFileCmd.Enabled = 
                    cancelFileCmd.Enabled = 
                    rescanCmd.Enabled = false;

                currentQueue.Items.Clear();
                settingsCmd.Image = global::MCEBuddy.GUI.Properties.Resources.control_panel;

                startCmd.Text = Localise.GetPhrase("Start"); // Reset the text
                startCmd.Image = global::MCEBuddy.GUI.Properties.Resources.media_play_green;
                toolTip.SetToolTip(this.startCmd, Localise.GetPhrase("Start the MCEBuddy monitor and conversion tasks"));
            }
        }