//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ private bool StartScan() { try { ScanFinished = false; DisableAllButtons(false); ScannedPageCount = 0; ChageStatusText("Status: Es wird gescannt"); ScanSettings = new ScanSettings(); ScanSettings.UseDocumentFeeder = InsertionCheckBox.Checked; ScanSettings.AbortWhenNoPaperDetectable = false; ScanSettings.UseAutoFeeder = InsertionCheckBox.Checked; ScanSettings.ShowTwainUI = VendorToolCheckBox.Checked; ScanSettings.ShowProgressIndicatorUI = true; ScanSettings.Area = null; ScanSettings.ShouldTransferAllPages = true; ScanSettings.UseDuplex = DoubleSidedCheckBox.Checked; var QualitySettings = new ResolutionSettings(); QualitySettings.Dpi = 200; if (GreyCheckBox.Checked) { QualitySettings.ColourSetting = ColourSetting.GreyScale; } else { QualitySettings.ColourSetting = ColourSetting.Colour; } ScanSettings.Resolution = QualitySettings; ScanSettings.Rotation = new RotationSettings() { AutomaticRotate = RotationCorrectionCheckBox.Checked, AutomaticBorderDetection = EdgeDetectionCheckBox.Checked }; try { TwainLib.StartScanning(ScanSettings); } catch (TwainException ex) { MessageBox.Show(ex.Message); DisableAllButtons(true); EnableButtons(); this.Focus(); ChageStatusText("Status:"); } return(true); } catch (Exception ex) { Program.MeldeFehler(ex.Message + "\n" + ex.StackTrace); Environment.Exit(1); return(false); } }
public EmailQuickSetData(string fromUser, string defaultFrom, string to, string name, string type, ScanSettings data, FileSettings fileSettingsData) { ScanSetData = data; FileSetData = fileSettingsData; FromUser = fromUser; DefaultFrom = defaultFrom; To = to; QName = name; QType = type; Name = name; }
public OsaScanResponse StartOsaScan(ScanSettings scanSettings) { var scanRestRequest = new OsaScanRequestDto { ProjectId = scanSettings.ProjectId, ZippedSource = scanSettings.ZipFileContents, ProjectName = scanSettings.ProjectName }; return(restClient.Scan(scanRestRequest)); }
/// <summary> /// Excutes a new scan with the provided settings and comparer. /// </summary> /// <param name="settings">The scan settings.</param> /// <param name="comparer">The comparer.</param> public void ExcuteScan(ScanSettings settings, IScanComparer comparer) { Contract.Requires(settings != null); Contract.Requires(comparer != null); Reset(); SetGuiFromSettings(settings); Invoke((Action)(async() => await StartFirstScanEx(settings, comparer))); }
public bool get_scan_settings(resultClass token, long projectId) { getScans scans = new getScans(); if (!CxSettings.ContainsKey(projectId)) { ScanSettings scanSettings = scans.getScanSettings(token, projectId.ToString()); CxSettings.Add(projectId, scanSettings); } return(true); }
private static void HandleWeeklyCommand(string pathArg, string gameArg) { var rootDir = Path.GetFullPath(pathArg); var scoresDb = new ScoresArchive(rootDir); var settings = ScanSettings.Read(rootDir); var prevGlobalPoints = scoresDb.GetPreviousGlobalPoints(); var ranking = scoresDb.InitRankingWithLastWeeklyScore(settings.Week) .Join(prevGlobalPoints, w => w.Xuid, m => m.Key, (r, gp) => r with { InitialPoints = gp.Value, NewPoints = 0 })
private void btnInit_Click(object sender, RoutedEventArgs e) { Console.WriteLine("Scan..."); fileName.Content = string.Empty; progressBar.Visibility = Visibility.Visible; Thread thread = new Thread(() => { ScanWindow sw = new ScanWindow(); sw.TransferTempImage += Sw_TransferTempImage; sw.TransferCompleteImage += Sw_TransferCompleteImage; sw.ShowDialog(); }); thread.TrySetApartmentState(ApartmentState.STA); thread.Start(); return; //_settings = new ScanSettings(); //_settings.ShouldTransferAllPages = true; //_settings.ShowProgressIndicatorUI = false; //_settings.Resolution = ResolutionSettings.ColourPhotocopier; imageCount = 0; _settings = new ScanSettings { UseDocumentFeeder = false, ShowTwainUI = false, ShowProgressIndicatorUI = false, UseDuplex = false, Resolution = ResolutionSettings.Photocopier, Area = null, ShouldTransferAllPages = true, Rotation = new RotationSettings { AutomaticRotate = false, AutomaticBorderDetection = false } }; scannerName = ManualSource.SelectedItem.ToString(); try { _twain.SelectSource(scannerName); _twain.StartScanning(_settings); } catch (Exception ex) { Console.WriteLine(ex); } Console.WriteLine("Scan done."); }
public override void ViewDidLoad() { base.ViewDidLoad(); // The scanning behavior of the barcode picker is configured through scan // settings. We start with empty scan settings and enable a generous set // of 1D symbologies. Matrix scan is currently only supported for 1D // symbologies, enabling 2D symbologies will result in unexpected results. // In your own apps, only enable the symbologies you actually need. ScanSettings settings = ScanSettings.DefaultSettings(); NSSet symbologiesToEnable = new NSSet( Symbology.EAN13, Symbology.EAN8, Symbology.UPC12, Symbology.UPCE, Symbology.Code39, Symbology.Code128, Symbology.ITF ); // Enable matrix scan and set the max number of barcodes that can be recognized per frame // to some reasonable number for your use case. The max number of codes per frame does not // limit the number of codes that can be tracked at the same time, it only limits the // number of codes that can be newly recognized per frame. settings.EnableSymbologies(symbologiesToEnable); settings.MatrixScanEnabled = true; settings.MaxNumberOfCodesPerFrame = 10; settings.HighDensityModeEnabled = true; // When matrix scan is enabled beeping/vibrating is often not wanted. BarcodePicker picker = new BarcodePicker(settings); picker.OverlayView.SetBeepEnabled(false); picker.OverlayView.SetVibrateEnabled(false); // Register a SBSScanDelegate delegate, in order to be notified about relevant events // (e.g. a successfully scanned bar code). scanDelegate = new PickerScanDelegate(); picker.ScanDelegate = scanDelegate; // Register a SBSProcessFrameDelegate delegate to be able to reject tracked codes. processFrameDelegate = new PickerProcessFrameDelegate(); picker.ProcessFrameDelegate = processFrameDelegate; AddChildViewController(picker); picker.View.Frame = View.Bounds; Add(picker.View); picker.DidMoveToParentViewController(this); picker.OverlayView.GuiStyle = GuiStyle.MatrixScan; picker.StartScanning(); }
private void Awake() { settings = new ScanSettings { ScanFlags = ScanFlags.Key, // If the player presses this key the scan will be canceled. CancelScanKey = KeyCode.Escape, // If the player doesn't press any key within the specified number // of seconds the scan will be canceled. Timeout = 10 }; }
private void StartTwainScan(ScanSettings settings) { _twain.ScanningComplete += Twain_ScanningComplete; _twain.TransferImage += Twain_TransferImage; settings.ShowTwainUI = false; settings.ShowProgressIndicatorUI = false; Log("Select this source"); _twain.SelectSource(Name); Log("Select this source success"); Log("Start scanning"); _twain.StartScanning(settings); }
public FTPQuickSetData(List <string> server, string name, string type, ScanSettings data, FileSettings fileSettingsData) { ScanSetData = data; FileSetData = fileSettingsData; FTPServer = server[0]; PortNumber = server[1]; DirectoryPath = server[2]; UserName = server[3]; FTPProtocol = server[4]; QName = name; QType = type; Name = name; }
private Program() { OnClose(Console_OnClose); //Take care, PauseWhileScanning is unstable yet _settings = new ScanSettings(writable: ScanType.ONLY); //This is our default setup _scanner = new MemoryScanner(); _processesPaused = new List <Process>(); _scanner.SearchResult += Search_Result; }
public SettingsPage() { InitializeComponent(); _picker = ScanditService.BarcodePicker; _scanSettings = _picker.GetDefaultScanSettings(); initializeGuiElements(); // restore the currently used settings to those found in // the permanent storage. updateScanSettings(); updateScanOverlay(); }
ProjectSummary ResolveProject(ScanRequest request, ScanSettings scanSettings) { var project = proxy.FindProjectByName(request.ProjectName); if (project == null) { return(null); } scanSettings.ProjectId = project.Id; scanSettings.ProjectName = request.ProjectName; scanSettings.TeamName = request.TeamName; return(project); }
public override void ViewDidLoad() { base.ViewDidLoad(); // The scanning behavior of the barcode picker is configured through scan // settings. We start with empty scan settings and enable a very generous // set of symbologies. In your own apps, only enable the symbologies you // actually need. ScanSettings settings = ScanSettings.DefaultSettings(); NSSet symbologiesToEnable = new NSSet( Symbology.EAN13, Symbology.EAN8, Symbology.UPC12, Symbology.UPCE, Symbology.Datamatrix, Symbology.QR, Symbology.Code39, Symbology.Code128, Symbology.ITF ); settings.EnableSymbologies(symbologiesToEnable); // Enable and set the restrict active area. This will make sure that codes are only scanned in a very thin band in the center of the image. settings.SetActiveScanningArea(new CoreGraphics.CGRect(0, 0.48, 1, 0.04)); // Setup the barcode scanner picker = new BarcodePicker(settings); picker.OverlayView.ShowToolBar(false); // Add delegate for the scan event. We keep references to the // delegates until the picker is no longer used as the delegates are softly // referenced and can be removed because of low memory. scanDelegate = new PickerScanDelegate(); picker.ScanDelegate = scanDelegate; AddChildViewController(picker); picker.View.Frame = View.Bounds; Add(picker.View); picker.DidMoveToParentViewController(this); // Modify the GUI style to have a "laser" line instead of a square viewfinder. picker.OverlayView.GuiStyle = GuiStyle.Laser; // Start scanning in paused state. picker.StartScanning(true); showAimAndScanButton(); }
public FolderSettingsData() { Folder = new DataPair <string> { Key = String.Empty }; EnableScanToFolder = new DataPair <string> { Key = String.Empty }; CroppingOption = new DataPair <string> { Key = String.Empty }; ScanSettingsData = new ScanSettings(); FileSettingsData = new FileSettings(); }
void InitializeAndStartBarcodeScanning() { // The scanning behavior of the barcode picker is configured through scan // settings. We start with empty scan settings and enable a very generous // set of symbologies. In your own apps, only enable the symbologies you // actually need. ScanSettings settings = ScanSettings.Create(); int[] symbologiesToEnable = new int[] { Barcode.SymbologyEan13, Barcode.SymbologyEan8, Barcode.SymbologyUpca, Barcode.SymbologyDataMatrix, Barcode.SymbologyQr, Barcode.SymbologyCode39, Barcode.SymbologyCode128, Barcode.SymbologyInterleaved2Of5, Barcode.SymbologyUpce }; foreach (int symbology in symbologiesToEnable) { settings.SetSymbologyEnabled(symbology, true); } // Some 1d barcode symbologies allow you to encode variable-length data. By default, the // Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your // application requires scanning of one of these symbologies, and the length is falling // outside the default range, you may need to adjust the "active symbol counts" for this // symbology. This is shown in the following few lines of code. SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128); short[] activeSymbolCounts = new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; symSettings.SetActiveSymbolCounts(activeSymbolCounts); // For details on defaults and how to calculate the symbol counts for each symbology, take // a look at http://docs.scandit.com/stable/c_api/symbologies.html. barcodePicker = new BarcodePicker(this, settings); // Set listener for the scan event. barcodePicker.SetOnScanListener(this); // Show the scan user interface SetContentView(barcodePicker); }
private void Timer_Tick(object sender, EventArgs e) { timer.Stop(); imageCount = 0; _settings = new ScanSettings { UseDocumentFeeder = true, ShowTwainUI = false, ShowProgressIndicatorUI = false, UseDuplex = false, Resolution = ResolutionSettings.ColourPhotocopier, // 顏色 /*Area = null,*/ ShouldTransferAllPages = true, Rotation = new RotationSettings { AutomaticRotate = false, AutomaticBorderDetection = false // A8好像不支援這個 } }; _settings.Page = new PageSettings(); // page參數好像沒什麼用 _settings.Page.Size = PageType.None; //_settings.Page.Orientation = TwainDotNet.TwainNative.Orientation.Auto; _settings.Area = new AreaSettings(Units.Inches, 0, 0, 3.7f, 2.1f); // 設定掃描紙張的邊界 _settings.AbortWhenNoPaperDetectable = true; // 要偵測有沒有紙 _settings.Contrast = 300; try { _scannerName = /*"WIA-A8 ColorScanner PP"; */ "A8 ColorScanner PP"; //sourceList.Last()*/; _twain.SelectSource(_scannerName); _twain.StartScanning(_settings); // 做open→設定各種CAPABILITY→EnableDS→等回傳圖 /// Once the Source is enabled via the DG_CONTROL / DAT_USERINTERFACE/ MSG_ENABLEDS operation, /// all events that enter the application’s main event loop must be immediately forwarded to the Source. /// The Source, not the application, controls the transition from State 5 to State 6. /// - spec pdf p.3-60 } catch (FeederEmptyException) { MessageBox.Show("沒有紙"); Close(); } catch (Exception ex) { Console.WriteLine(ex); Close(); } }
protected ScanSettings GetScanSettings() { ScanSettings settings = ScanSettings.Create(); settings.SetSymbologyEnabled(Barcode.SymbologyEan13, true); settings.SetSymbologyEnabled(Barcode.SymbologyUpce, true); settings.SetSymbologyEnabled(Barcode.SymbologyUpca, true); settings.SetSymbologyEnabled(Barcode.SymbologyEan8, true); settings.MatrixScanEnabled = true; settings.MaxNumberOfCodesPerFrame = 12; settings.HighDensityModeEnabled = true; settings.CodeCachingDuration = 0; settings.CodeDuplicateFilter = 0; return(settings); }
public string Scan(string deviceId) { try { ScanSettings settings = new ScanSettings(); settings.DeviceId = deviceId; var image = WIAScanner.Scan(settings); return(image.First()); } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(String.Format("Device Id is {0}", deviceId)); return("Error: " + ex.Message); } }
private void ScanTwainFixedSize() { AreaSettings AreaSettings = new AreaSettings(Units.Centimeters, 0f, 0f, 29.7f, 21.01f); ScanSettings _settings = new ScanSettings(); ResolutionSettings rs = new ResolutionSettings(); rs.ColourSetting = ColourSetting.GreyScale; rs.Dpi = 100; _settings.Resolution = rs; _settings.ShowTwainUI = false; _settings.ShowProgressIndicatorUI = true; _settings.Area = AreaSettings; _twain.StartScanning(_settings); }
private void btn_scanimage_Click(object sender, EventArgs e) { try { _twain.SelectSource(); _settings = new ScanSettings(); _settings.ShowProgressIndicatorUI = true; _settings.Resolution = ResolutionSettings.ColourPhotocopier; _twain.StartScanning(_settings); } catch (TwainException ex) { MessageBox.Show(ex.Message); Enabled = true; } }
public void SetData(ScanSettings scanSettingsData) { RemoveEventHandlers(); SetComboBoxData(scanSettingsData.OriginalSize, originalSize_ComboBox, ListValues.OriginalSize); SetComboBoxData(scanSettingsData.OriginalSides, originalSides_choiceComboControl, ListValues.OriginalSides); SetComboBoxData(scanSettingsData.Optimize, optimize_choiceComboControl, ListValues.OptimizeModes); SetComboBoxData(scanSettingsData.ContentOrientation, orientation_choiceComboControl, null); SetComboBoxData(scanSettingsData.Sharpness, sharpness_choiceComboControl, ListValues.SharpnessModes); SetComboBoxData(scanSettingsData.Cleanup, cleanup_choiceComboControl, ListValues.CleanupModes); SetComboBoxData(scanSettingsData.Darkness, darkness_choiceComboControl, ListValues.DarknessModes); SetComboBoxData(scanSettingsData.Contrast, contrast_choiceComboControl, ListValues.ContrastModes); SetComboBoxData(scanSettingsData.ImagePreview, preview_choiceComboControl, ListValues.ImagePreview); AddEventHandlers(); }
/// <summary> /// Creates the search settings from the user input. /// </summary> /// <returns>The scan settings.</returns> private ScanSettings CreateSearchSettings() { Contract.Ensures(Contract.Result <ScanSettings>() != null); var settings = new ScanSettings { ValueType = valueTypeComboBox.SelectedValue }; long.TryParse(startAddressTextBox.Text, NumberStyles.HexNumber, null, out var startAddressVar); long.TryParse(stopAddressTextBox.Text, NumberStyles.HexNumber, null, out var endAddressVar); #if RECLASSNET64 settings.StartAddress = unchecked ((IntPtr)startAddressVar); settings.StopAddress = unchecked ((IntPtr)endAddressVar); #else settings.StartAddress = unchecked ((IntPtr)(int)startAddressVar); settings.StopAddress = unchecked ((IntPtr)(int)endAddressVar); #endif settings.EnableFastScan = fastScanCheckBox.Checked; int.TryParse(fastScanAlignmentTextBox.Text, out var alignment); settings.FastScanAlignment = Math.Max(1, alignment); SettingState CheckStateToSettingState(CheckState state) { switch (state) { case CheckState.Checked: return(SettingState.Yes); case CheckState.Unchecked: return(SettingState.No); default: return(SettingState.Indeterminate); } } settings.ScanPrivateMemory = scanPrivateCheckBox.Checked; settings.ScanImageMemory = scanImageCheckBox.Checked; settings.ScanMappedMemory = scanMappedCheckBox.Checked; settings.ScanWritableMemory = CheckStateToSettingState(scanWritableCheckBox.CheckState); settings.ScanExecutableMemory = CheckStateToSettingState(scanExecutableCheckBox.CheckState); settings.ScanCopyOnWriteMemory = CheckStateToSettingState(scanCopyOnWriteCheckBox.CheckState); return(settings); }
public string ScanDefault() { var devices = this.GetDevices(); try { ScanSettings settings = new ScanSettings(); settings.DeviceId = devices.FirstOrDefault().DeviceId; var images = WIAScanner.Scan(settings); return(images.First()); } catch (Exception ex) { Debug.WriteLine(ex.Message); return("Error: " + ex.Message); } }
public string ScanWithSettings(int intent, string deviceId) { try { StatusVariables.Path = ""; ScanSettings settings = new ScanSettings(); settings.DeviceId = deviceId; settings.WIA_Intent = intent; var image = WIAScanner.Scan(settings); return(image.First()); } catch (Exception ex) { Debug.WriteLine(ex.Message); return("Error: " + ex.Message); } }
/// <summary> /// Starts a new first scan with the provided settings and comparer. /// </summary> /// <param name="settings">The scan settings.</param> /// <param name="comparer">The comparer.</param> private async Task StartFirstScanEx(ScanSettings settings, IScanComparer comparer) { if (!Program.RemoteProcess.IsValid) { return; } firstScanButton.Enabled = false; cancelScanIconButton.Visible = true; try { scanner = new Scanner(Program.RemoteProcess, settings); var report = new Progress <int>(i => { scanProgressBar.Value = i; SetResultCount(scanner.TotalResultCount); }); cts = new CancellationTokenSource(); await scanner.Search(comparer, report, cts.Token); ShowScannerResults(scanner); cancelScanIconButton.Visible = false; nextScanButton.Enabled = true; valueTypeComboBox.Enabled = false; floatingOptionsGroupBox.Enabled = false; stringOptionsGroupBox.Enabled = false; scanOptionsGroupBox.Enabled = false; isFirstScan = false; SetValidCompareTypes(); OnCompareTypeChanged(); } finally { firstScanButton.Enabled = true; scanProgressBar.Value = 0; } }
public ScanDocumentViewModel(ICollectionRepository <TDocument, Guid> documentsRepository, ScanSettings scanSettings) { _documentsRepository = documentsRepository; ScanSettings = scanSettings; var imageDisplayModes = ScanHelper.CreateImageDisplayModeSource(); _imageStretchUniformToFill = imageDisplayModes.FirstOrDefault(i => i.Stretch == Stretch.UniformToFill); _imageStretchNoneButScale = imageDisplayModes.FirstOrDefault(i => i.Stretch == Stretch.None); ImageColorModeSource = ScanHelper.CreateImageColorModeSource(); ImageQualitySource = ScanHelper.CreateImageQualitySource(); ImageQuality = ImageQualitySource.FirstOrDefault(i => i.Default); ImageFormatsSource = ImageFileFormat.Formats; ScanEnabled = true; QualityEnabled = false; AutoScale = true; ImageScaleRatio = 1; ImageFormatItem = ImageFormatsSource.FirstOrDefault(i => Equals(i.ImageFormat, _defaultImageFormat)); }
public void OnMap() { AllUninteractable(); var colors = Use.colors; colors.colorMultiplier = 5f; Map.colors = colors; Map.GetComponentInChildren <Text>().text = ""; ScanSettings settings = new ScanSettings(); settings.cancelScanButton = "Escape"; settings.scanFlags = ScanFlags.Key; settings.userData = "Map"; settings.timeout = 20f; InputManager.StartScan(settings, HandleKeyScan); isEditing = true; }
public void OnQuests() { AllUninteractable(); var colors = Pause.colors; colors.colorMultiplier = 5f; Quests.colors = colors; Quests.GetComponentInChildren <Text>().text = ""; ScanSettings settings = new ScanSettings(); settings.scanFlags = ScanFlags.Key; settings.userData = "Quests"; settings.timeout = 20f; InputManager.StartScan(settings, HandleKeyScan); isEditing = true; Debug.Log("Is editing"); }
public void Acquire(Document document, ScanSettings settings, AcquireCallback callback) { if(fActiveDataSource != null) { fDocument = document; OnScanningComplete = callback; if(fActiveDataSource.Acquire(settings) == false) { Raise_OnScanningComplete(false); } } }
private void Scan(PageTypeEnum pageType) { ScanSettings settings = new ScanSettings(); SizeInches size; switch(pageType) { case PageTypeEnum.Letter: { size = SizeInches.Letter; } break; case PageTypeEnum.Legal: { size = SizeInches.Legal; } break; default: case PageTypeEnum.Custom: { size = new SizeInches(fAppSettings.ScannerCustomPageSize.Width, fAppSettings.ScannerCustomPageSize.Height); } break; } settings.ScanArea = new BoundsInches(0, 0, size); settings.EnableFeeder = fAppSettings.ScannerEnableFeeder; settings.ColorMode = fAppSettings.ScannerColorMode; settings.Resolution = fAppSettings.ScannerResolution; settings.Threshold = fAppSettings.ScannerThreshold; settings.Brightness = fAppSettings.ScannerBrightness; settings.Contrast = fAppSettings.ScannerContrast; settings.ShowSettingsUI = fAppSettings.ScannerUseNativeUI; settings.ShowTransferUI = true; fScanner.Acquire(fDocument, settings, fScanner_AcquireCallback); if(fLastScanned != pageType) { fLastScanned = pageType; RefreshButtonScanLabel(); } }
private void Scan(PageTypeEnum pageType, double resolution) { if(RefreshScannerActiveDataSource()) { ScanSettings settings = new ScanSettings(); settings.EnableFeeder = true; settings.ColorMode = ColorModeEnum.RGB; settings.PageType = pageType; settings.Resolution = (int)resolution; settings.Threshold = 0.75; settings.Brightness = 0.5; settings.Contrast = 0.5; if(fScanner.Acquire(fDocument, settings, fAppSettings.UseScannerNativeUI, true) == false) { UtilDialogs.ShowError("Scanner failed to start"); } RefreshControls(); } }
private void setLollipopProperty() { Console.WriteLine("Setting up lollipop property"); this._bleScanner = this._adapter.BluetoothLeScanner; this._lollipopCallback = new LollipopScanCallback(); this._lollipopCallback.deviceFoundEvent += OnLeScan; //ScanMode is declared in Util object due to namespace conflict of ScanMode object in both Android.Bluetooth and Android.Bluetooth.LE this._scanSettings = new ScanSettings.Builder().SetScanMode(Util.ScanModeLowLatency).Build(); }