Call the Asynchronous Method of WCF and call the Asynchronous Method of WCF.
AsyncCallback aLoginCallback = delegate (IAsyncResult result) {var aSystemUser = WcfClient. instance. endSystemUser_Login (result); result. asyncWaitHandle. close (); if (string. isNullOrWhiteSpace (aSystemUser. userId) {ShowMessageBoxInNonMainThread ("Logon Failed: incorrect user name or password! "); Return;} CommonCache. currentUser = aSystemUser; // SynchronizationContext and SendOrPostCallback are introduced to solve the problem that controls created in the main thread cannot be accessed in non-main thread. SendOrPostCallback aSendOrPostCallback = delegate {Hide (); MainForm. instance. showDialog () ;}; SynchronizationContext. current. send (aSendOrPostCallback, null) ;}; var aParam = GetForm <SystemUserParameter> (); WcfClient. instance. beginSystemUser_Login (aParam, aLoginCallback, null );