Esempio n. 1
0
        public DownloadListItem(DownloadTask task)
        {
            this.Task = task;
            var validation = task.Request.Validation;

            var fm = this.FontManager;

            this.SuspendLayout();

            var thumbnailImage = ImageUtils.FromBytes(validation.ThumbnailData);

            var thumbnailControl = this.ThumbnailControl = new PictureBox();

            thumbnailControl.SizeMode = PictureBoxSizeMode.StretchImage;
            this.ChangeThumbnail(thumbnailControl, thumbnailImage);
            this.Controls.Add(thumbnailControl);

            var titleLabel = this.TitleLabel = new SelectAllableTextBox();

            titleLabel.ReadOnly = true;
            titleLabel.Text     = validation.Info.GalleryUrl + Environment.NewLine + validation.Info.Title;
            titleLabel.Font     = this.FontManager[12.0F, FontStyle.Regular];

            titleLabel.Multiline   = true;
            titleLabel.BackColor   = this.BackColor;
            titleLabel.BorderStyle = BorderStyle.None;
            this.Controls.Add(titleLabel);

            var progressBar = this.ProgressBar = new OptimizedProgressBar();

            progressBar.Minimum = 0;
            progressBar.Maximum = 0;
            progressBar.Value   = 0;
            progressBar.Font    = fm[12, FontStyle.Regular];
            this.Controls.Add(progressBar);

            var detailButton = this.DetailButton = new Button();

            detailButton.FlatStyle = FlatStyle.Flat;
            detailButton.Click    += this.OnDetailButtonClick;
            detailButton.Text      = SR.Get("Download.Detail");
            this.Controls.Add(detailButton);

            var openButton = this.OpenButton = new Button();

            openButton.FlatStyle = FlatStyle.Flat;
            openButton.Click    += this.OnOpenButtonClick;
            openButton.Text      = SR.Get("Download.OpenDirectory");
            this.Controls.Add(openButton);

            var removeButton = this.RemoveButton = new Button();

            removeButton.FlatStyle = FlatStyle.Flat;
            removeButton.Click    += this.OnRemoveButtonClick;
            removeButton.Text      = SR.Get("Download.Remove");
            this.Controls.Add(removeButton);

            this.ResumeLayout(false);

            this.Padding        = new Padding(0, 0, 0, 1);
            task.Progressed    += this.OnTaskProgressed;
            task.StateChanged  += this.OnTaskStateChanged;
            task.ImageDownload += this.OnTaskImageDownload;

            this.HandleTaskStateChanged();
        }
        public NewDownloadForm()
        {
            this.SuspendLayout();

            this.Text          = SR.Get("NewDownload.Title");
            this.StartPosition = FormStartPosition.CenterParent;
            var fm = this.FontManager;

            var inputControl = this.InputControl = new LabeledTextBox();

            inputControl.Label.Text       = SR.Get("NewDownload.Input");
            inputControl.TextBox.Font     = fm[11, FontStyle.Regular];
            inputControl.TextBox.KeyDown += this.OnInputControlKeyDown;
            this.Controls.Add(inputControl);

            var verifyButton = this.VerifyButton = new Button();

            verifyButton.Text      = SR.Get("NewDownload.Verify");
            verifyButton.FlatStyle = FlatStyle.Flat;
            verifyButton.Click    += this.OnVerifyButtonClick;
            this.Controls.Add(verifyButton);

            var verifyMessageLabel = this.VerifyMessageLabel = new Label();

            verifyMessageLabel.TextAlign = ContentAlignment.MiddleRight;
            this.Controls.Add(verifyMessageLabel);

            var downloadSelectGroupBox = this.DownloadSelectGroupBox = new DownloadSelectGroupBox();

            downloadSelectGroupBox.GalleryListChanged     += this.OnDownloadSelectGroupBoxGalleryListChanged;
            downloadSelectGroupBox.SelectedGalleryChanged += this.OnDownloadSelectGroupBoxSelectedGalleryChanged;
            this.Controls.Add(downloadSelectGroupBox);

            var thumbnailControl = this.ThumbnailControl = new PictureBox();

            thumbnailControl.SizeMode = PictureBoxSizeMode.StretchImage;
            this.Controls.Add(thumbnailControl);

            var titleLabel = this.TitleLabel = new SelectAllableTextBox();

            titleLabel.ReadOnly    = true;
            titleLabel.Multiline   = true;
            titleLabel.BackColor   = this.BackColor;
            titleLabel.BorderStyle = BorderStyle.None;
            this.Controls.Add(titleLabel);

            var addMessageLabel = this.AddMessageLabel = new Label();

            addMessageLabel.TextAlign = ContentAlignment.MiddleRight;
            addMessageLabel.Font      = fm[12, FontStyle.Regular];
            this.Controls.Add(addMessageLabel);

            var addButton = this.AddButton = new Button();

            addButton.Text      = SR.Get("NewDownload.Add");
            addButton.FlatStyle = FlatStyle.Flat;
            addButton.Font      = fm[12, FontStyle.Regular];
            addButton.Click    += this.OnAddButtonClick;
            this.Controls.Add(addButton);

            var cancelButton = this.CancelButton = new Button();

            cancelButton.Text      = SR.Get("NewDownload.Cancel");
            cancelButton.FlatStyle = FlatStyle.Flat;
            cancelButton.Font      = fm[12, FontStyle.Regular];
            cancelButton.Click    += this.OnCancelButtonClick;
            this.Controls.Add(cancelButton);

            var continueCheckBox = this.ContinueCheckBox = new CheckBox();

            continueCheckBox.Text = SR.Get("NewDownload.Continue");
            continueCheckBox.Font = fm[12, FontStyle.Regular];
            this.Controls.Add(continueCheckBox);

            this.ResumeLayout(false);

            this.ClientSize = new Size(500, 520);
            this.UpdateControlsBoundsPreferred();
        }