Esempio n. 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();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AxAsyncProgress"/> class.
        /// </summary>
        public AsyncDialogForm(string formCaption, IExecutorService executorService,
                               int minimum, int maximum,
                               AsyncWaitCallback callback,
                               AsyncWaitCallback finishedCallback,
                               AsyncWaitCallback abortCallback)
        {
            InitializeComponent();
            SetTagProperty();
            this.ResolveResources();
            _elapsedTimer         = AsyncProgressTimerFactory.Create();
            _executorService      = executorService;
            _actualCallback       = new WaitCallback(this.ExecAsync);
            _updateStatus         = new UpdateAsyncStatusHandler(this.UpdateStatus);
            _updateStatusProgress = new UpdateAsyncStatusProgressHandler(this.UpdateStatusProgress);
            _enableButton         = new EnableButtonHandler(this.EnableOKButton);
            this.InitializeProgress(minimum, maximum);

            btnCancel.Enabled = (_executorService != null);
            if (_executorService != null)
            {
                IExecutorService2 executor2 = _executorService as IExecutorService2;
                if (executor2 != null)
                {
                    executor2.Reset();
                }
            }

            this.Text      = formCaption;
            lblStatus.Text = formCaption;
            this.Initialize(callback, finishedCallback, abortCallback, this);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
 internal AsyncTaskThreadExecutor(IExecutorService executorService, int queueCapacity, bool checkItemCount, string threadSuffix)
     : base(executorService)
 {
     _executorService2  = executorService as IExecutorService2;
     _checkItemCount    = checkItemCount;
     this.QueueCapacity = queueCapacity;
     this.Initialize(threadSuffix);
 }
        /// <summary>
        /// Initializes the user control.
        /// </summary>
        /// <param name="callback">The callback.</param>
        /// <param name="finishedCallback">The finished callback.</param>
        /// <param name="abortCallback">The abort callback.</param>
        /// <param name="ownerWindow">The owner form.</param>
        /// <param name="parentForm">The parent form.</param>
        public void Initialize(string formCaption, IExecutorService executorService,
                               int minimum, int maximum)
        {
            _executorService = executorService;
            this.InitializeProgress(minimum, maximum);
            lblStatus.Text = "Loading...";

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