Beispiel #1
0
        /// <summary>
        /// Initializes the specified callback.
        /// </summary>
        /// <param name="callback">The callback.</param>
        /// <param name="finishedCallback">The finished callback.</param>
        /// <param name="abortCallback">The abort callback.</param>
        /// <param name="ownerForm">The owner form.</param>
        /// <param name="parentForm">The parent form.</param>
        public void Initialize(IExecutorService executorService,
                               AsyncWaitCallback callback,
                               AsyncWaitCallback finishedCallback,
                               AsyncWaitCallback abortCallback,
                               Form ownerForm,
                               bool closeOnComplete)
        {
            _elapsedTimer.StopAndStart();
            _executorService  = executorService;
            _callback         = callback;
            _finishedCallback = finishedCallback;
            _abortCallback    = abortCallback;

            this.IsCancellable = (_executorService != null);
            if (_executorService != null)
            {
                IExecutorService2 executor2 = _executorService as IExecutorService2;
                if (executor2 != null)
                {
                    executor2.Reset();
                }
            }

            this.OwnerForm = ownerForm;
            //Log.LogFormatMessage += new LogFormatMessageHandler(Log_LogFormatMessage);
            this.CloseOnComplete = closeOnComplete;
            progbarValue.Start();
        }
Beispiel #2
0
        /// <summary>
        /// Initializes the specified callback.
        /// </summary>
        /// <param name="callback">The callback.</param>
        /// <param name="finishedCallback">The finished callback.</param>
        /// <param name="abortCallback">The abort callback.</param>
        /// <param name="ownerForm">The owner form.</param>
        /// <param name="parentForm">The parent form.</param>
        public void Initialize(IExecutorService executorService,
                               int minimum, int maximum,
                               AsyncWaitCallback callback,
                               AsyncWaitCallback finishedCallback,
                               AsyncWaitCallback abortCallback,
                               Form ownerForm,
                               bool closeOnComplete)
        {
            pbarStatus.Style = ProgressBarStyle.Marquee;
            _elapsedTimer.StopAndStart();

            _executorService  = executorService;
            _callback         = callback;
            _finishedCallback = finishedCallback;
            _abortCallback    = abortCallback;

            this.IsCancellable = (_executorService != null);
            if (_executorService != null)
            {
                IExecutorService2 executor2 = _executorService as IExecutorService2;
                if (executor2 != null)
                {
                    executor2.Reset();
                }
            }

            this.OwnerForm = ownerForm;
            this.UpdateStatusProgress(0, AsyncProgressMessages.GetMessage(-1));
            //Log.LogFormatMessage += new LogFormatMessageHandler(Log_LogFormatMessage);
            this.CloseOnComplete = closeOnComplete;
            this.InitializeProgress(minimum, maximum);
        }
 /// <summary>
 /// Initializes the specified callback.
 /// </summary>
 /// <param name="callback">The callback.</param>
 /// <param name="finishedCallback">The finished callback.</param>
 /// <param name="abortCallback">The abort callback.</param>
 /// <param name="ownerForm">The owner form.</param>
 /// <param name="parentForm">The parent form.</param>
 public void Initialize(AsyncWaitCallback callback,
                        AsyncWaitCallback finishedCallback,
                        AsyncWaitCallback abortCallback,
                        Form ownerForm)
 {
     _elapsedTimer.StopAndStart();
     _callback         = callback;
     _finishedCallback = finishedCallback;
     _abortCallback    = abortCallback;
     this.OwnerForm    = ownerForm;
     //Log.WriteToExternalLog += new WriteToExternalLogHandler(Log_WriteToExternalLog);
     Log.LogFormatMessage += new LogFormatMessageHandler(Log_LogFormatMessage);
 }