예제 #1
0
 internal void OnProgressReport(object sender, ProgressReportEventArgs e)
 {
     if (this.ProgressReport != null)
     {
         this.ProgressReport(sender, e);
     }
 }
 // Token: 0x06000020 RID: 32 RVA: 0x00002A60 File Offset: 0x00000C60
 public override void ReportProgress(ProgressReportEventArgs e)
 {
     base.ReportProgress(e);
     if (!this.inProgress)
     {
         this.topProgressBar = Console.CursorTop;
         this.inProgress     = true;
     }
     if (e.ProgressRecord.RecordType == ProgressRecordType.Processing)
     {
         if (base.IsNewActivity)
         {
             string activity = e.ProgressRecord.Activity;
             this.ShowWorkUnit(activity);
         }
         if (e.ProgressRecord.Activity.CompareTo(" ") != 0)
         {
             this.ShowProgress(e.ProgressRecord.PercentComplete);
             return;
         }
     }
     else
     {
         this.CompleteProgress();
     }
 }
예제 #3
0
        private void UpdateProgressObjectInfo(object sender, ProgressReportEventArgs e)
        {
            string objName = e.Current.GetNameForType(e.Current.Type);

            string template = "Processing object ({0} of {1}): [{2}] " + objName;

            lblObjectInfo.Text = String.Format(template, e.TotalCount, e.Total, e.Current.Type);
        }
예제 #4
0
 private static void Scripter_DiscoveryProgress(object sender, ProgressReportEventArgs e)
 {
     if (e.Current.Type is UserDefinedDataType)
     {
         TraceService.Info("Discovery skipped UserDefinedDataType");
         e.Current.Value = string.Empty;
     }
 }
예제 #5
0
 private void ScriptTable_DiscoveryProgressReport(System.Object sender,
                                                  ProgressReportEventArgs e)
 {
     sbrStatus.Text = string.Format(
         System.Globalization.CultureInfo.InvariantCulture,
         Properties.Resources.Discovering, e.TotalCount, e.Total);
     sbrStatus.Refresh();
 }
예제 #6
0
            /// <summary>Fires the progress update event</summary>
            /// <param name="eventArguments">Progress to report (ranging from 0.0 to 1.0)</param>
            /// <remarks>
            ///   Informs the observers of this operation about the achieved progress.
            ///   Allows for classes derived from the Operation class to easily provide
            ///   a custom event arguments class that has been derived from the
            ///   operation's ProgressUpdateEventArgs class.
            /// </remarks>
            protected virtual void OnAsyncProgressChanged(ProgressReportEventArgs eventArguments)
            {
                EventHandler <ProgressReportEventArgs> copy = AsyncProgressChanged;

                if (copy != null)
                {
                    copy(this, eventArguments);
                }
            }
