Ejemplo n.º 1
0
        private void Initialize()
        {
            this.Text = App.GetName() + " · Print " + (printMode == PrintMode.ToScreen ? "Preview" : "Document");

            buttonOk.Text = (printMode == PrintMode.ToScreen ? "Preview" : "Print");

            groupBoxAlbumOptions.Enabled = (printMode == PrintMode.ToDocument);
            groupBoxPrinter.Enabled      = groupBoxAlbumOptions.Enabled;

            string printerName = App.GetSetting("PDFPrinter");

            textPrinter.Text = printerName;

            bool printerExists = PrinterSettings.InstalledPrinters.Cast <string>().Any(name => printerName.ToUpper().Trim() == name.ToUpper().Trim());

            labelPrinter.Visible = !printerExists;

            if (printMode == PrintMode.ToDocument)
            {
                buttonOk.Enabled = printerExists;
            }
            else
            {
                buttonOk.Enabled = true;
            }

            PageSetup pageSetup = PageSetup.Get();

            // Format

            comboBoxFormat.Items.AddRange(PageFormats.Get().Select(format => format.FormatName).ToArray());
            comboBoxFormat.Text = pageSetup.PageFormat.FormatName;
            checkBoxIncludeMarginForPunchHoles.Checked = pageSetup.IncludeMarginForPunchHoles;

            // Stamps Options

            checkBoxIncludeImage.Checked  = pageSetup.IncludeImage;
            checkBoxIncludeNumber.Checked = pageSetup.IncludeNumber;
            checkBoxIncludeValue.Checked  = pageSetup.IncludeValueAndColor;

            // Frame Options

            switch (pageSetup.FrameStyle)
            {
            case FrameStyle.ThinSolid:
                radioButtonThinSolid.Checked = true;
                break;

            case FrameStyle.Thick:
                radioButtonThick.Checked = true;
                break;

            case FrameStyle.ThinDotted:
                radioButtonThinDotted.Checked = true;
                break;
            }

            // Color Options

            switch (pageSetup.ColorStyle)
            {
            case ColorStyle.Greyscale:
                radioButtonGreyscale.Checked = true;
                break;

            case ColorStyle.Color:
                radioButtonColor.Checked = true;
                break;
            }

            // Font Options

            switch (pageSetup.FontSize)
            {
            case FontSize.Small:
                radioButtonSmall.Checked = true;
                break;

            case FontSize.Medium:
                radioButtonMedium.Checked = true;
                break;

            case FontSize.Large:
                radioButtonLarge.Checked = true;
                break;
            }

            // Page Options

            checkBoxIncludeBorder.Checked = pageSetup.IncludeBorder;
            checkBoxIncludeTitle.Checked  = pageSetup.IncludeTitle;

            // Catalog Options

            comboBoxCatalog.Items.AddRange(Catalogs.Get());
            comboBoxCatalog.Text          = Catalogs.Convert(pageSetup.Catalog);
            checkBoxAppendCatalog.Checked = pageSetup.AppendCatalog;

            // Album Options

            checkBoxIncludeSamplePagesOnly.Checked = pageSetup.IncludeSamplePagesOnly;
            checkBoxIncludePdfImage.Checked        = pageSetup.IncludePdfImages;
            checkBoxIncludePdfBookmarks.Checked    = pageSetup.IncludePdfBookmarks;

            // Real life page scale

            numericRealLifePageScale.Value = pageSetup.RealLifePageScale;

            if (this.excludeNumber)
            {
                checkBoxIncludeNumber.Checked = false;
                checkBoxIncludeNumber.Enabled = false;
            }

            if (this.excludeValueAndColor)
            {
                checkBoxIncludeValue.Checked = false;
                checkBoxIncludeValue.Enabled = false;
            }
        }