Exemplo n.º 1
0
        /// <summary>
        /// Begins asynchronous progress display in the progress bar</summary>
        /// <param name="message">Message to display with progress meter</param>
        /// <param name="argument">Worker argument</param>
        /// <param name="workHandler">Background thread delegate</param>
        /// <param name="progressCompleteHandler">Event handler for work completion event</param>
        /// <param name="autoIncrement">Whether to auto increment the progress meter</param>
        public void RunProgressInStatusBarAsync(string message, object argument, DoWorkEventHandler workHandler, EventHandler <ProgressCompleteEventArgs> progressCompleteHandler, bool autoIncrement)
        {
            var statusItem = new ProgressViewModel()
            {
                Cancellable     = false,
                Description     = message,
                IsIndeterminate = autoIncrement
            };

            // Add the part to the status bar
            ComposablePart part = m_composer.AddPart(statusItem);

            statusItem.Tag = new StatusBarProgressContext(progressCompleteHandler, part);

            statusItem.RunWorkerThread(argument, workHandler);
            statusItem.RunWorkerCompleted += new EventHandler(statusItem_RunWorkerCompleted);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Begins progress display where client manually updates progress</summary>
        /// <param name="message">Message to display with progress meter</param>
        /// <param name="canCancel">Should the cancel button appear and be enabled?</param>
        /// <param name="argument">Worker argument</param>
        /// <param name="workHandler">Background thread delegate</param>
        /// <param name="autoIncrement">Whether to auto increment the progress meter</param>
        /// <returns>True if the thread was cancelled</returns>
        public bool RunProgressDialog(string message, bool canCancel, object argument, DoWorkEventHandler workHandler, bool autoIncrement)
        {
            var vm = new ProgressViewModel()
            {
                Cancellable     = canCancel,
                Description     = message,
                IsIndeterminate = autoIncrement
            };

            vm.RunWorkerThread(argument, workHandler);

            DialogUtils.ShowDialogWithViewModel <ProgressDialog>(vm);

            ProgressResult = vm.Result;
            ProgressError  = vm.Error;

            return(vm.Cancelled);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Begins progress display where client manually updates progress</summary>
        /// <param name="message">Message to display with progress meter</param>
        /// <param name="canCancel">Should the cancel button appear and be enabled?</param>
        /// <param name="argument">Worker argument</param>
        /// <param name="workHandler">Background thread delegate</param>
        /// <param name="autoIncrement">Whether to auto increment the progress meter</param>
        /// <returns>True if the thread was cancelled</returns>
        public bool RunProgressDialog(string message, bool canCancel, object argument, DoWorkEventHandler workHandler, bool autoIncrement)
        {
            var vm = new ProgressViewModel()
            {
                Cancellable     = canCancel,
                Description     = message,
                IsIndeterminate = autoIncrement
            };

            vm.RunWorkerThread(argument, workHandler);

            ProgressDialog progressDialog = new ProgressDialog();

            progressDialog.DataContext = vm;
            progressDialog.Owner       = DialogUtil.GetActiveWindow();
            progressDialog.ShowDialog();

            ProgressResult = vm.Result;
            ProgressError  = vm.Error;

            return(vm.Cancelled);
        }