示例#1
0
        /// <summary>
        /// Raises the export dialog.
        /// </summary>
        /// <param name="imagesToExport">Specify the collection of images to export.</param>
        /// <exception cref="ArgumentNullException"><paramref name="imagesToExport"/> is <see langword="null"/>.</exception>
        /// <exception cref="InvalidOperationException">There are no images to export.</exception>
        public void Export(IList <Image> imagesToExport)
        {
            if (imagesToExport == null)
            {
                throw new ArgumentNullException("imagesToExport");
            }

            using (NuGenImageExportBlock exportBlock = new NuGenImageExportBlock(this.ServiceProvider))
            {
                if (imagesToExport.Count == 0)
                {
                    throw new InvalidOperationException(Resources.InvalidOperation_NoImagesToExport);
                }

                exportBlock.ConstrainHeight = this.ExportDialogConstrainHeigth;
                exportBlock.ConstrainWidth  = this.ExportDialogConstrainWidth;

                if (this.ExportPathCollection != null)
                {
                    foreach (string path in this.ExportPathCollection)
                    {
                        exportBlock.ExportPathCollection.Add(path);
                    }
                }

                exportBlock.Icon = this.ExportDialogIcon;
                exportBlock.Images.AddRange(imagesToExport);
                exportBlock.Location              = this.ExportDialogLocation;
                exportBlock.MaximumHeight         = this.ExportDialogMaximumHeight;
                exportBlock.MaximumWidth          = this.ExportDialogMaximumWidth;
                exportBlock.NumberWatermark       = this.ExportDialogNumberWatermark;
                exportBlock.ShowInTaskbar         = this.ExportDialogShowInTaskbar;
                exportBlock.Size                  = this.ExportDialogSize;
                exportBlock.ThumbnailMode         = this.ExportDialogThumbnailMode;
                exportBlock.ThumbnailSize         = this.ExportDialogThumbnailSize;
                exportBlock.WatermarkAlignment    = this.ExportDialogWatermarkAlignment;
                exportBlock.WatermarkColor        = this.ExportDialogWatermarkColor;
                exportBlock.WatermarkColorOpacity = this.ExportDialogWatermarkOpacity;
                exportBlock.WatermarkFont         = this.ExportDialogWatermarkFont;

                exportBlock.ShowDialog();

                this.ExportDialogConstrainHeigth = exportBlock.ConstrainHeight;
                this.ExportDialogConstrainWidth  = exportBlock.ConstrainWidth;

                if (this.ExportPathCollection != null)
                {
                    this.ExportPathCollection.Clear();
                }

                this.ExportPathCollection           = exportBlock.ExportPathCollection;
                this.ExportDialogLocation           = exportBlock.Location;
                this.ExportDialogMaximumHeight      = exportBlock.MaximumHeight;
                this.ExportDialogMaximumWidth       = exportBlock.MaximumWidth;
                this.ExportDialogNumberWatermark    = exportBlock.NumberWatermark;
                this.ExportDialogSize               = exportBlock.Size;
                this.ExportDialogThumbnailMode      = exportBlock.ThumbnailMode;
                this.ExportDialogThumbnailSize      = exportBlock.ThumbnailSize;
                this.ExportDialogWatermarkAlignment = exportBlock.WatermarkAlignment;
                this.ExportDialogWatermarkColor     = exportBlock.WatermarkColor;
                this.ExportDialogWatermarkOpacity   = exportBlock.WatermarkColorOpacity;
                this.ExportDialogWatermarkFont      = exportBlock.WatermarkFont;

                this.OnExportSucceeded(EventArgs.Empty);
            }
        }
示例#2
0
		/// <summary>
		/// Raises the export dialog.
		/// </summary>
		/// <param name="imagesToExport">Specify the collection of images to export.</param>
		/// <exception cref="ArgumentNullException"><paramref name="imagesToExport"/> is <see langword="null"/>.</exception>
		/// <exception cref="InvalidOperationException">There are no images to export.</exception>
		public void Export(IList<Image> imagesToExport)
		{
			if (imagesToExport == null)
			{
				throw new ArgumentNullException("imagesToExport");
			}

			using (NuGenImageExportBlock exportBlock = new NuGenImageExportBlock(this.ServiceProvider))
			{	
				if (imagesToExport.Count == 0) 			
				{
					throw new InvalidOperationException(Resources.InvalidOperation_NoImagesToExport);
				}

				exportBlock.ConstrainHeight = this.ExportDialogConstrainHeigth;
				exportBlock.ConstrainWidth = this.ExportDialogConstrainWidth;

				if (this.ExportPathCollection != null)
				{
					foreach (string path in this.ExportPathCollection)
					{
						exportBlock.ExportPathCollection.Add(path);
					}
				}

				exportBlock.Icon = this.ExportDialogIcon;
				exportBlock.Images.AddRange(imagesToExport);
				exportBlock.Location = this.ExportDialogLocation;
				exportBlock.MaximumHeight = this.ExportDialogMaximumHeight;
				exportBlock.MaximumWidth = this.ExportDialogMaximumWidth;
				exportBlock.NumberWatermark = this.ExportDialogNumberWatermark;
				exportBlock.ShowInTaskbar = this.ExportDialogShowInTaskbar;
				exportBlock.Size = this.ExportDialogSize;
				exportBlock.ThumbnailMode = this.ExportDialogThumbnailMode;
				exportBlock.ThumbnailSize = this.ExportDialogThumbnailSize;
				exportBlock.WatermarkAlignment = this.ExportDialogWatermarkAlignment;
				exportBlock.WatermarkColor = this.ExportDialogWatermarkColor;
				exportBlock.WatermarkColorOpacity = this.ExportDialogWatermarkOpacity;
				exportBlock.WatermarkFont = this.ExportDialogWatermarkFont;

				exportBlock.ShowDialog();

				this.ExportDialogConstrainHeigth = exportBlock.ConstrainHeight;
				this.ExportDialogConstrainWidth = exportBlock.ConstrainWidth;

				if (this.ExportPathCollection != null)
				{
					this.ExportPathCollection.Clear();
				}

				this.ExportPathCollection = exportBlock.ExportPathCollection;
				this.ExportDialogLocation = exportBlock.Location;
				this.ExportDialogMaximumHeight = exportBlock.MaximumHeight;
				this.ExportDialogMaximumWidth = exportBlock.MaximumWidth;
				this.ExportDialogNumberWatermark = exportBlock.NumberWatermark;
				this.ExportDialogSize = exportBlock.Size;
				this.ExportDialogThumbnailMode = exportBlock.ThumbnailMode;
				this.ExportDialogThumbnailSize = exportBlock.ThumbnailSize;
				this.ExportDialogWatermarkAlignment = exportBlock.WatermarkAlignment;
				this.ExportDialogWatermarkColor = exportBlock.WatermarkColor;
				this.ExportDialogWatermarkOpacity = exportBlock.WatermarkColorOpacity;
				this.ExportDialogWatermarkFont = exportBlock.WatermarkFont;

				this.OnExportSucceeded(EventArgs.Empty);
			}
		}