/// <summary> /// This is our main loop where we issue commands to the TWAIN /// object on behalf of the caller. This function runs in its /// own thread... /// </summary> private void TwainLocalOnTwainThread ( object a_objectParameters ) { TwainLocalOnTwain twainlocalontwain; TwainLocalOnTwainParameters twainlocalontwainparameters = (TwainLocalOnTwainParameters)a_objectParameters; // Create our object... twainlocalontwain = new TwainLocalOnTwain ( twainlocalontwainparameters.m_szWriteFolder, twainlocalontwainparameters.m_szImagesFolder, twainlocalontwainparameters.m_szIpc, twainlocalontwainparameters.m_iPid, twainlocalontwainparameters.m_runinuithreaddelegate, twainlocalontwainparameters.m_formtwain, twainlocalontwainparameters.m_intptrHwnd ); // Run our object... twainlocalontwain.Run(); // We're done... Invoke(new MethodInvoker(delegate() { CloseFormTwain(); })); }
public FormTwain ( string a_szWriteFolder, string a_szImagesFolder, string a_szIpc, int a_iPid ) { TwainLocalOnTwainParameters twainlocalontwainparameters; // Init stuff (though we'll never show this form)... InitializeComponent(); // Our parameters... twainlocalontwainparameters = new TwainLocalOnTwainParameters ( a_szWriteFolder, a_szImagesFolder, a_szIpc, a_iPid, RunInUiThread, this, this.Handle ); // The pain continues, we need to run the next bit in a thread // so that we don't block our window... m_threadTwainLocalOnTwain = new Thread(new ParameterizedThreadStart(TwainLocalOnTwainThread)); m_threadTwainLocalOnTwain.Start(twainlocalontwainparameters); }