private void RemoveScanningControl(WorkItem workItem, FrameworkElement frameworkElement) { bool enableScanning = FrameworkElementStrategySettings.GetEnableScanning(frameworkElement); if (enableScanning) { if (workItem.Services.Contains(typeof(Services.TextControlScannerService))) { workItem.Services.Get <Services.TextControlScannerService>().RemoveControl(frameworkElement); } } }
private void AddScanningControl(WorkItem workItem, FrameworkElement frameworkElement) { bool enableScanning = FrameworkElementStrategySettings.GetEnableScanning(frameworkElement); if (enableScanning) { string applicationIdentifier = FrameworkElementStrategySettings.GetApplicationIdentifier(frameworkElement); Key completeScanKey = FrameworkElementStrategySettings.GetCompleteScanKey(frameworkElement); if (!workItem.Services.Contains(typeof(Services.TextControlScannerService))) { workItem.Services.Add <Services.TextControlScannerService>(new Services.TextControlScannerService()); } workItem.Services.Get <Services.TextControlScannerService>().AddControl(frameworkElement, applicationIdentifier, completeScanKey); } }