public HelpToolTipForm()
 {
     _helpToolTip = new HelpToolTip
     {
         OwnerDraw = true,
     };
 }
Exemple #2
0
 //初始化
 private void AppStart(object sender, EventArgs e)
 {
     HelpToolTip.SetToolTip(CaptionTextBox, "设置消息框的标题。点击左侧标签了解更多。");
     HelpToolTip.SetToolTip(ContentTextBox, "设置消息框的文字内容。点击左侧标签了解更多。");
     HelpToolTip.SetToolTip(IconComboBox, "设置消息框中的图标。点击左侧标签了解更多。");
     HelpToolTip.SetToolTip(ButtonsComboBox, "设置消息框的按钮。点击左侧标签了解更多。");
     HelpToolTip.SetToolTip(OptionsComboBox, "设置消息框的布局。点击左侧标签了解更多。");
 }
Exemple #3
0
        private void Install()
        {
            HelpContent = new Help();
            HelpToolTip = new HelpToolTip();

            HelpToolTipModel.Name    = "";
            HelpToolTipModel.Summary = "";

            OpenHelp();
        }
        private void OnPathTextBox_TextChanged()
        {
            if (PathUtils.IsAbsolutePath(TextBox.Text))
            {
                _pathTypeChangeButton.Text = @"R";
                HelpToolTip.SetToolTip(_pathTypeChangeButton, PathTypeChangeToRelativeToolTip);
                return;
            }

            _pathTypeChangeButton.Text = @"A";
            HelpToolTip.SetToolTip(_pathTypeChangeButton, PathTypeChangeToAbsoluteToolTip);
        }
Exemple #5
0
        public RemoteDebug()
        {
            InitializeComponent();

            bool breakAlways, autoContinue;

            try
            {
                breakAlways  = GetBooleanValueFromKey(Registry.CurrentUser, RegStrings.RootKey, RegStrings.BreakAlwaysValue);
                autoContinue = GetBooleanValueFromKey(Registry.CurrentUser, RegStrings.RootKey, RegStrings.AutoContinueValue);
            }
            catch (NullReferenceException)
            {
                SetAsDefaultButton.Enabled = true;
                autoContinue = false;
                breakAlways  = true;
            }

            // Set the initial state of the dialog
            if (breakAlways)
            {
                BreakRadio.Checked = true;
            }
            else
            {
                RunRadio.Checked = true;
            }
            AutoContinueCheck.Checked = autoContinue;

            // Set up the timer with 500ms interval
            myTimer.Tick += new System.EventHandler(TimerEventProcessor);

            myTimer.Interval = 500;
            myTimer.Start();

            // Set up tool tips
            HelpToolTip.SetToolTip(Label1, "Press the Cancel button to terminate\r\nthis script instead.");
            HelpToolTip.SetToolTip(RunRadio, "Upon continuing, the script will run\r\ninstead of stopping at a DebugBreak.");
            HelpToolTip.SetToolTip(BreakRadio, "Causes a DebugBreak to be performed\r\nas soon as the script continues. A \r\ndebugger MUST be connected.");
            HelpToolTip.SetToolTip(ContinueButton, "Tells your script to run or break,\r\ndepending upon the selected debug\r\naction.");
            HelpToolTip.SetToolTip(Cancel_Button, "Click here to terminate the script.");
            HelpToolTip.SetToolTip(AutoContinueCheck, "If this option is checked, your script \r\nwill continue immediately and perform \r\nthe selected debug action.");
            HelpToolTip.SetToolTip(SetAsDefaultButton, "Saves the current debug action and\r\nauto-connect setting in your personal\r\npreferences.");
        }
