コード例 #1
0
        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();
        }
コード例 #2
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();
        }
コード例 #3
0
        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();
        }