/// <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() { ScanToUsbData data = new ScanToUsbData() { UsbName = usb_TextBox.Text, QuickSetName = quickSet_TextBox.Text, UseQuickset = quickSet_RadioButton.Checked, UseOcr = useOcr_CheckBox.Checked, AutomationPause = assetSelectionControl.AutomationPause, ScanOptions = _scanOptions, ApplicationAuthentication = radioButton_ScanToUSB.Checked, AuthProvider = (AuthenticationProvider)comboBox_AuthProvider.SelectedValue }; data.ScanOptions.PageCount = (int)pageCount_NumericUpDown.Value; data.ScanOptions.LockTimeouts = lockTimeoutControl.Value; data.ScanOptions.UseAdf = assetSelectionControl.UseAdf; if (usesDigitalSendServer_CheckBox.Checked) { data.DigitalSendServer = digitalSendServer_TextBox.Text; } else { data.DigitalSendServer = null; } return(new PluginConfigurationData(data, Version) { Assets = assetSelectionControl.AssetSelectionData, Documents = assetSelectionControl.AdfDocuments }); }
private void ConfigureControls(ScanToUsbData data) { usb_TextBox.Text = data.UsbName; quickSet_TextBox.Text = data.QuickSetName; quickSet_RadioButton.Checked = data.UseQuickset; usbName_RadioButton.Checked = !data.UseQuickset; useOcr_CheckBox.Checked = data.UseOcr; pageCount_NumericUpDown.Value = data.ScanOptions.PageCount; lockTimeoutControl.Initialize(data.ScanOptions.LockTimeouts); assetSelectionControl.AutomationPause = data.AutomationPause; assetSelectionControl.UseAdf = data.ScanOptions.UseAdf; // 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_ScanToUSB.Checked = true; } else { radioButton_SignInButton.Checked = true; } comboBox_AuthProvider.SelectedValue = data.AuthProvider; }
/// <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); ScanToUsbData resultData = null; if (version < v4_10) { //Convert old metadata to new schema. resultData = new ScanToUsbData() { AutomationPause = GetTimeSpan(xml, "AutomationPause"), DigitalSendServer = GetValue(xml, "DigitalSendServer"), QuickSetName = GetValue(xml, "QuickSetName"), UsbName = GetValue(xml, "UsbName"), 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 <ScanToUsbData>(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)); }
/// <summary> /// Validates the given metadata against the ScanToUsb Activity data. /// </summary> /// <param name="configurationData">The configuration data.</param> /// <returns>true if valid</returns> public bool ValidateMetadata(ref PluginConfigurationData configurationData) { bool validData = true; ScanToUsbData activityData = null; try { activityData = configurationData.GetMetadata <ScanToUsbData>(ConverterProvider.GetMetadataConverters()); } catch { activityData = new ScanToUsbData(); validData = false; } configurationData = new PluginConfigurationData(activityData, ScanToUsbConfigControl.Version); return(validData); }
public PluginExecutionResult Execute(PluginExecutionData executionData) { ScanToUsbData data = executionData.GetMetadata <ScanToUsbData>(ConverterProvider.GetMetadataConverters()); UsbScanManager manager; if (string.IsNullOrWhiteSpace(data.DigitalSendServer)) { manager = new UsbScanManager(executionData); } else { manager = new UsbScanManager(executionData, data.DigitalSendServer); } manager.ActivityStatusChanged += UpdateStatus; manager.DeviceSelected += UpdateDevice; return(manager.RunScanActivity()); }
public UsbScanManager(PluginExecutionData executionData, string serverName) : base(executionData, serverName) { _data = executionData.GetMetadata <ScanToUsbData>(ConverterProvider.GetMetadataConverters()); ScanOptions = _data.ScanOptions; }