Exemplo n.º 1
0
        /// <summary>
        /// Converts the specified XML metadata to the new version.
        /// </summary>
        /// <param name="xml">The XML metadata.</param>
        /// <returns>System.Xml.Linq.XElement.</returns>
        public XElement Convert(XElement xml)
        {
            Version v4_10 = new Version("4.10.0.0");
            Version v4_12 = new Version("4.12.0.0");

            // Get XML root namespace for manual conversion
            XNamespace rootNS = xml.GetDefaultNamespace();

            //Determine what data version we are working with.
            Version version = ParseVersionFromMetadata(xml);

            FaxActivityData resultData = null;

            if (version < v4_10)
            {
                //Convert old metadata to new schema.
                resultData = new FaxActivityData()
                {
                    AutomationPause    = GetTimeSpan(xml, "AutomationPause"),
                    DigitalSendServer  = GetValue(xml, "DigitalSendServer"),
                    EnableNotification = GetBool(xml, "EnableNotification"),
                    FaxNumber          = GetValue(xml, "FaxNumber"),
                    FaxOperation       = (FaxTask)Enum.Parse(typeof(FaxTask), GetValue(xml, "FaxOperation")),
                    FaxReceiveTimeout  = GetTimeSpan(xml, "FaxReceiveTimeout"),
                    FaxType            = (FaxConfiguration)Enum.Parse(typeof(FaxConfiguration), GetValue(xml, "FaxType")),
                    NotificationEmail  = GetValue(xml, "NotificationEmail")
                };
            }
            else if (version >= v4_10 && version < v4_12)
            {
                //Deserialize what is there.  It's possible Some ScanOptions were saved.
                resultData = Serializer.Deserialize <FaxActivityData>(xml);
            }
            else
            {
                //No Conversion necessary
                return(xml);
            }

            //Only update these next properties if they are found in the metadata root.
            if (Exists(xml, "LockTimeouts", true))
            {
                resultData.ScanOptions.LockTimeouts = GetLockTimeoutData(rootNS, xml);
            }
            if (Exists(xml, "PageCount", true))
            {
                resultData.ScanOptions.PageCount = GetInt(xml, "PageCount");
            }
            if (Exists(xml, "UseAdf", true))
            {
                resultData.ScanOptions.UseAdf = GetBool(xml, "UseAdf");
            }

            return(Serializer.Serialize(resultData));
        }
Exemplo n.º 2
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()
        {
            FaxActivityData data = new FaxActivityData()
            {
                EnableNotification = notify_CheckBox.Checked,
                NotificationEmail  = email_ComboBox.Text,

                AutomationPause = assetSelectionControl.AutomationPause,

                FaxType             = (FaxConfiguration)Enum.Parse(typeof(FaxConfiguration), comboBoxFaxType.Text),
                FaxNumber           = faxNumber_textBox.Text.ToString(),
                FaxReceiveTimeout   = timeSpanControlFaxReceive.Value,
                ImagePreviewOptions = OptionalRadioButton.Checked ? 0 : GenerateRadioButton.Checked ? 1 : RestrictRadioButton.Checked ? 2 : 0,
                PIN          = PIN_textBox.Text,
                UseSpeedDial = useSpeedDial_Checkbox.Checked,
                ScanOptions  = _faxOptions,
                ApplicationAuthentication = radioButton_Fax.Checked,
                AuthProvider      = (AuthenticationProvider)comboBox_AuthProvider.SelectedValue,
                PrintJobSeparator = jobseparator_checkBox.Checked
            };

            data.ScanOptions.PageCount    = (int)pageCount_NumericUpDown.Value;
            data.ScanOptions.LockTimeouts = lockTimeoutControl.Value;
            data.ScanOptions.UseAdf       = assetSelectionControl.UseAdf;
            data.ScanOptions.ScanJobType  = "ScanToFax";

            if (usesDigitalSendServer_CheckBox.Checked)
            {
                data.DigitalSendServer = digitalSendServer_TextBox.Text;
            }
            else
            {
                data.DigitalSendServer = null;
            }

            data.UseSpeedDial = useSpeedDial_Checkbox.Checked;

            if (radioFaxReceive.Checked)
            {
                data.FaxOperation = FaxTask.ReceiveFax;
            }
            else if (radioFaxSend.Checked)
            {
                data.FaxOperation = FaxTask.SendFax;
            }

            return(new PluginConfigurationData(data, Version)
            {
                Assets = assetSelectionControl.AssetSelectionData,
                Documents = assetSelectionControl.AdfDocuments,
                PrintQueues = new PrintQueueSelectionData(_printQueues)
            });
        }
