Exemple #1
0
 private Action Bind(Action <WiaState> action)
 {
     return(() =>
     {
         if (wiaState == null)
         {
             wiaState = InitWia();
         }
         action(wiaState);
     });
 }
 public void DoAsync(Action <WiaState> action)
 {
     form.BeginInvoke(new Action(() =>
     {
         if (wiaState == null)
         {
             wiaState = InitWia();
         }
         action(wiaState);
     }));
 }
Exemple #3
0
 public static Stream Transfer(WiaState wia, string format, bool showGui)
 {
     var imageFile = showGui
         ? (ImageFile)new CommonDialogClass().ShowTransfer(wia.Item, format)
         : (ImageFile)wia.Item?.Transfer(format);
     if (imageFile?.FileData == null)
     {
         return null;
     }
     return new MemoryStream((byte[])imageFile.FileData.get_BinaryData());
 }
        public void DoSync(Action <WiaState> action)
        {
            Exception error = null;

            form.Invoke(new Action(() =>
            {
                try
                {
                    if (wiaState == null)
                    {
                        wiaState = InitWia();
                    }
                    action(wiaState);
                }
                catch (Exception ex)
                {
                    error = ex;
                }
            }));
            if (error != null)
            {
                WiaApi.ThrowDeviceError(error);
            }
        }
Exemple #5
0
 public static Stream Transfer(WiaState wia, string format, bool showGui)
 {
     throw new NotImplementedException();
 }