private void PageScanningTestDialog_Loaded(object send, RoutedEventArgs e)
        {
            _twain = new Twain(new WpfWindowMessageHook(this));
            _twain.TransferImage += delegate(Object sender, TransferImageEventArgs args)
            {
                if (args.Image != null)
                {
                    image1.Source = Imaging.CreateBitmapSourceFromHBitmap(
                            new System.Drawing.Bitmap(args.Image).GetHbitmap(),
                            IntPtr.Zero,
                            Int32Rect.Empty,
                            BitmapSizeOptions.FromEmptyOptions());
                }
            };
            _twain.ScanningComplete += delegate
            {
                IsEnabled = true;
            };

            var sourceList = _twain.SourceNames;
            ManualSource.ItemsSource = sourceList;

            if (sourceList != null && sourceList.Count > 0)
            {
                ManualSource.SelectedItem = sourceList[0];
            }
        }
 private void DocumentScanningPage_Loaded(object o, RoutedEventArgs e)
 {
     this.m_ImageList = new List<Image>();
     this.m_Twain = new Twain(new WpfWindowMessageHook(Window.GetWindow(this)));
     this.m_Twain.TransferImage += new EventHandler<TransferImageEventArgs>(Twain_TransferImage);
     this.m_Twain.ScanningComplete += new EventHandler<ScanningCompleteEventArgs>(Twain_ScanningComplete);
     this.ButtonNext.Focus();
 }