Exemple #6
0
        private void InitializeComponent()
        {
            _searchQueryLabel              = new Label();
            _downloadPathLabel             = new Label();
            _searchQueryTextBox            = new SearchQueryTextBox();
            _downloadPathTextBox           = new DerpiAdvancedPathTextBox();
            _downloadProgressBar           = new ProgressBar();
            _logRichTextBox                = new LoggerRichTextBox();
            _startDownloadButton           = new Button();
            _removeOrRestartDownloadButton = new Button();
            _pauseResumeButton             = new Button();
            _downloadValueLabel            = new CurrentMaxValueLabel();
            _helpToolTip = new HelpToolTip();
            SuspendLayout();

            _searchQueryLabel.Location  = new Point(2, -3);
            _searchQueryLabel.Size      = new Size(200, 20);
            _searchQueryLabel.AutoSize  = false;
            _searchQueryLabel.TextAlign = ContentAlignment.MiddleLeft;

            _downloadPathLabel.Location  = new Point(2, 40);
            _downloadPathLabel.Size      = new Size(200, 20);
            _downloadPathLabel.AutoSize  = false;
            _downloadPathLabel.TextAlign = ContentAlignment.MiddleLeft;

            _searchQueryTextBox.Location     = new Point(5, 18);
            _searchQueryTextBox.Size         = new Size(330, 22);
            _searchQueryTextBox.Multiline    = false;
            _searchQueryTextBox.TextAlign    = HorizontalAlignment.Left;
            _searchQueryTextBox.AutoSize     = false;
            _searchQueryTextBox.TextChanged += (sender, args) => OnTextChanged();

            _downloadPathTextBox.Location = new Point(3, 60);
            _downloadPathTextBox.Size     = new Size(332, 22);
            _downloadPathTextBox.AutoSize = false;
            _downloadPathTextBox.PathType = PathType.File;
            _downloadPathTextBox.UpdateAvailableFormatingParts(typeof(Json.Image));
            _downloadPathTextBox.TextChanged      += (sender, args) => OnTextChanged();
            _downloadPathTextBox.Text              = Globals.CurrentDownloadPath;
            _downloadPathTextBox.PathBeenSelected += str => _downloadPathTextBox.Text = Path.Combine(str, Globals.CurrentDownloadFileName.GetValue());

            _startDownloadButton.Location  = new Point(3, 90);
            _startDownloadButton.Size      = new Size(302, 25);
            _startDownloadButton.TextAlign = ContentAlignment.MiddleCenter;
            _startDownloadButton.Click    += OnStartDownloadButton_Click;

            _pauseResumeButton.Location  = new Point(_startDownloadButton.Location.X, _startDownloadButton.Location.Y);
            _pauseResumeButton.Size      = new Size(_startDownloadButton.Size.Width, _startDownloadButton.Size.Height);
            _pauseResumeButton.TextAlign = ContentAlignment.MiddleCenter;
            _pauseResumeButton.Visible   = false;
            _pauseResumeButton.Enabled   = false;
            _pauseResumeButton.Click    += OnPauseResumeButton_Click;

            _removeOrRestartDownloadButton.Location = new Point(304, 90);
            _removeOrRestartDownloadButton.Size     = new Size(30, 30);
            _removeOrRestartDownloadButton.Click   += OnRemoveOrRestartDownloadButtonClick;

            _logRichTextBox.Size        = new Size(200, 75);
            _logRichTextBox.Location    = new Point(340, 15);
            _logRichTextBox.Font        = new Font(Font.Name, Font.Size - 1);
            _logRichTextBox.BorderStyle = BorderStyle.Fixed3D;
            _logRichTextBox.Reversed    = false;

            _downloadProgressBar.Size     = new Size(_startDownloadButton.Size.Width - 3, 5);
            _downloadProgressBar.Location = new Point(5, 115);
            _downloadProgressBar.Style    = ProgressBarStyle.Continuous;

            _downloadValueLabel.Size                   = new Size(_logRichTextBox.Size.Width, 30);
            _downloadValueLabel.Location               = new Point(_logRichTextBox.Location.X, _logRichTextBox.Location.Y + _logRichTextBox.Size.Height);
            _downloadValueLabel.AutoSize               = false;
            _downloadValueLabel.Visible                = false;
            _downloadValueLabel.TextAlign              = ContentAlignment.MiddleLeft;
            _downloadValueLabel.Font                   = new Font(Font.Name, Font.Size + 3);
            _downloadValueLabel.DisplayType            = MathUtils.DisplayType.ValueAndPercent;
            _downloadValueLabel.PercentFractionalCount = 2;

            Controls.Add(_searchQueryLabel);
            Controls.Add(_downloadPathLabel);
            Controls.Add(_searchQueryTextBox);
            Controls.Add(_downloadPathTextBox);
            Controls.Add(_startDownloadButton);
            Controls.Add(_removeOrRestartDownloadButton);
            Controls.Add(_pauseResumeButton);
            Controls.Add(_logRichTextBox);
            Controls.Add(_downloadValueLabel);
            Controls.Add(_downloadProgressBar);
            AcceptButton            = _startDownloadButton;
            Globals.APIKey.Changed += OnTextChanged;
            ResumeLayout();
        }
        private void InitializeComponent()
        {
            _saveSettingsButton        = new Button();
            _resetSettings             = new Button();
            _resetAllSettings          = new Button();
            _apiControl                = new APIControl();
            _toolTip                   = new HelpToolTip();
            _downloadPathLabel         = new Label();
            _downloadPathTextBox       = new DerpiAdvancedPathTextBox();
            _downloadNameLabel         = new Label();
            _downloadNameTextBox       = new DerpiAdvancedPathTextBox();
            _languageLabel             = new Label();
            _languageImagedComboBox    = new LocalizationComboBox(Globals.Localization);
            _proxyButton               = new Button();
            _existFileRewriteCheckBox  = new CheckBox();
            _queueAutoDownloadCheckBox = new CheckBox();
            _forceCloseCheckBox        = new CheckBox();
            _convertSVGToPNGCheckBox   = new CheckBox();
            _notStrictAPICheckCheckBox = new CheckBox();
            _checkHashCheckBox         = new CheckBox();
            _pathLabel                 = new AdditionalsLabel();
            _proxyForm                 = new ProxyForm();
            SuspendLayout();

            _languageLabel.Location = new Point(5, 2);
            _languageLabel.Size     = new Size(120, 15);

            _languageImagedComboBox.Location = new Point(5, 20);
            _languageImagedComboBox.Size     = new Size(120, 20);

            _proxyButton.Location = new Point(3, 46);
            _proxyButton.Size     = new Size(29, 29);
            _proxyButton.Image    = new Bitmap(Images.Others.Proxy, new Size(24, 24));
            _proxyButton.Click   += (sender, args) => _proxyForm.ShowDialog();

            _saveSettingsButton.Location = new Point(5, 225);
            _saveSettingsButton.Size     = new Size(365, 40);
            _saveSettingsButton.UseVisualStyleBackColor = true;
            _saveSettingsButton.Enabled = Globals.APIKey.IsValid;
            Globals.APIKey.Changed     += () => _saveSettingsButton.Enabled = Globals.APIKey.IsValid;
            _saveSettingsButton.Click  += (sender, args) => Save();

            _resetSettings.Location = new Point(_saveSettingsButton.Location.X + _saveSettingsButton.Size.Width, _saveSettingsButton.Location.Y);
            _resetSettings.Size     = new Size(40, 40);
            _resetSettings.Image    = new Bitmap(Images.Line.ResetGear, new Size(24, 24));
            _resetSettings.UseVisualStyleBackColor = true;
            _resetSettings.Click += (sender, args) => OnResetSettingsButtonClick(out _);

            _resetAllSettings.Location = new Point(_resetSettings.Location.X + _resetSettings.Size.Width, _saveSettingsButton.Location.Y);
            _resetAllSettings.Size     = _resetSettings.Size;
            _resetAllSettings.Image    = new Bitmap(Images.Fill.ResetGear, new Size(24, 24));
            _resetAllSettings.UseVisualStyleBackColor = true;
            _resetAllSettings.Click += (sender, args) => OnResetAllSettingsButtonClick();

            _apiControl.Location = new Point(130, 0);
            _apiControl.Size     = new Size(325, 75);

            _downloadPathLabel.Location = new Point(2, 90);
            _downloadPathLabel.Size     = new Size(210, 15);

            _downloadPathTextBox.Location = new Point(5, 110);
            _downloadPathTextBox.Size     = new Size(250, 25);
            _downloadPathTextBox.AutoSize = false;
            _downloadPathTextBox.Text     = Globals.CurrentDownloadFolder.GetValue();
            _downloadPathTextBox.PathTypeChangeButtonEnabled            = false;
            _downloadPathTextBox.TextBox.EnableUniquenessFormatingParts = false;
            _downloadPathTextBox.UpdateAvailableFormatingParts(typeof(Json.Image));
            _downloadPathTextBox.TextChanged       += (sender, args) => OnDownloadPath_TextChanged_PathCheck();
            _downloadPathTextBox.TextBox.LostFocus += (sender, args) => OnLostFocusPathCheck();
            _downloadPathTextBox.PathBeenSelected  += str => _downloadPathTextBox.Text = str;

            _downloadNameLabel.Location = new Point(252, 90);
            _downloadNameLabel.Size     = new Size(210, 15);

            _downloadNameTextBox.Location = new Point(255, 110);
            _downloadNameTextBox.Size     = new Size(195, 25);
            _downloadNameTextBox.AutoSize = false;
            _downloadNameTextBox.PathType = PathType.LocalFile;
            _downloadNameTextBox.Text     = Globals.CurrentDownloadFileName.GetValue();
            _downloadNameTextBox.PathTypeChangeButtonEnabled = false;
            _downloadNameTextBox.PathDialogButtonEnabled     = false;
            _downloadNameTextBox.UpdateAvailableFormatingParts(typeof(Json.Image));
            _downloadNameTextBox.TextChanged       += (sender, args) => OnDownloadName_TextChanged_PathCheck();
            _downloadNameTextBox.TextBox.LostFocus += (sender, args) => OnLostFocusNameCheck();

            Globals.CurrentDownloadFolder.Changed   += OnCurrentPathChanged;
            Globals.CurrentDownloadFileName.Changed += OnCurrentPathChanged;

            _pathLabel.Location  = new Point(2, 140);
            _pathLabel.Size      = new Size(440, 20);
            _pathLabel.AutoSize  = true;
            _pathLabel.TextAlign = ContentAlignment.MiddleLeft;

            _existFileRewriteCheckBox.Location        = new Point(5, 160);
            _existFileRewriteCheckBox.MinimumSize     = new Size(0, 20);
            _existFileRewriteCheckBox.AutoSize        = true;
            _existFileRewriteCheckBox.Checked         = Globals.ExistFileRewrite.GetValue();
            _existFileRewriteCheckBox.CheckedChanged += OnExistFileRewriteCheckBox_Click;

            _queueAutoDownloadCheckBox.Location        = new Point(5, 180);
            _queueAutoDownloadCheckBox.MinimumSize     = new Size(0, 20);
            _queueAutoDownloadCheckBox.AutoSize        = true;
            _queueAutoDownloadCheckBox.Checked         = Globals.QueueAutoDownload.GetValue();
            _queueAutoDownloadCheckBox.CheckedChanged += OnQueueAutoDownloadCheckBox_Click;

            _forceCloseCheckBox.Location        = new Point(5, 200);
            _forceCloseCheckBox.MinimumSize     = new Size(0, 20);
            _forceCloseCheckBox.AutoSize        = true;
            _forceCloseCheckBox.Checked         = Globals.ForceClose.GetValue();
            _forceCloseCheckBox.CheckedChanged += OnForceCloseCheckBox_Click;

            _convertSVGToPNGCheckBox.Location        = new Point(260, 160);
            _convertSVGToPNGCheckBox.MinimumSize     = new Size(0, 20);
            _convertSVGToPNGCheckBox.AutoSize        = true;
            _convertSVGToPNGCheckBox.Checked         = Globals.ConvertSVGToPNG.GetValue();
            _convertSVGToPNGCheckBox.CheckedChanged += OnConvertSVGToPngCheckBox_Click;
            _convertSVGToPNGCheckBox.Enabled         = false;

            _notStrictAPICheckCheckBox.Location        = new Point(260, 180);
            _notStrictAPICheckCheckBox.MinimumSize     = new Size(0, 20);
            _notStrictAPICheckCheckBox.AutoSize        = true;
            _notStrictAPICheckCheckBox.Checked         = Globals.NotStrictAPICheck.GetValue();
            _notStrictAPICheckCheckBox.CheckedChanged += OnNotStrictAPICheckCheckBox_Click;

            _checkHashCheckBox.Location        = new Point(260, 200);
            _checkHashCheckBox.MinimumSize     = new Size(0, 20);
            _checkHashCheckBox.AutoSize        = true;
            _checkHashCheckBox.Checked         = Globals.CheckHash.GetValue();
            _checkHashCheckBox.CheckedChanged += OnCheckHashCheckBox_Click;
            _checkHashCheckBox.Enabled         = false;

            MinimizeBox         = false;
            MaximizeBox         = false;
            ShowInTaskbar       = false;
            AutoScaleDimensions = new SizeF(7F, 15F);
            ClientSize          = new Size(450, 270);
            AutoScaleMode       = AutoScaleMode.Font;
            FormBorderStyle     = FormBorderStyle.FixedDialog;
            Controls.Add(_saveSettingsButton);
            Controls.Add(_resetSettings);
            Controls.Add(_resetAllSettings);
            Controls.Add(_apiControl);
            Controls.Add(_languageLabel);
            Controls.Add(_languageImagedComboBox);
            Controls.Add(_proxyButton);
            Controls.Add(_downloadPathLabel);
            Controls.Add(_downloadPathTextBox);
            Controls.Add(_downloadNameLabel);
            Controls.Add(_downloadNameTextBox);
            Controls.Add(_existFileRewriteCheckBox);
            Controls.Add(_queueAutoDownloadCheckBox);
            Controls.Add(_forceCloseCheckBox);
            Controls.Add(_convertSVGToPNGCheckBox);
            Controls.Add(_notStrictAPICheckCheckBox);
            Controls.Add(_checkHashCheckBox);
            Controls.Add(_pathLabel);
            Icon = ImageUtils.IconFromImage(Images.Line.Settings);
            ResumeLayout();
        }
