TryGetProgressRecord() public method

public TryGetProgressRecord ( Microsoft.WindowsAzure.Commands.Sync.ProgressRecord &record ) : bool
record Microsoft.WindowsAzure.Commands.Sync.ProgressRecord
return bool
        public void Update()
        {
            ProgressRecord progressRecord;

            if (progressStatus.TryGetProgressRecord(out progressRecord))
            {
                this.progressAction(progressRecord);
            }
        }
Ejemplo n.º 2
0
        private void InitilizeProgressTimer()
        {
            stopWatch.Start();
            bool throwing = false;

            try
            {
                progressTimer = new Timer
                {
                    AutoReset = false,
                    Interval  = progressInterval.TotalMilliseconds
                };
                progressTimerOnElapsed = (sender, args) =>
                {
                    ProgressRecord pr;
                    if (progressStatus.TryGetProgressRecord(out pr))
                    {
                        this.progress(pr);
                    }
                    progressTimer.Enabled = true;
                };
                progressTimer.Elapsed += progressTimerOnElapsed;
                progressTimer.Enabled  = true;
            }
            catch (Exception)
            {
                throwing = true;
                throw;
            }
            finally
            {
                if (throwing && progressTimer != null)
                {
                    progressTimer.Elapsed -= progressTimerOnElapsed;
                    progressTimer.Enabled  = false;
                    progressTimer.Dispose();
                    progressTimer = null;
                }
            }
        }