Exemplo n.º 1
0
        private object[] GetSettingParametersJediWindjammer(ScanOptions scanOptions, string settingType, int arguementCount)
        {
            object[] settingParameters = null;
            switch (settingType)
            {
            case "SelectFileType":
            {
                if (!scanOptions.FileType.Equals(FileType.DeviceDefault))
                {
                    settingParameters = new object[] { scanOptions.FileType.GetDescription() };
                }
                break;
            }

            case "SetColor":
            {
                if (!scanOptions.Color.Equals(ColorType.None))
                {
                    settingParameters = new object[] { scanOptions.Color };
                }
                break;
            }

            case "SelectOptimizeTextOrPicture":
            {
                if (!scanOptions.OptimizeTextorPic.Equals(OptimizeTextPic.None))
                {
                    settingParameters = new object[] { scanOptions.OptimizeTextorPic };
                }
                break;
            }
            }
            return(settingParameters);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Common method to set the setting options for all Scan and Fax plugins
        /// </summary>
        /// <param name="scanOptions"><c>ScanOptions</c> instance having user selection data</param>
        /// <param name="OptionsManager">Runtime instance of the OPtions manager implmenting the settings code</param>
        /// <param name="appType">Runtime instance of Plugin App </param>
        /// <param name="device">Device information used for the run</param>
        protected void SetOptions(ScanOptions scanOptions, Type OptionsManager, Type appType, IDevice device)
        {
            Type property = appType.GetProperty("Options").PropertyType;

            object[] methodData = new object[] { device };
            object   instance   = Activator.CreateInstance(OptionsManager, methodData);

            object[] parameters = null;

            foreach (MethodInfo info in property.GetMethods())
            {
                //Checks if the base class of the OptionManger is of type Jedi Omni
                if (OptionsManager.BaseType.Equals(typeof(HP.ScalableTest.DeviceAutomation.Helpers.JediOmni.JediOmniJobOptionsManager)))
                {
                    parameters = GetSettingParametersJediOmni(scanOptions, info.Name, info.GetParameters().Length);
                }
                else
                {
                    parameters = GetSettingParametersJediWindjammer(scanOptions, info.Name, info.GetParameters().Length);
                }

                if (parameters != null)
                {
                    info.Invoke(instance, parameters);
                    UpdateStatus(string.Format("Option {0} has been set  ...... ", info.Name));
                }
            }
            UpdateStatus(string.Format("All options setting completed sucessfully ! "));
        }
Exemplo n.º 3
0
 /// <summary>
 /// ScanOptionsForm constructor with scanOptions as parameter
 /// </summary>
 /// <param name="scanOptions"></param>
 public ScanOptionsForm(ScanOptions scanOptions)
 {
     InitializeComponent();
     ScanOption = scanOptions;
     fieldValidator.RequireValue(email_TextBox, "Email Id", email_RadioButton);
     fieldValidator.SetIconAlignment(email_TextBox, ErrorIconAlignment.MiddleLeft);
     resolutionType_ComboBox.DataSource     = EnumUtil.GetDescriptions <ResolutionType>().Where(x => !x.Contains(ResolutionType.Fine.ToString()) && !x.Contains(ResolutionType.Standard.ToString()) && !x.Contains(ResolutionType.SuperFine.ToString())).ToList();
     fileType_ComboBox.DataSource           = EnumUtil.GetDescriptions <FileType>().ToList();
     originalSides_ComboBox.DataSource      = EnumUtil.GetDescriptions <OriginalSides>().ToList();
     color_ComboBox.DataSource              = EnumUtil.GetDescriptions <ColorType>().ToList();
     originalSize_ComboBox.DataSource       = EnumUtil.GetDescriptions <OriginalSize>().ToList();
     contentOrientation_ComboBox.DataSource = EnumUtil.GetDescriptions <ContentOrientation>().ToList();
     optimizeTextPic_ComboBox.DataSource    = EnumUtil.GetDescriptions <OptimizeTextPic>().ToList();
     croppingOptions_ComboBox.DataSource    = EnumUtil.GetDescriptions <Cropping>().ToList();
     blankPageSupress_ComboBox.DataSource   = EnumUtil.GetDescriptions <BlankPageSupress>().ToList();
     notification_ComboBox.DataSource       = EnumUtil.GetDescriptions <NotifyCondition>().ToList();
     scanMode_ComboBox.DataSource           = EnumUtil.GetDescriptions <ScanMode>().ToList();
     paperSize_ComboBox.DataSource          = EnumUtil.GetDescriptions <PaperSelectionPaperSize>().ToList();
     paperTray_ComboBox.DataSource          = EnumUtil.GetDescriptions <PaperSelectionPaperTray>().ToList();
     paperType_ComboBox.DataSource          = EnumUtil.GetDescriptions <PaperSelectionPaperType>().ToList();
 }
Exemplo n.º 4
0
        private object[] GetSettingParametersJediOmni(ScanOptions scanOptions, string settingType, int arguementCount)
        {
            object[] settingParameters = null;
            switch (settingType)
            {
            case "SelectFileType":
            {
                if (!scanOptions.FileType.Equals(FileType.DeviceDefault))
                {
                    settingParameters = new object[] { scanOptions.FileType.GetDescription() };
                }
                break;
            }

            case "SelectResolution":
            case "SelectFaxResolution":
            {
                if (!scanOptions.ResolutionType.Equals(ResolutionType.None))
                {
                    settingParameters = new object[] { scanOptions.ResolutionType };
                }
                break;
            }

            case "SelectOriginalSides":
            {
                if (!scanOptions.OriginalSides.Equals(OriginalSides.None))
                {
                    settingParameters = new object[] { scanOptions.OriginalSides, scanOptions.PageFlipup };
                }
                break;
            }

            case "SelectColorOrBlack":
            case "SetColor":
            {
                if (!scanOptions.Color.Equals(ColorType.None))
                {
                    settingParameters = new object[] { scanOptions.Color };
                }
                break;
            }

            case "SelectOriginalSize":
            case "SetOriginalSize":
            {
                if (!scanOptions.OriginalSize.Equals(OriginalSize.None))
                {
                    settingParameters = new object[] { scanOptions.OriginalSize };
                }
                break;
            }

            case "SelectContentOrientation":
            case "SetOrientation":
            {
                if (!scanOptions.ContentOrientationOption.Equals(ContentOrientation.None))
                {
                    settingParameters = new object[] { scanOptions.ContentOrientationOption };
                }
                break;
            }

            case "SelectOptimizeTextOrPicture":
            {
                if (!scanOptions.OptimizeTextorPic.Equals(OptimizeTextPic.None))
                {
                    settingParameters = new object[] { scanOptions.OptimizeTextorPic };
                }
                break;
            }

            case "SelectCropOption":
            {
                if (!scanOptions.Cropping.Equals(Cropping.None))
                {
                    settingParameters = new object[] { scanOptions.Cropping };
                }
                break;
            }

            case "SelectBlankPageSupress":
            {
                if (!scanOptions.BlankPageSupressoption.Equals(BlankPageSupress.None))
                {
                    settingParameters = new object[] { scanOptions.BlankPageSupressoption };
                }
                break;
            }

            case "CreateMultipleFiles":
            {
                settingParameters = new object[] { scanOptions.CreateMultiFile, scanOptions.MaxPageperFile };
                break;
            }

            case "EnablePrintNotification":
            {
                if (!scanOptions.notificationCondition.Equals(NotifyCondition.NeverNotify))
                {
                    if (scanOptions.PrintorEmailNotificationMethod == "Print")
                    {
                        settingParameters = new object[] { scanOptions.notificationCondition, scanOptions.IncludeThumbNail };
                    }
                }
                break;
            }

            case "EnableEmailNotification":
            {
                if (!scanOptions.notificationCondition.Equals(NotifyCondition.NeverNotify))
                {
                    if (scanOptions.PrintorEmailNotificationMethod.Equals("Email"))
                    {
                        settingParameters = new object[] { scanOptions.notificationCondition, scanOptions.EmailNotificationText, scanOptions.IncludeThumbNail };
                    }
                }
                break;
            }

            case "SetEraseEdges":
            {
                if (scanOptions.SetEraseEdges)
                {
                    Dictionary <EraseEdgesType, decimal> eraseEdgeList = new Dictionary <EraseEdgesType, decimal>();
                    foreach (var prop in ScanOptions.EraseEdgesValue.GetType().GetProperties())
                    {
                        if (prop.GetValue(scanOptions.EraseEdgesValue, null).ToString() != string.Empty)
                        {
                            decimal propValue = Convert.ToDecimal(prop.GetValue(scanOptions.EraseEdgesValue, null));
                            if (propValue > 0 && !propValue.Equals(0.00))
                            {
                                foreach (EraseEdgesType edge in Enum.GetValues(typeof(EraseEdgesType)))
                                {
                                    if (string.Equals(edge.ToString(), prop.Name, StringComparison.CurrentCultureIgnoreCase))
                                    {
                                        eraseEdgeList.Add(edge, propValue);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (eraseEdgeList.Count > 0)
                    {
                        settingParameters = new object[] { eraseEdgeList, scanOptions.ApplySameWidth, scanOptions.MirrorFrontSide, ScanOptions.UseInches };
                    }
                }
                break;
            }

            case "SetImageAdjustments":
            {
                if (scanOptions.SetImageAdjustment)
                {
                    //This code is for Scan to Job storage as it does not support Auto Tone
                    if (arguementCount == 4)
                    {
                        settingParameters = new object[] { scanOptions.ImageAdjustSharpness, scanOptions.ImageAdjustDarkness, scanOptions.ImageAdjustContrast, scanOptions.ImageAdjustbackgroundCleanup };
                    }
                    else
                    {
                        settingParameters = new object[] { scanOptions.ImageAdjustSharpness, scanOptions.ImageAdjustDarkness, scanOptions.ImageAdjustContrast, scanOptions.ImageAdjustbackgroundCleanup, scanOptions.AutomaticTone };
                    }
                }
                break;
            }

            case "SelectSigningAndEncrypt":
            {
                if (scanOptions.SignOrEncrypt > -1)
                {
                    bool sign    = scanOptions.SignOrEncrypt == 0 || scanOptions.SignOrEncrypt == 2;
                    bool encrypt = scanOptions.SignOrEncrypt == 1 || scanOptions.SignOrEncrypt == 2;
                    settingParameters = new object[] { sign, encrypt };
                }
                break;
            }

            case "SetSides":
            {
                if (scanOptions.SetSides)
                {
                    settingParameters = new object[] { scanOptions.OriginalOneSided, scanOptions.OutputOneSided, scanOptions.OriginalPageflip, scanOptions.OutputPageflip };
                }
                break;
            }

            case "SetScanMode":
            {
                settingParameters = new object[] { scanOptions.ScanModes };
                break;
            }

            case "SetReduceEnlarge":
            {
                settingParameters = new object[] { scanOptions.ReduceEnlargeOptions, scanOptions.IncludeMargin, scanOptions.ZoomSize };
                break;
            }

            case "SetPaperSelection":
            {
                settingParameters = new object[] { scanOptions.PaperSelectionPaperSize, scanOptions.PaperSelectionPaperType, scanOptions.PaperSelectionPaperTray };
                break;
            }

            case "SetBooklet":
            {
                if (scanOptions.BookLetFormat)
                {
                    settingParameters = new object[] { scanOptions.BookLetFormat, scanOptions.BorderOnEachPage };
                }
                break;
            }

            case "SetPagesPerSheet":
            {
                if (scanOptions.SetPagesPerSheet)
                {
                    settingParameters = new object[] { scanOptions.PagesPerSheetElement, scanOptions.PagesPerSheetAddBorder };
                }
                break;
            }

            case "SetEdgeToEdge":
            {
                settingParameters = new object[] { scanOptions.EdgeToEdge };
                break;
            }

            case "SetCollate":
            {
                settingParameters = new object[] { scanOptions.Collate };
                break;
            }
            }
            return(settingParameters);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScanOptions"/> class.
 /// </summary>
 public ScanOptionsForm()
 {
     InitializeComponent();
     ScanOption = new ScanOptions();
 }