Exemple #8
0
 protected HelpToolTipForm()
 {
     _helpToolTip = new HelpToolTip();
 }
Exemple #9
0
 public AdvancedTextBox(T textBox)
 {
     AutoSize    = false;
     TextBox     = textBox;
     HelpToolTip = new HelpToolTip();
 }
Exemple #10
0
        private void InitializeComponent()
        {
            _duplicateSearchForm = new DuplicateSearchForm();
            _authorsListForm     = new AuthorsListForm();

            _duplicateSearchButton = new Button();
            _makeAuthorsListButton = new Button();
            _unused2Button         = new Button();
            _unused3Button         = new Button();
            _unused4Button         = new Button();
            _unused5Button         = new Button();

            _helpToolTip = new HelpToolTip();
            SuspendLayout();

            const Int32 buttonSizeWidth  = 150;
            const Int32 buttonSizeHeight = 35;

            _duplicateSearchButton.Location = new Point(0, 0);
            _duplicateSearchButton.Size     = new Size(buttonSizeWidth, buttonSizeHeight);
            _duplicateSearchButton.Enabled  = false;
            _duplicateSearchButton.Click   += (sender, args) => { _duplicateSearchForm.ShowDialog(); };

            _makeAuthorsListButton.Location = new Point(buttonSizeWidth, 0);
            _makeAuthorsListButton.Size     = new Size(buttonSizeWidth, buttonSizeHeight);
            _makeAuthorsListButton.Click   += (sender, args) => { _authorsListForm.ShowDialog(); };

            _unused2Button.Location = new Point(buttonSizeWidth * 2, 0);
            _unused2Button.Size     = new Size(buttonSizeWidth, buttonSizeHeight);
            _unused2Button.Enabled  = false;

            _unused3Button.Location = new Point(0, buttonSizeHeight);
            _unused3Button.Size     = new Size(buttonSizeWidth, buttonSizeHeight);
            _unused3Button.Enabled  = false;

            _unused4Button.Location = new Point(buttonSizeWidth, buttonSizeHeight);
            _unused4Button.Size     = new Size(buttonSizeWidth, buttonSizeHeight);
            _unused4Button.Enabled  = false;

            _unused5Button.Location = new Point(buttonSizeWidth * 2, buttonSizeHeight);
            _unused5Button.Size     = new Size(buttonSizeWidth, buttonSizeHeight);
            _unused5Button.Enabled  = false;


            MinimizeBox         = false;
            MaximizeBox         = false;
            ShowInTaskbar       = false;
            AutoScaleDimensions = new SizeF(7F, 15F);
            ClientSize          = new Size(buttonSizeWidth * 3, buttonSizeHeight * 2);
            AutoScaleMode       = AutoScaleMode.Font;
            FormBorderStyle     = FormBorderStyle.FixedDialog;

            Controls.Add(_duplicateSearchButton);
            Controls.Add(_makeAuthorsListButton);
            Controls.Add(_unused2Button);
            Controls.Add(_unused3Button);
            Controls.Add(_unused4Button);
            Controls.Add(_unused5Button);
            Icon = ImageUtils.IconFromImage(Images.Line.Tech);
            ResumeLayout();
        }
