Exemple #1
0
        /// <summary>
        /// Initializes this configuration control to default values.
        /// </summary>
        /// <param name="environment">Information about the plugin environment.</param>
        public void Initialize(PluginEnvironment environment)
        {
            assetSelectionControl.Initialize(AssetAttributes.Mobile);
            _data = new PrinterOnMobileActivityData();

            ConfigureControls(_data);
        }
Exemple #2
0
 /// <summary>
 ///  Initialize PrinterOnMobilePrintActivityManager
 /// </summary>
 /// <param name="executionData"></param>
 public PrinterOnMobilePrintActivityManager(PluginExecutionData executionData)  : base(executionData)
 {
     _data  = executionData.GetMetadata <PrinterOnMobileActivityData>();
     Option = _data.Options;
     Option.SetOption("name", _data.Name);
     Option.SetOption("email", _data.Email);
     Target = new ObjectToPrint
     {
         Type = DocumentType.File
     };
     Target.Infomation.Add("FilePath", _data.FilePath);
     PrinterId = _data.PrinterId;
 }
Exemple #3
0
        /// <summary>
        /// Creates and returns a <see cref="PluginConfigurationData" /> instance containing the
        /// configuration data from this control.
        /// </summary>
        /// <returns>The configuration data.</returns>
        public PluginConfigurationData GetConfiguration()
        {
            _data = new PrinterOnMobileActivityData()
            {
                PrinterId = printerId_textBox.Text,
                FilePath  = filePath_textBox.Text,
                Name      = name_textBox.Text,
                Email     = email_textBox.Text
            };

            if (copies_numericUpDown.Value == 1)
            {
                _data.Options.Copies = -1;
            }
            else
            {
                _data.Options.Copies = (int)copies_numericUpDown.Value;
            }

            if (allPages_radioButton.Checked)
            {
                _data.Options.Page = null;
            }
            else
            {
                _data.Options.Page = pages_textBox.Text;
            }

            if (EnumUtil.GetDescription(Option_Orientation.Portrait).Equals(orientation_comboBox.Text))
            {
                _data.Options.Orientation = null;
            }
            else
            {
                _data.Options.Orientation = EnumUtil.GetByDescription <Option_Orientation>(orientation_comboBox.Text);
            }

            if (EnumUtil.GetDescription(Option_Duplex.None).Equals(duplex_comboBox.Text))
            {
                _data.Options.Duplex = null;
            }
            else
            {
                _data.Options.Duplex = EnumUtil.GetByDescription <Option_Duplex>(duplex_comboBox.Text);
            }

            if (EnumUtil.GetDescription(Option_Color.Color).Equals(color_comboBox.Text))
            {
                _data.Options.Color = null;
            }
            else
            {
                _data.Options.Color = EnumUtil.GetByDescription <Option_Color>(color_comboBox.Text);
            }

            if (EnumUtil.GetDescription(Option_PaperSize.A4).Equals(paperSize_comboBox.Text))
            {
                _data.Options.PaperSize = null;
            }
            else
            {
                _data.Options.PaperSize = EnumUtil.GetByDescription <Option_PaperSize>(paperSize_comboBox.Text);
            }

            return(new PluginConfigurationData(_data, "1.0")
            {
                Assets = assetSelectionControl.AssetSelectionData,
            });
        }
Exemple #4
0
 /// <summary>
 /// Initializes this configuration control with the specified <see cref="PluginConfigurationData" />.
 /// </summary>
 /// <param name="configuration">The configuration data.</param>
 /// <param name="environment">Information about the plugin environment.</param>
 public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment)
 {
     assetSelectionControl.Initialize(configuration.Assets, AssetAttributes.Mobile);
     _data = configuration.GetMetadata <PrinterOnMobileActivityData>();
     ConfigureControls(_data);
 }
Exemple #5
0
        private void ConfigureControls(PrinterOnMobileActivityData data)
        {
            printerId_textBox.Text = data.PrinterId;
            filePath_textBox.Text  = data.FilePath;

            if (data.Options.Copies.Equals(-1))
            {
                copies_numericUpDown.Value = 1;
            }

            if (String.IsNullOrEmpty(data.Options.Page))
            {
                allPages_radioButton.Checked = true;
                pages_radioButton.Checked    = false;
                pages_textBox.Enabled        = false;
            }
            else
            {
                allPages_radioButton.Checked = false;
                pages_radioButton.Checked    = true;
                pages_textBox.Enabled        = true;
                pages_textBox.Text           = data.Options.Page;
            }

            if (data.Options.Orientation == null)
            {
                orientation_comboBox.Text = EnumUtil.GetDescription(Option_Orientation.Portrait);
            }
            else
            {
                orientation_comboBox.Text = data.Options.Orientation.GetDescription();
            }

            if (data.Options.Duplex == null)
            {
                duplex_comboBox.Text = EnumUtil.GetDescription(Option_Duplex.None);
            }
            else
            {
                duplex_comboBox.Text = data.Options.Duplex.GetDescription();
            }

            if (data.Options.Color == null)
            {
                color_comboBox.Text = EnumUtil.GetDescription(Option_Color.Color);
            }
            else
            {
                color_comboBox.Text = data.Options.Color.GetDescription();
            }

            if (data.Options.PaperSize == null)
            {
                paperSize_comboBox.Text = EnumUtil.GetDescription(Option_PaperSize.A4);
            }
            else
            {
                paperSize_comboBox.Text = data.Options.PaperSize.GetDescription();
            }

            name_textBox.Text  = data.Name;
            email_textBox.Text = data.Email;
        }