Exemplo n.º 3
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)
        {
            FaxActivityData activityData = configuration.GetMetadata <FaxActivityData>(ConverterProvider.GetMetadataConverters());

            ConfigureControls(activityData);

            jobseparator_checkBox.Checked = activityData.PrintJobSeparator;
            LoadPrintQueues(configuration.PrintQueues.SelectedPrintQueues);
            assetSelectionControl.Initialize(configuration.Assets, _deviceAttributes);
            assetSelectionControl.AdfDocuments = configuration.Documents;
            RefreshQueueDataGrid();
        }
        /// <summary>
        /// This is an overridden method, from the Print Support PrintEngine class
        /// PrintTag Virtual Method.
        /// </summary>
        /// <param name="printQueue"></param>
        /// <param name="executionData"></param>
        public override StringBuilder PrintTag(PrintQueue printQueue, PluginExecutionData executionData)
        {
            FaxActivityData data = executionData.GetMetadata <FaxActivityData>(ConverterProvider.GetMetadataConverters());

            PrintFaxData(data);
            _contentToPrint.AppendLine();
            _contentToPrint.AppendLine(string.Format("UserName: {0}", Environment.UserName));
            _contentToPrint.AppendLine(string.Format("Session ID: {0}", executionData.SessionId));
            _contentToPrint.AppendLine(string.Format("Activity ID:{0}", executionData.ActivityExecutionId));
            _contentToPrint.AppendLine(string.Format("Date: {0}", DateTime.Now.ToShortDateString()));
            _contentToPrint.AppendLine(string.Format("Time: {0}", DateTime.Now.ToShortTimeString()));
            return(_contentToPrint);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Validates the given metadata against the Fax Activity data.
        /// </summary>
        /// <param name="configurationData">The configuration data.</param>
        /// <returns>true if valid</returns>
        public bool ValidateMetadata(ref PluginConfigurationData configurationData)
        {
            bool            validData    = true;
            FaxActivityData activityData = null;

            try
            {
                activityData = configurationData.GetMetadata <FaxActivityData>(ConverterProvider.GetMetadataConverters());
            }
            catch
            {
                activityData = new FaxActivityData();
                validData    = false;
            }

            configurationData = new PluginConfigurationData(activityData, FaxConfigControl.Version);

            return(validData);
        }
        private void PrintFaxData(FaxActivityData _faxData)
        {
            if (_faxData != null)
            {
                _contentToPrint.AppendLine(string.Format("Fax Settings Data"));
                _contentToPrint.AppendLine();

                PropertyInfo[] propertiesFaxData = _faxData.GetType().GetProperties();
                foreach (PropertyInfo propFaxData in propertiesFaxData)
                {
                    if (!((propFaxData.Name.Equals("ScanOptions")) || (propFaxData.Name.Equals("AutomationPause"))))
                    {
                        _contentToPrint.AppendLine(string.Format("{0} : {1}", propFaxData.Name, propFaxData.GetValue(_faxData, null)));
                    }
                }

                PropertyInfo[] propertyFaxOption = _faxData.ScanOptions.GetType().GetProperties();
                foreach (PropertyInfo propFaxOption in propertyFaxOption)
                {
                    if (!(propFaxOption.Name.Equals("LockTimeouts") ||
                          propFaxOption.Name.Equals("FileType") ||
                          propFaxOption.Name.Equals("Color") ||
                          propFaxOption.Name.Equals("Cropping") ||
                          propFaxOption.Name.Equals("ScanModes") ||
                          propFaxOption.Name.Equals("BookLetFormat") || propFaxOption.Name.Equals("BorderOnEachPage") ||
                          propFaxOption.Name.Equals("CreateMultiFile") || propFaxOption.Name.Equals("MaxPageperFile") ||
                          propFaxOption.Name.Equals("SetEraseEdges") || propFaxOption.Name.Equals("ApplySameWidth") || propFaxOption.Name.Equals("MirrorFrontSide") || propFaxOption.Name.Equals("UseInches") ||
                          propFaxOption.Name.Equals("SignOrEncrypt") ||
                          propFaxOption.Name.Equals("OriginalOneSided") || propFaxOption.Name.Equals("OriginalPageflip") ||
                          propFaxOption.Name.Equals("OutputOneSided") || propFaxOption.Name.Equals("OutputPageflip") ||
                          propFaxOption.Name.Equals("Collate") ||
                          propFaxOption.Name.Equals("EdgeToEdge") ||
                          propFaxOption.Name.Equals("ZoomSize") || propFaxOption.Name.Equals("ReduceEnlargeOptions") || propFaxOption.Name.Equals("IncludeMargin") ||
                          propFaxOption.Name.Equals("PaperSelectionPaperSize") || propFaxOption.Name.Equals("PaperSelectionPaperType") || propFaxOption.Name.Equals("PaperSelectionPaperTray") ||
                          propFaxOption.Name.Equals("PagesPerSheetElement") || propFaxOption.Name.Equals("PagesPerSheetAddBorder")))
                    {
                        _contentToPrint.AppendLine(string.Format("{0} : {1}", propFaxOption.Name, propFaxOption.GetValue(_faxData.ScanOptions, null)));
                    }
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Converts the specified XML metadata to the new version.
        /// </summary>
        /// <param name="xml">The XML metadata.</param>
        /// <returns>System.Xml.Linq.XElement.</returns>
        public XElement Convert(XElement xml)
        {
            // Get XML root namespace for manual conversion
            XNamespace rootNS = xml.GetDefaultNamespace();

            // Create the latest ActivityData
            FaxActivityData resultData = new FaxActivityData()
            {
                AutomationPause    = GetTimeSpan(xml, "AutomationPause"),
                DigitalSendServer  = GetValue(xml, "DigitalSendServer"),
                EnableNotification = GetBool(xml, "EnableNotification"),
                FaxType            = FaxConfiguration.LANFax,
                FaxOperation       = FaxTask.SendFax,
                NotificationEmail  = GetValue(xml, "NotificationEmail")
            };

            resultData.ScanOptions.LockTimeouts = GetLockTimeoutData(rootNS, xml);
            resultData.ScanOptions.PageCount    = GetInt(xml, "PageCount");
            resultData.ScanOptions.UseAdf       = GetBool(xml, "UseAdf");

            return(Serializer.Serialize(resultData));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Defines and executes the PluginFax workflow.
        /// </summary>
        /// <param name="executionData">Information used in the execution of this workflow.</param>
        /// <returns>The result of executing the workflow.</returns>
        public PluginExecutionResult Execute(PluginExecutionData executionData)
        {
            _faxActivityData = executionData.GetMetadata <FaxActivityData>(ConverterProvider.GetMetadataConverters());
            PrintQueueInfo item = executionData.PrintQueues.GetRandom();

            if (_faxActivityData.PrintJobSeparator)
            {
                _engine.PrintJobSeparator(executionData);
            }
            FaxScanManager manager;

            if (string.IsNullOrWhiteSpace(_faxActivityData.DigitalSendServer))
            {
                manager = new FaxScanManager(executionData);
            }
            else
            {
                manager = new FaxScanManager(executionData, _faxActivityData.DigitalSendServer);
            }

            manager.ActivityStatusChanged += UpdateStatus;
            manager.DeviceSelected        += UpdateDevice;
            return(manager.RunScanActivity());
        }
Exemplo n.º 9
0
        private void ConfigureControls(FaxActivityData data)
        {
            pageCount_NumericUpDown.Value = data.ScanOptions.PageCount;
            lockTimeoutControl.Initialize(data.ScanOptions.LockTimeouts);

            assetSelectionControl.AutomationPause = data.AutomationPause;
            assetSelectionControl.UseAdf          = data.ScanOptions.UseAdf;

            notify_CheckBox.Checked = data.EnableNotification;
            email_ComboBox.Text     = data.NotificationEmail;

            email_ComboBox.Items.Clear();
            // Populate the list of email addresses
            foreach (string email in ConfigurationServices.EnvironmentConfiguration.GetOutputMonitorDestinations("DigitalSendNotification"))
            {
                email_ComboBox.Items.Add(email);
            }

            // Determine whether the DSS server should be filled in
            if (!string.IsNullOrEmpty(data.DigitalSendServer))
            {
                digitalSendServer_TextBox.Text         = data.DigitalSendServer;
                usesDigitalSendServer_CheckBox.Checked = true;
            }
            else
            {
                usesDigitalSendServer_CheckBox.Checked = false;
            }
            foreach (FaxConfiguration type in (FaxConfiguration[])Enum.GetValues(typeof(FaxConfiguration)))
            {
                comboBoxFaxType.Items.Add(type);
            }
            comboBoxFaxType.Text            = data.FaxType.ToString();
            faxNumber_textBox.Text          = data.FaxNumber;
            timeSpanControlFaxReceive.Value = data.FaxReceiveTimeout;

            if (data != null)
            {
                switch (data.FaxOperation)
                {
                case FaxTask.SendFax:
                    radioFaxSend.Checked = true;
                    break;

                case FaxTask.ReceiveFax:
                    radioFaxReceive.Checked = true;
                    break;

                default:
                    break;
                }
            }

            useSpeedDial_Checkbox.Checked = data.UseSpeedDial;

            OptionalRadioButton.Checked = data.ImagePreviewOptions == 0;
            GenerateRadioButton.Checked = data.ImagePreviewOptions == 1;
            RestrictRadioButton.Checked = data.ImagePreviewOptions == 2;

            PIN_textBox.Text = data.PIN;
            _faxOptions      = data.ScanOptions;
            comboBox_AuthProvider.SelectedValue = data.AuthProvider;
            if (data.ApplicationAuthentication)
            {
                radioButton_Fax.Checked = true;
            }
            else
            {
                radioButton_SignInButton.Checked = true;
            }
        }
Exemplo n.º 10
0
 public FaxScanManager(PluginExecutionData executionData, string serverName)
     : base(executionData, serverName)
 {
     _data       = executionData.GetMetadata <FaxActivityData>(ConverterProvider.GetMetadataConverters());
     ScanOptions = _data.ScanOptions;
 }