예제 #7
0
        protected virtual void RaiseProgressChangedEvent(ProgressReportEventArgs e)
        {
            var handler = ProgressChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #8
0
 protected void ScriptingProgressEventHandler(object sender, ProgressReportEventArgs e)
 {
     if (e.Current.XPathExpression.Length > 2)
     {
         this.Invoke(new MethodInvoker(delegate
         {
             lblProgress.Text = e.Current.XPathExpression[2].GetAttributeFromFilter("Name") + Environment.NewLine;
         }));
     }
 }
예제 #9
0
        private void UpdateProgressBar(object sender, ProgressReportEventArgs e)
        {
            pb.Maximum = e.Total;
            pb.Value   = e.TotalCount;

            if (TaskbarManager.IsPlatformSupported)
            {
                TaskbarManager.Instance.SetProgressValue(e.TotalCount, e.Total, this.Handle);
            }
        }
예제 #10
0
 protected void ScriptingProgressEventHandler(object sender, ProgressReportEventArgs e)
 {
     if (e.Current.XPathExpression.Length > 2)
     {
         this.Invoke(new MethodInvoker(delegate
         {
            lblProgress.Text = e.Current.XPathExpression[2].GetAttributeFromFilter("Name") + Environment.NewLine;
         }));
     }
 }
예제 #11
0
            /// <summary>
            ///   Called by NMock to verfiy the ProgressUpdateEventArgs match the expected value
            /// </summary>
            /// <param name="actualAsObject">Actual value to compare to the expected value</param>
            /// <returns>
            ///   True if the actual value matches the expected value; otherwise false
            /// </returns>
            public override bool Matches(object actualAsObject)
            {
                ProgressReportEventArgs actual = (actualAsObject as ProgressReportEventArgs);

                if (actual == null)
                {
                    return(false);
                }

                return(actual.Progress == this.expected.Progress);
            }
예제 #12
0
        protected void DiscoveryProgress_Handler
            (object sender, ProgressReportEventArgs e
            )
        {
            Console.WriteLine(e.Total + "/" + e.TotalCount + " " + e.Current.Value);

            this.Invoke(new MethodInvoker(delegate
            {
                this.lblStatus.Text = e.Total + "/" + e.TotalCount + " " +
                                      e.Current.Value;
            }));
        }
예제 #13
0
        /// <summary>Called when currently executing operation makes progress</summary>
        /// <param name="sender">Operation that has achieved progress</param>
        /// <param name="arguments">Not used</param>
        private void asyncOperationProgressChanged(
            object sender, ProgressReportEventArgs arguments
            )
        {
            // Determine the completed weight of the currently executing operation
            float operationWeight          = this.children[this.currentOperationIndex].Weight;
            float operationCompletedWeight = arguments.Progress * operationWeight;

            // Build the total normalized amount of progress for the queue
            float progress = (this.completedWeight + operationCompletedWeight) / this.totalWeight;

            // Done, we can send the actual progress to any event subscribers
            OnAsyncProgressChanged(progress);
        }
예제 #14
0
 // Token: 0x06000017 RID: 23 RVA: 0x000028C8 File Offset: 0x00000AC8
 public override void ReportProgress(ProgressReportEventArgs e)
 {
     if (e.Command.ToString() != this.currentCommandText)
     {
         this.currentCommandText = e.Command.ToString();
     }
     if (e.ProgressRecord.Activity != this.currentActivityText)
     {
         this.currentActivityText = e.ProgressRecord.Activity;
         this.isNewActivity       = true;
         return;
     }
     this.isNewActivity = false;
 }
예제 #15
0
        private void _scripter_Progress(object sender, ProgressReportEventArgs e)
        {
            if (_scripter == null)
            {
                return;
            }

            lblGenTaskInfo.Invoke(new ProgressReportEventHandler(UpdateProgressObjectInfo), new object[2] {
                sender, e
            });
            pb.Invoke(new ProgressReportEventHandler(UpdateProgressBar), new object[2] {
                sender, e
            });
        }
예제 #16
0
        public static void RegisterPowerShellToActivity(PowerShell powerShell, CmdletActivity activity, IEnumerable pipelineInput, out List <PSObject> psDataCollection, bool isGetListAsync)
        {
            psDataCollection = null;
            int managedThreadId = Thread.CurrentThread.ManagedThreadId;

            if (AsyncServiceManager.workerThreads.Contains(managedThreadId))
            {
                AsyncServiceManager.WorkItem workItem = (AsyncServiceManager.WorkItem)AsyncServiceManager.workerThreads[managedThreadId];
                lock (workItem)
                {
                    workItem.ProgressCalculator.SetPipelineInput(pipelineInput);
                    workItem.PowerShell = powerShell;
                    if (isGetListAsync && workItem.AsyncGetListContext.PsObjectCollection == null)
                    {
                        psDataCollection = new List <PSObject>(DDIHelper.GetListDefaultResultSize * 2);
                        workItem.AsyncGetListContext.PsObjectCollection = psDataCollection;
                    }
                }
                if (powerShell != null)
                {
                    powerShell.Streams.Progress.DataAdded += delegate(object sender, DataAddedEventArgs e)
                    {
                        ProgressRecord progressRecord = ((PSDataCollection <ProgressRecord>)sender)[e.Index];
                        if (isGetListAsync)
                        {
                            AsyncServiceManager.OnProgress(workItem, progressRecord);
                            return;
                        }
                        List <ErrorRecord> list = new List <ErrorRecord>();
                        if (AsyncServiceManager.IsCurrentWorkBulkEdit())
                        {
                            Collection <ErrorRecord> collection = powerShell.Streams.Error.ReadAll();
                            foreach (ErrorRecord errorRecord in collection)
                            {
                                list.Add(new ErrorRecord(errorRecord));
                            }
                        }
                        string status = (progressRecord.RecordType != ProgressRecordType.Completed) ? progressRecord.StatusDescription : string.Empty;
                        ProgressReportEventArgs progressReportEventArgs = new ProgressReportEventArgs(list, progressRecord.PercentComplete, status);
                        DDIHelper.Trace("Async Progress Id: {0},  ProgressReportEventArgs: {1}", new object[]
                        {
                            workItem.Id,
                            progressReportEventArgs
                        });
                        activity.OnPSProgressReport(progressReportEventArgs);
                    };
                }
            }
        }
예제 #17
0
        private void dWalk_DiscoveryProgress(object sender, ProgressReportEventArgs e)
        {
            //while (_pauseScripting)
            //{
            //  Thread.Sleep(10);
            //}

            //if (_cancelRequested)
            //  throw new CancelledByUserException();

            if (_walkingDependencies != null)
            {
                _walkingDependencies(this, e);
            }
        }
예제 #18
0
        /// <summary>Called when the tracked transaction's progress updates</summary>
        /// <param name="sender">Transaction whose progress has been updated</param>
        /// <param name="arguments">
        ///   Contains the new progress achieved by the transaction
        /// </param>
        private void asyncProgressChanged(object sender, ProgressReportEventArgs arguments)
        {
            // See if this is the first progress update we're receiving. If yes, we need to
            // switch the progress bar from marquee into its normal mode!
            int haveProgress = Interlocked.Exchange(ref this.areProgressUpdatesIncoming, 1);

            if (haveProgress == 0)
            {
                this.progressBar.BeginInvoke(
                    (MethodInvoker) delegate() { this.progressBar.Style = ProgressBarStyle.Blocks; }
                    );
            }

            // Send the new progress to the progress bar
            this.progressBar.AsyncSetValue(arguments.Progress);
        }
예제 #19
0
        private void scrp_ScriptingProgress(object sender, ProgressReportEventArgs e)
        {
            while (_pauseScripting)
            {
                Thread.Sleep(10);
            }

            if (_cancelRequested)
            {
                throw new CancelledByUserException();
            }

            if (_scriptingInProgress != null)
            {
                _scriptingInProgress(this, e);
            }
        }
 // Token: 0x0600002B RID: 43 RVA: 0x00002F64 File Offset: 0x00001164
 public override void ReportProgress(ProgressReportEventArgs e)
 {
     base.ReportProgress(e);
     if (e.ProgressRecord.RecordType == ProgressRecordType.Processing)
     {
         if (base.IsNewActivity)
         {
             string activity = e.ProgressRecord.Activity;
             Console.Write(activity);
             return;
         }
     }
     else
     {
         string arg = this.hasErrors ? Strings.ExecutionFailed : Strings.ExecutionCompleted;
         Console.WriteLine(" ... {0}", arg);
         this.hasErrors = false;
     }
 }
예제 #21
0
        private void RecordHelper_ProgressReport(object sender, ProgressReportEventArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new EventHandler <ProgressReportEventArgs>(RecordHelper_ProgressReport), sender, e);
            }
            else
            {
                if (this.isRecording && !e.IsRecording)
                {
                    // It is just stopped
                    FlashWindow.StopFlash(this.Handle);
                    if (chkPlayback.Checked && !isSkipPlaybackOnce)
                    {
                        playbackHelper.Play(this.lastFileName);
                    }

                    isSkipPlaybackOnce = false;
                    btnRecord.Text     = "Record";
                    isRecording        = false;
                    Output("Stop recording.");

                    var recordedFile = new RecordedFile(lastFileName, e.Seconds, ConvertSecondToString(e.Seconds));
                    AddNewRecordedFile(recordedFile);
                }
                else
                {
                    lblLength.Text = ConvertSecondToString(e.Seconds);
                }

                if (e.Exception != null)
                {
                    Output(e.Exception);
                }
            }
        }