Exemple #11
0
        private void InitializeComponent()
        {
            _addressLabel     = new Label();
            _portLabel        = new Label();
            _colonLabel       = new Label();
            _loginLabel       = new Label();
            _passwordLabel    = new Label();
            _addressTextBox   = new IPTextBox();
            _portTextBox      = new PortTextBox();
            _loginTextBox     = new HidenTextBox();
            _passwordTextBox  = new HidenTextBox();
            _saveProxyButton  = new Button();
            _resetProxyButton = new Button();
            _helpToolTip      = new HelpToolTip();

            _addressLabel.Location = new Point(3, 1);
            _addressLabel.Size     = new Size(100, 15);

            _addressTextBox.Location     = new Point(5, 17);
            _addressTextBox.Size         = new Size(100, 25);
            _addressTextBox.DefaultHost  = @"127.0.0.1";
            _addressTextBox.TextChanged += (sender, args) => CheckAddressValid();

            _colonLabel.Location  = new Point(101, 16);
            _colonLabel.Size      = new Size(10, 25);
            _colonLabel.Font      = new Font(Font.Name, Font.Size + 4);
            _colonLabel.TextAlign = ContentAlignment.TopLeft;
            _colonLabel.Text      = @":";

            _portLabel.Location = new Point(107, 1);
            _portLabel.Size     = new Size(100, 15);

            _portTextBox.Location     = new Point(110, 17);
            _portTextBox.Size         = new Size(36, 25);
            _portTextBox.DefaultPort  = 3128;
            _portTextBox.TextChanged += (sender, args) => CheckAddressValid();

            _loginLabel.Location = new Point(3, 39);
            _loginLabel.Size     = new Size(140, 15);

            _loginTextBox.Location = new Point(5, 54);
            _loginTextBox.Size     = new Size(140, 25);

            _passwordLabel.Location = new Point(3, 75);
            _passwordLabel.Size     = new Size(140, 15);

            _passwordTextBox.Location = new Point(5, 90);
            _passwordTextBox.Size     = new Size(140, 25);

            _saveProxyButton.Location  = new Point(3, 115);
            _saveProxyButton.Size      = new Size(120, 25);
            _saveProxyButton.TextAlign = ContentAlignment.MiddleCenter;
            _saveProxyButton.Click    += SaveProxyButtonClickAsync;

            _resetProxyButton.Location = new Point(123, 114);
            _resetProxyButton.Size     = new Size(_saveProxyButton.Size.Height, _saveProxyButton.Size.Height);
            _resetProxyButton.Image    = new Bitmap(Images.Fill.ResetGear, new Size(_resetProxyButton.Size.Height / 2, _resetProxyButton.Size.Height / 2));
            _resetProxyButton.Click   += ResetProxyButtonClick;

            MinimizeBox         = false;
            MaximizeBox         = false;
            ShowInTaskbar       = false;
            AutoScaleDimensions = new SizeF(7F, 15F);
            ClientSize          = new Size(150, 145);
            AutoScaleMode       = AutoScaleMode.Font;
            FormBorderStyle     = FormBorderStyle.FixedDialog;
            Controls.Add(_addressLabel);
            Controls.Add(_addressTextBox);
            Controls.Add(_portLabel);
            Controls.Add(_portTextBox);
            Controls.Add(_loginLabel);
            Controls.Add(_loginTextBox);
            Controls.Add(_passwordLabel);
            Controls.Add(_passwordTextBox);
            Controls.Add(_saveProxyButton);
            Controls.Add(_resetProxyButton);
            Controls.Add(_colonLabel);
            Icon = ImageUtils.IconFromImage(Images.Others.Proxy);
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            _aboutButton         = new Button();
            _taskCreatorButton   = new Button();
            _settingsButton      = new Button();
            _additionalsButton   = new Button();
            _downloadControl     = new DownloadControl(this);
            _logRichTextBox      = new LoggerRichTextBox();
            _queueRequestListBox = new AdvancedListBox();
            _helpToolTip         = new HelpToolTip();
            _pageControl         = new PageControl <Control>();
            SuspendLayout();

            _pageControl.Size = new Size(LayoutGUI.DownloadControlSizeWidth,
                                         LayoutGUI.MainFormSizeHeight - LayoutGUI.ButtonSizeHeight - LayoutGUI.DistanceBetweenControls);
            _pageControl.Location  = new Point(0, LayoutGUI.ButtonSizeHeight + 1);
            _pageControl.Font      = new Font(Font.Name, Font.Size + 2);
            _pageControl.Position  = TabAlignment.Bottom;
            _pageControl.Alignment = ContentAlignment.BottomCenter;
            _pageControl.NextPageButton.Enabled     = false;
            _pageControl.PreviousPageButton.Enabled = false;
            _pageControl.PageValueLabel.Enabled     = false;
            _pageControl.NextPageButton.Visible     = false;
            _pageControl.PreviousPageButton.Visible = false;
            _pageControl.PageValueLabel.Visible     = false;
            _pageControl.Add(_downloadControl);
            //
            //DownloadControl
            //
            _downloadControl.Location        = new Point(0, 0);
            _downloadControl.Size            = new Size(_pageControl.Size.Width, _pageControl.Size.Height - _pageControl.ButtonHeight);
            _downloadControl.VisibleChanged += (sender, args) => UpdateText();
            //
            // taskCreatorButton
            //
            _taskCreatorButton.Location = new Point(0, 0);
            _taskCreatorButton.Size     = new Size(LayoutGUI.ButtonSizeWidth, LayoutGUI.ButtonSizeHeight);
            _taskCreatorButton.Image    = new Bitmap(Images.Lineal.Plus, new Size(LayoutGUI.ButtonSizeWidth / 2, LayoutGUI.ButtonSizeHeight / 2));
            _taskCreatorButton.UseVisualStyleBackColor = true;
            _taskCreatorButton.Enabled = Globals.APIKey.IsValid;
            _taskCreatorButton.Click  += (sender, args) =>
            {
                if (_downloadControl.CurrentTasks < DownloadControl.MaximumTasks &&
                    (ModifierKeys == Keys.Control || ModifierKeys == (Keys.Shift | Keys.Control)))
                {
                    _downloadControl.AddDownloadTaskControl();
                    return;
                }

                OpenTaskCreatorForm(ModifierKeys.HasFlag(Keys.Shift));
            };
            Globals.APIKey.Changed += () => { _taskCreatorButton.Enabled = Globals.APIKey.IsValid; };
            Globals.APIKey.Changed += () =>
            {
                if (Globals.APIKey.IsValid && _downloadControl.CurrentTasks <= 0)
                {
                    _downloadControl.AddDownloadTaskControl();
                }
            };
            //
            // settingsButton
            //
            _settingsButton.Size     = new Size(LayoutGUI.ButtonSizeWidth, LayoutGUI.ButtonSizeHeight);
            _settingsButton.Location = new Point(LayoutGUI.MainFormSizeWidth - _settingsButton.Size.Width, 0);
            _settingsButton.Image    = new Bitmap(Images.Line.Settings, new Size(LayoutGUI.ButtonSizeWidth / 2, LayoutGUI.ButtonSizeHeight / 2));
            _settingsButton.UseVisualStyleBackColor = true;
            _settingsButton.Click += (sender, args) => { _settingsForm.ShowDialog(); };
            //
            // additionalsButton
            //
            _additionalsButton.Size     = new Size(LayoutGUI.ButtonSizeWidth, LayoutGUI.ButtonSizeHeight);
            _additionalsButton.Location = new Point(LayoutGUI.MainFormSizeWidth - _settingsButton.Size.Width - _additionalsButton.Size.Width, 0);
            _additionalsButton.Image    = new Bitmap(Images.Line.Tech, new Size(LayoutGUI.ButtonSizeWidth / 2, LayoutGUI.ButtonSizeHeight / 2));
            _additionalsButton.UseVisualStyleBackColor = true;
            _additionalsButton.Click += (sender, args) => { _additionalsForm.ShowDialog(); };
            //
            // aboutButton
            //
            _aboutButton.Size     = new Size(LayoutGUI.ButtonSizeWidth, LayoutGUI.ButtonSizeHeight);
            _aboutButton.Location =
                new Point(LayoutGUI.MainFormSizeWidth - _settingsButton.Size.Width - _additionalsButton.Size.Width - _aboutButton.Size.Width, 0);
            _aboutButton.UseVisualStyleBackColor = true;
            _aboutButton.Image  = new Bitmap(Images.Basic.Question, new Size(LayoutGUI.ButtonSizeWidth / 2, LayoutGUI.ButtonSizeHeight / 2));
            _aboutButton.Click += (sender, args) =>
            {
                new MessageForm(ModifierKeys == Keys.Shift ? Globals.Localization.FirstKnowText : Globals.Localization.AboutProgramText,
                                Globals.Localization.AboutProgramTitle, Images.Basic.Information, Resource.icon.ToBitmap(), MessageBoxButtons.OK,
                                new[] { Globals.Localization.Close }).ShowDialog();
            };

            _logRichTextBox.Size     = new Size(LayoutGUI.MainFormLoggerRichTextBoxSizeWidth - 2, LayoutGUI.MainFormLoggerRichTextBoxSizeHeight);
            _logRichTextBox.Location = new Point(LayoutGUI.MainFormSizeWidth - _logRichTextBox.Size.Width - LayoutGUI.QueueRequestListBoxWidth,
                                                 LayoutGUI.MainFormSizeHeight - _logRichTextBox.Size.Height - _pageControl.ButtonHeight - LayoutGUI.DistanceBetweenControls + 1);
            _logRichTextBox.BorderStyle = BorderStyle.None;
            _logRichTextBox.ScrollBars  = RichTextBoxScrollBars.None;
            _logRichTextBox.Reversed    = false;
            _logRichTextBox.BorderStyle = BorderStyle.Fixed3D;
            Globals.Logger.Logged      += _logRichTextBox.Log;

            _queueRequestListBox.Size             = new Size(LayoutGUI.QueueRequestListBoxWidth, _logRichTextBox.Size.Height);
            _queueRequestListBox.Location         = new Point(_logRichTextBox.Location.X + _logRichTextBox.Size.Width, _logRichTextBox.Location.Y);
            _queueRequestListBox.AddButton.Click += (sender, args) =>
            {
                OpenTaskCreatorForm(ModifierKeys.HasFlag(Keys.Shift));
            };
            _queueRequestListBox.ListBox.ItemAdded += (index, obj) =>
            {
                if (obj is DownloadRequest request)
                {
                    AddedRequest?.Invoke(request);
                }
            };

            //
            // MainForm
            //
            AutoScaleDimensions = new SizeF(7F, 15F);
            AutoScaleMode       = AutoScaleMode.Font;
            ClientSize          = new Size(LayoutGUI.MainFormSizeWidth, LayoutGUI.MainFormSizeHeight);
            FormBorderStyle     = FormBorderStyle.FixedSingle;
            MaximizeBox         = false;
            Controls.Add(_logRichTextBox);
            Controls.Add(_queueRequestListBox);
            Controls.Add(_aboutButton);
            Controls.Add(_additionalsButton);
            Controls.Add(_taskCreatorButton);
            Controls.Add(_settingsButton);
            Controls.Add(_pageControl);
            Icon   = Resource.icon;
            Shown += OnForm_Shown;
            Globals.APIKey.Changed += OnAPIKeyChanged;
            OnAPIKeyChanged();
            JsonAPI.OnExceptionResponce += code =>
            {
                switch (code)
                {
                case HttpStatusCode.Forbidden:
                case HttpStatusCode.Unauthorized:
                    new MessageForm(Globals.Localization.CurrentAPIKeyInvalid, Globals.Localization.APIKeyInvalid, Images.Basic.Error, Images.Basic.Error)
                    .ShowDialog();
                    _settingsForm.ResetAPI();
                    _settingsForm.ShowDialog();
                    break;

                default:
                    new MessageForm($"{Globals.Localization.UnknownError}: {code}", Globals.Localization.UnknownError, Images.Basic.Error,
                                    Images.Basic.Error).ShowDialog();
                    break;
                }
            };
            ResumeLayout();
        }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HelpToolTipActionList"/> class.
 /// </summary>
 /// <param name="helpToolTipControl">The help tool tip control.</param>
 public HelpToolTipActionList(IComponent helpToolTipControl)
     : base(helpToolTipControl)
 {
     this.helpToolTip = helpToolTipControl as HelpToolTip;
 }
        private void InitializeComponent()
        {
            _apiLabel          = new Label();
            _apiTextBox        = new APITextBox();
            _goToAPIPageButton = new Button();
            _toolTip           = new HelpToolTip();
            _saveAPIButton     = new Button();
            _changeAPIButton   = new Button();
            _resetAPIButton    = new Button();
            SuspendLayout();

            _apiLabel.AutoSize = true;
            _apiLabel.Location = new Point(0, 2);
            _apiLabel.Size     = new Size(38, 15);

            _apiTextBox.Location        = new Point(1, 18);
            _apiTextBox.Size            = new Size(170, 26);
            _apiTextBox.AutoSize        = false;
            _apiTextBox.Multiline       = false;
            _apiTextBox.TextAlign       = HorizontalAlignment.Center;
            _apiTextBox.Font            = new Font(Font.Name, Font.Size + 1);
            _apiTextBox.MaxLength       = DerpiAPI.LengthAPI;
            _apiTextBox.Text            = Globals.APIKey.GetValue();
            _apiTextBox.TextChanged    += (sender, args) => _saveAPIButton.Enabled = _apiTextBox.CheckValidFormat();
            _apiTextBox.EnabledChanged += (sender, args) => _changeAPIButton.Enabled = !_apiTextBox.Enabled;
            _apiTextBox.TextChanged    += (sender, args) => ResetAPIButtonCheck();
            _apiTextBox.Enabled         = !_apiTextBox.CheckValidFormat() && Globals.APIKey.GetValue() == _apiTextBox.Text;

            _goToAPIPageButton.Location = new Point(172, 17);
            _goToAPIPageButton.Size     = new Size(30, 29);
            _goToAPIPageButton.UseVisualStyleBackColor = true;
            _goToAPIPageButton.Image  = new Bitmap(Images.Lineal.WWW, new Size(_goToAPIPageButton.Size.Width / 2, _goToAPIPageButton.Size.Height / 2));
            _goToAPIPageButton.Click += (sender, args) => ProcessUtils.OpenBrowser(ProgramLocalization.DerpiBooruProfileLink);

            _saveAPIButton.Location = new Point(202, 17);
            _saveAPIButton.Size     = new Size(118, 29);
            _saveAPIButton.UseVisualStyleBackColor = true;
            _saveAPIButton.Enabled = false;
            _saveAPIButton.Click  += SaveAPIButton_Click;
            _saveAPIButton.Enabled = _apiTextBox.CheckValidFormat() && !Globals.APIKey.IsValid;

            _changeAPIButton.Location = new Point(0, 46);
            _changeAPIButton.Size     = new Size(202, 29);
            _changeAPIButton.UseVisualStyleBackColor = true;
            _changeAPIButton.Click  += ChangeAPIButton_Click;
            _changeAPIButton.Enabled = !_apiTextBox.Enabled;

            _resetAPIButton.Location = new Point(_saveAPIButton.Location.X, 46);
            _resetAPIButton.Size     = new Size(_saveAPIButton.Size.Width, _saveAPIButton.Size.Height);
            _resetAPIButton.UseVisualStyleBackColor = true;
            _resetAPIButton.Click  += ResetAPIButton_Click;
            _resetAPIButton.Enabled = _apiTextBox.Text.Length > 0;

            Globals.APIKey.Changed += ResetAPIButtonCheck;

            Controls.Add(_apiLabel);
            Controls.Add(_apiTextBox);
            Controls.Add(_goToAPIPageButton);
            Controls.Add(_saveAPIButton);
            Controls.Add(_changeAPIButton);
            Controls.Add(_resetAPIButton);
            ResumeLayout();
        }
        private void InitializeComponent()
        {
            _searchQueryLabel          = new Label();
            _downloadPathLabel         = new Label();
            _searchQueryTextBox        = new SearchQueryTextBox();
            _downloadPathTextBox       = new DerpiAdvancedPathTextBox();
            _queueAutoDownloadCheckBox = new CheckBox();
            _addTaskButton             = new Button();
            _helpToolTip = new HelpToolTip();
            SuspendLayout();

            _searchQueryLabel.Location  = new Point(2, 0);
            _searchQueryLabel.Size      = new Size(200, 20);
            _searchQueryLabel.AutoSize  = false;
            _searchQueryLabel.TextAlign = ContentAlignment.MiddleLeft;

            _downloadPathLabel.Location  = new Point(2, 45);
            _downloadPathLabel.Size      = new Size(200, 20);
            _downloadPathLabel.AutoSize  = false;
            _downloadPathLabel.TextAlign = ContentAlignment.MiddleLeft;

            _searchQueryTextBox.Location     = new Point(5, 20);
            _searchQueryTextBox.Size         = new Size(390, 25);
            _searchQueryTextBox.Multiline    = false;
            _searchQueryTextBox.TextAlign    = HorizontalAlignment.Left;
            _searchQueryTextBox.AutoSize     = false;
            _searchQueryTextBox.TextChanged += (sender, args) => OnTextChanged();

            _downloadPathTextBox.Location = new Point(3, 65);
            _downloadPathTextBox.Size     = new Size(393, 25);
            _downloadPathTextBox.PathType = PathType.File;
            _downloadPathTextBox.UpdateAvailableFormatingParts(typeof(Json.Image));
            _downloadPathTextBox.TextChanged      += (sender, args) => OnTextChanged();
            _downloadPathTextBox.Text              = Globals.CurrentDownloadPath;
            _downloadPathTextBox.PathBeenSelected += str => _downloadPathTextBox.Text = Path.Combine(str, Globals.CurrentDownloadFileName.GetValue());

            _queueAutoDownloadCheckBox.Location    = new Point(5, 95);
            _queueAutoDownloadCheckBox.MinimumSize = new Size(0, 20);
            _queueAutoDownloadCheckBox.AutoSize    = true;
            _queueAutoDownloadCheckBox.Checked     = Globals.QueueAutoDownload.GetValue();

            _addTaskButton.Location = new Point(5, 115);
            _addTaskButton.Size     = new Size(390, 30);
            _addTaskButton.Click   += OnAddTaskButton_Click;

            MinimizeBox         = false;
            MaximizeBox         = false;
            ShowInTaskbar       = false;
            AcceptButton        = _addTaskButton;
            AutoScaleDimensions = new SizeF(7F, 15F);
            ClientSize          = new Size(400, 150);
            AutoScaleMode       = AutoScaleMode.Font;
            FormBorderStyle     = FormBorderStyle.FixedSingle;
            Icon = ImageUtils.IconFromImage(Images.Lineal.Download);
            Controls.Add(_searchQueryLabel);
            Controls.Add(_downloadPathLabel);
            Controls.Add(_searchQueryTextBox);
            Controls.Add(_downloadPathTextBox);
            Controls.Add(_queueAutoDownloadCheckBox);
            Controls.Add(_addTaskButton);
            ResumeLayout();
        }