예제 #1
0
        public void RunWorkerAsync(object argument)
        {
            if (isRunning)
            {
                throw new InvalidOperationException("SR.GetString(SR.BackgroundWorker_WorkerAlreadyRunning");
            }

            isRunning           = true;
            cancellationPending = false;

            asyncOperation = AsyncOperationManager.CreateOperation(null);
            threadStart.BeginInvoke(argument, null, null);
        }
예제 #2
0
        /// <summary>
        /// Queries the specified server on a separate thread.
        /// </summary>
        /// <returns>true if the SNTPClient wasn't busy, otherwise false.</returns>
        public bool QueryServerAsync()
        {
            bool result = false;

            if (!IsBusy)
            {
                IsBusy         = true;
                asyncOperation = AsyncOperationManager.CreateOperation(null);
                ThreadStart.BeginInvoke(null, null);
                result = true;
            }
            return(result);
        }