public ThumbnailSelectionService(NuGenThumbnailContainer.ImageCollection imageCollection)
		{
			if (imageCollection == null)
			{
				throw new ArgumentNullException("imageCollection");
			}

			_imageCollection = imageCollection;
		}
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageExportDialog"/> class.
        /// </summary>
        /// <param name="serviceProvider">
        ///		<para>Requires:</para>
        ///     <para><see cref="INuGenButtonStateService"/></para>
        ///     <para><see cref="INuGenControlStateService"/></para>
        ///		<para><see cref="INuGenButtonLayoutManager"/></para>
        ///		<para><see cref="INuGenButtonRenderer"/></para>
        ///		<para><see cref="INuGenCheckBoxLayoutManager"/></para>
        ///		<para><see cref="INuGenCheckBoxRenderer"/></para>
        ///		<para><see cref="INuGenColorsProvider"/></para>
        ///		<para><see cref="INuGenComboBoxRenderer"/></para>
        ///		<para><see cref="INuGenControlImageManager"/></para>
        ///		<para><see cref="INuGenDirectorySelectorRenderer"/></para>
        ///		<para><see cref="INuGenDropDownRenderer"/></para>
        ///		<para><see cref="INuGenFontFamiliesProvider"/></para>
        ///		<para><see cref="INuGenImageListService"/></para>
        ///     <para><see cref="INuGenListBoxRenderer"/></para>
        ///		<para><see cref="INuGenPanelRenderer"/></para>
        ///		<para><see cref="INuGenProgressBarLayoutManager"/></para>
        ///		<para><see cref="INuGenProgressBarRenderer"/></para>
        ///		<para><see cref="INuGenRadioButtonLayoutManager"/></para>
        ///		<para><see cref="INuGenRadioButtonRenderer"/></para>
        ///     <para><see cref="INuGenScrollBarRenderer"/></para>
        ///		<para><see cref="INuGenSpinRenderer"/></para>
        ///     <para><see cref="INuGenSwitchButtonLayoutManager"/></para>
        ///     <para><see cref="INuGenSwitchButtonRenderer"/></para>
        ///		<para><see cref="INuGenTabStateTracker"/></para>
        ///		<para><see cref="INuGenTabLayoutManager"/></para>
        ///		<para><see cref="INuGenTabRenderer"/></para>
        ///		<para><see cref="INuGenTextBoxRenderer"/></para>
        ///     <para><see cref="INuGenTrackBarRenderer"/></para>
        ///     <para><see cref="INuGenThumbnailLayoutManager"/></para>
        ///     <para><see cref="INuGenThumbnailRenderer"/></para>
        ///     <para><see cref="INuGenToolStripRenderer"/></para>
        ///     <para><see cref="INuGenValueTrackerService"/></para>
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        public ImageExportDialog(INuGenServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.Opaque, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.UserPaint, true);

            this.FormBorderStyle = FormBorderStyle.Sizable;
            this.MinimizeBox     = false;
            this.MaximizeBox     = false;
            this.Padding         = new Padding(5);
            this.ShowInTaskbar   = false;
            this.StartPosition   = FormStartPosition.Manual;
            this.Text            = res.Text_ImageExportDialog_Text;

            _exportService           = new ImageExportService();
            _exportService.Progress += _exportProgress;

            _controlPanel               = new ControlPanel(serviceProvider);
            _controlPanel.Back         += _controlPanel_Back;
            _controlPanel.Cancel       += _controlPanel_Cancel;
            _controlPanel.CancelExport += _controlPanel_CancelExport;
            _controlPanel.Close        += _controlPanel_Close;
            _controlPanel.Export       += _controlPanel_Export;
            _controlPanel.Next         += _controlPanel_Next;

            _previewStep = new Step(
                res.Text_ImageExportDialog_StepOneCaption
                , res.Text_ImageExportDialog_StepOneDescription
                );
            _settingsStep = new Step(
                res.Text_ImageExportDialog_StepTwoCaption
                , res.Text_ImageExportDialog_StepTwoDescription
                );
            _title = new Title();

            this.Controls.AddRange(
                new Control[]
            {
                _controlPanel
                , _previewStep
                , _settingsStep
                , _title
            }
                );

            _thumbnailContainer        = new NuGenThumbnailContainer(serviceProvider);
            _thumbnailContainer.Dock   = DockStyle.Fill;
            _thumbnailContainer.Parent = _previewStep;

            _exportProgressBar        = new NuGenProgressBar(serviceProvider);
            _exportProgressBar.Dock   = DockStyle.Bottom;
            _exportProgressBar.Parent = _settingsStep;

            _settingsLayoutPanel           = new TableLayoutPanel();
            _settingsLayoutPanel.BackColor = Color.Transparent;
            _settingsLayoutPanel.Dock      = DockStyle.Fill;
            _settingsLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30));
            _settingsLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 70));

            for (int i = 0; i < 9; i++)
            {
                _settingsLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 30));
            }

            _settingsLayoutPanel.Parent = _settingsStep;
            NuGenControlPaint.SetStyle(
                _settingsLayoutPanel
                , ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint
                , true
                );

            _destFolderLabel      = new NuGenLabel();
            _destFolderLabel.Text = res.Text_ImageExportDialog_destFolderLabel;

            _templateLabel      = new NuGenLabel();
            _templateLabel.Text = res.Text_ImageExportDialog_templateLabel;

            _formatLabel      = new NuGenLabel();
            _formatLabel.Text = res.Text_ImageExportDialog_formatLabel;

            _typeLabel      = new NuGenLabel();
            _typeLabel.Text = res.Text_ImageExportDialog_typeLabel;

            _chooseButton        = new NuGenButton(serviceProvider);
            _chooseButton.Click += _chooseButton_Click;
            _chooseButton.Dock   = DockStyle.Right;
            _chooseButton.Text   = res.Text_ImageExportDialog_chooseButton;

            _pathSelector      = new PathSelector(serviceProvider);
            _pathSelector.Dock = DockStyle.Fill;

            _maxHeightCheckBox                 = new NuGenCheckBox(serviceProvider);
            _maxHeightCheckBox.Text            = res.Text_ImageExportDialog_maxHeightCheckBox;
            _maxHeightCheckBox.CheckedChanged += _maxHeightCheckBox_CheckedChanged;

            _maxWidthCheckBox                 = new NuGenCheckBox(serviceProvider);
            _maxWidthCheckBox.Text            = res.Text_ImageExportDialog_maxWidthCheckBox;
            _maxWidthCheckBox.CheckedChanged += _maxWidthCheckBox_CheckedChanged;

            _numWatermarkCheckBox = new NuGenCheckBox(serviceProvider);
            _numWatermarkCheckBox.CheckedChanged += _numWatermarkCheckBox_CheckedChanged;
            _numWatermarkCheckBox.Text            = res.Text_ImageExportDialog_numWatermarkCheckBox;

            _templateTextBox = new NuGenTextBox(serviceProvider);
            _formatCombo     = new FormatCombo(serviceProvider);
            _typeCombo       = new TypeCombo(serviceProvider);

            _settingsLayoutPanel.Controls.Add(_destFolderLabel, 0, 0);
            _settingsLayoutPanel.Controls.Add(_templateLabel, 0, 1);
            _settingsLayoutPanel.Controls.Add(_formatLabel, 0, 2);
            _settingsLayoutPanel.Controls.Add(_typeLabel, 0, 3);
            _settingsLayoutPanel.Controls.Add(_maxWidthCheckBox, 0, 4);
            _settingsLayoutPanel.Controls.Add(_maxHeightCheckBox, 0, 5);
            _settingsLayoutPanel.Controls.Add(_numWatermarkCheckBox, 0, 6);

            _maxHeightSpin         = new SizeSpin(serviceProvider);
            _maxHeightSpin.Enabled = _maxHeightCheckBox.Checked;

            _maxWidthSpin         = new SizeSpin(serviceProvider);
            _maxWidthSpin.Enabled = _maxWidthCheckBox.Checked;

            _pathPanel      = new LayoutPanel();
            _pathPanel.Dock = DockStyle.Fill;
            _pathPanel.Controls.AddRange(new Control[] { _pathSelector, _chooseButton });

            _watermarkFontBlock         = new NuGenFontBlock(serviceProvider);
            _watermarkFontBlock.Enabled = false;
            _watermarkFontBlock.Width   = 300;

            NuGenSpacer[] colorSpacers = new NuGenSpacer[2];

            for (int i = 0; i < colorSpacers.Length; i++)
            {
                colorSpacers[i]       = new NuGenSpacer();
                colorSpacers[i].Dock  = DockStyle.Right;
                colorSpacers[i].Width = 3;
            }

            _watermarkColorBox               = new NuGenColorBox(serviceProvider);
            _watermarkColorBox.AutoSize      = false;
            _watermarkColorBox.Dock          = DockStyle.Fill;
            _watermarkColorBox.SelectedColor = Color.Gray;

            _watermarkOpacitySpin       = new OpacitySpin(serviceProvider);
            _watermarkOpacitySpin.Dock  = DockStyle.Right;
            _watermarkOpacitySpin.Width = 50;

            _percentLabel          = new NuGenLabel();
            _percentLabel.AutoSize = false;
            _percentLabel.Dock     = DockStyle.Right;
            _percentLabel.Text     = "%";
            _percentLabel.Width    = 10;

            _colorPanel = new LayoutPanel();
            _colorPanel.Controls.AddRange(
                new Control[]
            {
                _watermarkColorBox
                , colorSpacers[0]
                , _watermarkOpacitySpin
                , colorSpacers[1]
                , _percentLabel
            }
                );
            _colorPanel.Enabled = false;
            _colorPanel.Size    = new Size(241, 20);

            _watermarkAlignDropDown                   = new NuGenAlignDropDown(serviceProvider);
            _watermarkAlignDropDown.Enabled           = false;
            _watermarkAlignDropDown.SelectedAlignment = ContentAlignment.TopLeft;
            _watermarkAlignDropDown.Width             = 175;

            _settingsLayoutPanel.Controls.Add(_pathPanel, 1, 0);
            _settingsLayoutPanel.Controls.Add(_templateTextBox, 1, 1);
            _settingsLayoutPanel.Controls.Add(_formatCombo, 1, 2);
            _settingsLayoutPanel.Controls.Add(_typeCombo, 1, 3);
            _settingsLayoutPanel.Controls.Add(_maxWidthSpin, 1, 4);
            _settingsLayoutPanel.Controls.Add(_maxHeightSpin, 1, 5);
            _settingsLayoutPanel.Controls.Add(_watermarkFontBlock, 1, 6);
            _settingsLayoutPanel.Controls.Add(_colorPanel, 1, 7);
            _settingsLayoutPanel.Controls.Add(_watermarkAlignDropDown, 1, 8);

            this.CurrentStep = _previewStep;
        }