private void ConfigureControls(ScanToFolderData data) { folder_TextBox.Text = data.FolderPath; quickSet_TextBox.Text = data.QuickSetName; quickSet_RadioButton.Checked = data.UseQuickset; networkFolder_RadioButton.Checked = !data.UseQuickset; useOcr_CheckBox.Checked = data.UseOcr; applyCredential_Checkbox.Checked = data.ApplyCredentialsOnVerification; pageCount_NumericUpDown.Value = data.ScanOptions.PageCount; OptionalRadioButton.Checked = data.ImagePreviewOptions == 0; GenerateRadioButton.Checked = data.ImagePreviewOptions == 1; RestrictRadioButton.Checked = data.ImagePreviewOptions == 2; lockTimeoutControl.Initialize(data.ScanOptions.LockTimeouts); assetSelectionControl.AutomationPause = data.AutomationPause; assetSelectionControl.UseAdf = data.ScanOptions.UseAdf; // Determine what logging option should be selected if (data.DestinationType == "Folder Multi") { if (data.DestinationCount > 0) { multipleFoldersExact_RadioButton.Checked = true; destinations_NumericUpDown.Value = data.DestinationCount; } else { multipleFoldersAuto_RadioButton.Checked = true; } } else { singleFolder_RadioButton.Checked = true; } // 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; } _scanOptions = data.ScanOptions; if (data.ApplicationAuthentication) { radioButton_ScanToFolder.Checked = true; } else { radioButton_SignInButton.Checked = true; } comboBox_AuthProvider.SelectedValue = data.AuthProvider; }
/// <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) { ScanToFolderData activityData = configuration.GetMetadata <ScanToFolderData>(ConverterProvider.GetMetadataConverters()); ConfigureControls(activityData); assetSelectionControl.Initialize(configuration.Assets, _deviceAttributes); assetSelectionControl.AdfDocuments = configuration.Documents; }
/// <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); ScanToFolderData resultData = null; if (version < v4_10) { //Convert old metadata to new schema. resultData = new ScanToFolderData() { AutomationPause = GetTimeSpan(xml, "AutomationPause"), DestinationCount = GetInt(xml, "DestinationCount"), DestinationType = GetValue(xml, "DestinationType"), DigitalSendServer = GetValue(xml, "DigitalSendServer"), FolderPath = GetValue(xml, "FolderPath"), QuickSetName = GetValue(xml, "QuickSetName"), UseOcr = GetBool(xml, "UseOcr"), UseQuickset = GetBool(xml, "UseQuickset") }; } else if (version >= v4_10 && version < v4_12) { //Deserialize what is there. It's possible Some ScanOptions were saved. resultData = Serializer.Deserialize <ScanToFolderData>(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)); }
public PluginExecutionResult Execute(PluginExecutionData executionData) { ScanToFolderData data = executionData.GetMetadata <ScanToFolderData>(ConverterProvider.GetMetadataConverters()); var manager = string.IsNullOrWhiteSpace(data.DigitalSendServer) ? new NetworkFolderScanManager(executionData) : new NetworkFolderScanManager(executionData, data.DigitalSendServer); manager.ActivityStatusChanged += UpdateStatus; manager.DeviceSelected += UpdateDevice; return(manager.RunScanActivity()); }
/// <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() { ScanToFolderData data = new ScanToFolderData() { FolderPath = folder_TextBox.Text, QuickSetName = quickSet_TextBox.Text, UseQuickset = quickSet_RadioButton.Checked, UseOcr = useOcr_CheckBox.Checked, ApplyCredentialsOnVerification = applyCredential_Checkbox.Checked, AutomationPause = assetSelectionControl.AutomationPause, ImagePreviewOptions = OptionalRadioButton.Checked ? 0 : GenerateRadioButton.Checked ? 1 : RestrictRadioButton.Checked ? 2 : 0, ScanOptions = _scanOptions, ApplicationAuthentication = radioButton_ScanToFolder.Checked, AuthProvider = (AuthenticationProvider)comboBox_AuthProvider.SelectedValue }; data.ScanOptions.PageCount = (int)pageCount_NumericUpDown.Value; data.ScanOptions.LockTimeouts = lockTimeoutControl.Value; data.ScanOptions.UseAdf = assetSelectionControl.UseAdf; if (data.UseOcr) { data.ScanOptions.FileType = DeviceAutomation.FileType.SearchablePdfOcr; } if (singleFolder_RadioButton.Checked) { data.DestinationType = "Folder"; data.DestinationCount = 1; } else { data.DestinationType = "Folder Multi"; data.DestinationCount = (multipleFoldersAuto_RadioButton.Checked ? 0 : (int)destinations_NumericUpDown.Value); } if (usesDigitalSendServer_CheckBox.Checked) { data.DigitalSendServer = digitalSendServer_TextBox.Text; } else { data.DigitalSendServer = null; } return(new PluginConfigurationData(data, Version) { Assets = assetSelectionControl.AssetSelectionData, Documents = assetSelectionControl.AdfDocuments }); }
/// <summary> /// Validates the given metadata against the ScanToFolder Activity data. /// </summary> /// <param name="configurationData">The configuration data.</param> /// <returns>true if valid</returns> public bool ValidateMetadata(ref PluginConfigurationData configurationData) { bool validData = true; ScanToFolderData activityData = null; try { activityData = configurationData.GetMetadata <ScanToFolderData>(ConverterProvider.GetMetadataConverters()); } catch { activityData = new ScanToFolderData(); validData = false; } configurationData = new PluginConfigurationData(activityData, ScanToFolderConfigControl.Version); return(validData); }
/// <summary> /// Initializes a new instance of the <see cref="NetworkFolderScanManager" /> class. /// </summary> /// <param name="executionData">The execution data.</param> /// <param name="scanOptions">The scan options.</param> /// <param name="serverName">Name of the server.</param> public NetworkFolderScanManager(PluginExecutionData executionData, string serverName) : base(executionData, serverName) { _data = executionData.GetMetadata <ScanToFolderData>(ConverterProvider.GetMetadataConverters()); ScanOptions = _data.ScanOptions; }