naps2 icon indicating copy to clipboard operation
naps2 copied to clipboard

use sdk1.0.0 to scan files ,how to show the ShowOperation Progress

Open 800903 opened this issue 1 year ago • 1 comments

use demo from the website -->https://www.naps2.com/sdk the demo can not show the scan Progress.. vs2013 NAPS2.Threading.Invoker.Current cant not use by other application.

800903 avatar Apr 26 '24 14:04 800903

https://www.naps2.com/sdk/doc/api/NAPS2.Scan.ScanController.html#events

cyanfish avatar Apr 27 '24 15:04 cyanfish

thanks ,get it done;

delegate void SetProcssBarCallback(int _value); private void SetProcssBar(int _value) { if (progressBarScan.InvokeRequired) { while (progressBarScan.IsHandleCreated == false) { if (progressBarScan.Disposing || progressBarScan.IsDisposed) return; } SetProcssBarCallback d = new SetProcssBarCallback(SetProcssBar); progressBarScan.Invoke(d, new object[] { _value }); } else { progressBarScan.Value = _value; } }

//============================== var op = new ScanOperation(options); scanController.PageStart += (sender, args) => { op.NextPage(args.PageNumber); SetProcssBar(10); }; scanController.ScanEnd += (sender, args) => { op.Completed(); if (args.Error != null) { MessageBox.Show(args.Error.ToString()); } SetProcssBar(100); };

800903 avatar Apr 30 '24 09:04 800903