예제 #22
0
 static void scripter_ScriptingProgress(object sender, ProgressReportEventArgs e)
 {
     Console.WriteLine(e.Current);
 }
예제 #23
0
 private static void Scripter_ScriptingProgress(object sender, ProgressReportEventArgs e)
 {
     TraceService.Info("---------" + e.Current.Type);
 }
예제 #24
0
 /// <summary>Initializes a new ProgressUpdateEventArgsMatcher </summary>
 /// <param name="expected">Expected progress update event arguments</param>
 public ProgressUpdateEventArgsMatcher(ProgressReportEventArgs expected)
 {
     this.expected = expected;
 }
예제 #25
0
 private static void DisplayProgress(object sender, ProgressReportEventArgs e)
 {
     Console.WriteLine("{0}%", e.Progress);
     Console.CursorTop -= 1;
 }
예제 #26
0
 /// <summary>
 ///   Called when the summed progressed of the tracked transaction has changed
 /// </summary>
 /// <param name="sender">Transaction whose progress has changed</param>
 /// <param name="arguments">Contains the progress achieved by the transaction</param>
 private void asyncProgressUpdated(
     object sender, ProgressReportEventArgs arguments
     )
 {
     AsyncSetValue(arguments.Progress);
 }
예제 #27
0
 private static void Converter_ProgressReport(object sender, ProgressReportEventArgs args)
 {
     Console.WriteLine(args.CurrentDataTime.ToString("yyy-MM-dd hh:mm:ss") + " " + args.ReadBytes / 1000000 + " MB " + args.Precentage.ToString("0.00") + "%");
 }
예제 #28
0
        void scripter_ScriptingProgress(object sender, ProgressReportEventArgs e)
        {
            //throw new NotImplementedException();

            // TODO: create a delegate and pass in a progresss handler from calling environment
        }
예제 #29
0
파일: Program.cs 프로젝트: dblock/sncore
 static void scripter_ScriptingProgress(object sender, ProgressReportEventArgs e)
 {
     Console.WriteLine(e.Current);
 }
예제 #30
0
파일: ScriptTable.cs 프로젝트: rcdosado/SMO
 private void ScriptTable_ScriptingProgressReport(System.Object sender,
     ProgressReportEventArgs e)
 {
     sbrStatus.Text = string.Format(
         System.Globalization.CultureInfo.InvariantCulture,
         Properties.Resources.Scripting,
         e.TotalCount, e.Total);
     sbrStatus.Refresh();
 }