private void UpdateProgressBar(object sender, SvnProgressEventArgs e) { if (e.TotalProgress != -1) { metroProgressBar1.Maximum = (int)e.TotalProgress; } }
static void ProgressWork(SvnProgressEventArgs e, ProgressData data, IProgressMonitor monitor) { if (monitor == null) { return; } int currentProgress = (int)e.Progress; if (currentProgress == 0) { return; } int totalProgress = (int)e.TotalProgress; if (totalProgress != -1 && currentProgress >= totalProgress) { data.LogTimer.Close(); return; } data.Bytes = currentProgress; if (data.LogTimer.Enabled) { return; } data.LogTimer.Interval = 1000; data.LogTimer.Elapsed += delegate(object sender, ElapsedEventArgs eea) { data.Seconds += 1; monitor.Log.WriteLine("{0} bytes in {1} seconds", data.Bytes, data.Seconds); }; data.LogTimer.Start(); }
void client_Progress(object sender, SvnProgressEventArgs e) { // Convert the total progress into a value on the progress bar // The event args has two values - Progress and TotalProgres. // Progress is the numerator and TotalProgress is the denominator if (e.Progress == e.TotalProgress) { // This means that we have completed the operation. this.client.Progress -= new EventHandler<SvnProgressEventArgs>(client_Progress); this.Close(); return; } double value = (e.Progress / (double)(e.TotalProgress)); value *= 100; // Count of the latest number of bytes received. this.last_count = e.Progress; UpdateProgressBarDelegate updatedel = new UpdateProgressBarDelegate(this._progress_bar.SetValue); Dispatcher.Invoke( updatedel, System.Windows.Threading.DispatcherPriority.Background, new object[] { ProgressBar.ValueProperty, value } ); }
void client_Progress(object sender, SvnProgressEventArgs e) { // Convert the total progress into a value on the progress bar // The event args has two values - Progress and TotalProgres. // Progress is the numerator and TotalProgress is the denominator if (e.Progress == e.TotalProgress) { // This means that we have completed the operation. this.client.Progress -= new EventHandler <SvnProgressEventArgs>(client_Progress); this.Close(); return; } double value = (e.Progress / (double)(e.TotalProgress)); value *= 100; // Count of the latest number of bytes received. this.last_count = e.Progress; UpdateProgressBarDelegate updatedel = new UpdateProgressBarDelegate(this._progress_bar.SetValue); Dispatcher.Invoke( updatedel, System.Windows.Threading.DispatcherPriority.Background, new object[] { ProgressBar.ValueProperty, value } ); }
private static void Client_Progress(object sender, SvnProgressEventArgs e) { Console.WriteLine("Complete {0} {1}", e.Progress / 1024, e.TotalProgress); try { //MetroFramework.Controls.MetroTextBox textBox = Application.OpenForms["SyncWithSvnForm"].Controls["metroLabel6"] as MetroFramework.Controls.MetroTextBox; SyncWithSvnForm.metroLabel6.BeginInvoke(new Action(() => SyncWithSvnForm.metroLabel6.Text = (e.Progress / 1024).ToString("0.00") + " KB")); } catch { } }
static void _libsvnsharp_progress_func(long progress, long total, IntPtr baton, IntPtr pool) { var client = AprBaton <SvnClientContext> .Get(baton); SvnProgressEventArgs ea = new SvnProgressEventArgs(progress, total); try { client.HandleClientProgress(ea); } finally { ea.Detach(false); } }
static void ProgressWork(SvnProgressEventArgs e, ProgressData data, ProgressMonitor monitor) { if (monitor == null) { return; } long currentProgress = e.Progress; if (currentProgress <= data.KBytes) { if (data.SavedProgress < data.KBytes) { data.SavedProgress += data.KBytes; } return; } long totalProgress = e.TotalProgress; if (totalProgress != -1 && currentProgress >= totalProgress) { data.LogTimer.Dispose(); return; } data.Remainder += currentProgress % 1024; if (data.Remainder >= 1024) { data.SavedProgress += data.Remainder / 1024; data.Remainder = data.Remainder % 1024; } data.KBytes = data.SavedProgress + currentProgress / 1024; if (data.LogTimer.Enabled) { return; } data.LogTimer.Interval = 1000; data.LogTimer.Elapsed += delegate { data.Seconds += 1; Runtime.RunInMainThread(() => { monitor.Log.WriteLine(GettextCatalog.GetString("Transferred {0} in {1} seconds."), BytesToSize(data.KBytes), data.Seconds); }); }; data.LogTimer.Start(); }
/// <summary> /// 处理过程,进度,,比如传送的字节数等显示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SC_Progress(object sender, SvnProgressEventArgs e) { if(e.Progress == 0) { prog = ""; } else { if (e.TotalProgress == - 1) { { if(e.Progress > 1024) { prog = ((float)(e.Progress) / 1024F).ToString("0.00") + "KB"; } else { prog = ((float)(e.Progress)).ToString("0.00") + "Bytes"; } } } else { { prog = (e.Progress).ToString("0.00"); } } } ShowInfo(); }
/// <summary> /// Callback from the SVN Progress Event that allows /// us to track the total progress made for the commit. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void client_Progress(object sender, SvnProgressEventArgs e) { if (e.Progress == e.TotalProgress) { this.cleanup_event_handlers(); this.Close(); return; } double value = (e.Progress / (double)(e.TotalProgress)); value *= 100; this.last_count = e.Progress; // Invoke the update to the ProgressBar on // the UI Thread UpdateProgressBarDelegate updatedel = new UpdateProgressBarDelegate(this.commit_progress_bar.SetValue); Dispatcher.Invoke( updatedel, System.Windows.Threading.DispatcherPriority.Background, new object[] { ProgressBar.ValueProperty, value } ); }
public void OnClientProgress(object sender, SvnProgressEventArgs e) { ProgressState state; long received; lock (_instanceLock) { if (_progressCalc.TryGetValue(e.TotalProgress, out state)) { if (e.Progress < state.LastCount) state.LastCount = 0; received = e.Progress - state.LastCount; if (e.TotalProgress == e.Progress) _progressCalc.Remove(e.TotalProgress); else state.LastCount = e.Progress; } else { state = new ProgressState(); state.LastCount = e.Progress; _progressCalc.Add(e.TotalProgress, state); received = e.Progress; } } _bytesReceived += received; TimeSpan ts = DateTime.UtcNow - _start; int totalSeconds = (int)ts.TotalSeconds; if (totalSeconds < 0) return; // Clear all buckets of previous seconds where nothing was received while (_curBuck < totalSeconds) { _curBuck++; int n = _curBuck % _bucketCount; _buckets[n] = 0; } // Add the amount of this second to the right bucket _buckets[_curBuck % _bucketCount] += received; int avg = -1; int calcBuckets; if (_curBuck < 3) calcBuckets = 0; else calcBuckets = Math.Min(5, _curBuck - 1); if (calcBuckets > 0) { long tot = 0; for (int n = _curBuck - 1; n > (_curBuck - calcBuckets - 1); n--) { tot += _buckets[n % _bucketCount]; } avg = (int)(tot / (long)calcBuckets); } Enqueue(delegate() { string text = string.Format("{0} transferred", SizeStr(_bytesReceived)); if (avg > 0) text += string.Format(" at {0}/s.", SizeStr(avg)); else if (totalSeconds >= 1) text += string.Format(" in {0} seconds.", totalSeconds); else text += "."; progressLabel.Text = text; }); }
static void ProgressWork (SvnProgressEventArgs e, ProgressData data, IProgressMonitor monitor) { if (monitor == null) return; long currentProgress = e.Progress; if (currentProgress <= data.KBytes) { if (data.SavedProgress < data.KBytes) { data.SavedProgress += data.KBytes; } return; } long totalProgress = e.TotalProgress; if (totalProgress != -1 && currentProgress >= totalProgress) { data.LogTimer.Dispose (); return; } data.Remainder += currentProgress % 1024; if (data.Remainder >= 1024) { data.SavedProgress += data.Remainder / 1024; data.Remainder = data.Remainder % 1024; } data.KBytes = data.SavedProgress + currentProgress / 1024; if (data.LogTimer.Enabled) return; data.LogTimer.Interval = 1000; data.LogTimer.Elapsed += delegate { data.Seconds += 1; monitor.Log.WriteLine ("Transferred {0} in {1} seconds.", BytesToSize (data.KBytes), data.Seconds); }; data.LogTimer.Start (); }
static void ProgressWork (SvnProgressEventArgs e, ProgressData data, IProgressMonitor monitor) { if (monitor == null) return; int currentProgress = (int)e.Progress; if (currentProgress == 0) return; int totalProgress = (int)e.TotalProgress; if (totalProgress != -1 && currentProgress >= totalProgress) { data.LogTimer.Close (); return; } data.Bytes = currentProgress; if (data.LogTimer.Enabled) return; data.LogTimer.Interval = 1000; data.LogTimer.Elapsed += delegate { data.Seconds += 1; monitor.Log.WriteLine ("{0} bytes in {1} seconds", data.Bytes, data.Seconds); }; data.LogTimer.Start (); }
/// <summary> /// Callback from the SVN Progress Event that allows /// us to track the total progress made for the commit. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void client_Progress(object sender, SvnProgressEventArgs e) { if (e.Progress == e.TotalProgress) { this.cleanup_event_handlers(); this.Close(); return; } double value = (e.Progress / (double)(e.TotalProgress)); value *= 100; this.last_count = e.Progress; // Invoke the update to the ProgressBar on // the UI Thread UpdateProgressBarDelegate updatedel = new UpdateProgressBarDelegate(this.commit_progress_bar.SetValue); Dispatcher.Invoke( updatedel, System.Windows.Threading.DispatcherPriority.Background, new object[] { ProgressBar.ValueProperty, value } ); }
void ClientOnProgress(object sender, SvnProgressEventArgs e) { long ratio = e.Progress / e.TotalProgress; }
/// <summary> /// 处理过程,进度,,比如传送的字节数等显示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SC_Progress(object sender, SvnProgressEventArgs e) { if (e.Progress == 0) { prog = ""; } else { if (e.TotalProgress == -1) { if (e.Progress > 1024) { prog = ((float)(e.Progress) / 1024F).ToString("0.00") + "KB"; } else { prog = ((float)(e.Progress)).ToString("0.00") + "Bytes"; } } else { prog = (e.Progress).ToString("0.00"); } } ShowInfo(); }
private void svnProgress(object sender, SvnProgressEventArgs e) { }
private static void ClientProgress(object sender, SvnProgressEventArgs e) { Console.WriteLine("Complete {0} {1}", e.Progress, e.TotalProgress); }
private void OnProgress(object sender, SvnProgressEventArgs svnProgressEventArgs) { Logging.Log().Debug($"Progress: {svnProgressEventArgs.Progress} / {svnProgressEventArgs.TotalProgress}"); // this.syncLogger.Log(this.sync, $"Progress: {svnProgressEventArgs.Progress} / {svnProgressEventArgs.TotalProgress}"); }
public void OnClientProgress(object sender, SvnProgressEventArgs e) { ProgressState state; long received; lock (_instanceLock) { if (_progressCalc.TryGetValue(e.TotalProgress, out state)) { if (e.Progress < state.LastCount) { state.LastCount = 0; } received = e.Progress - state.LastCount; if (e.TotalProgress == e.Progress) { _progressCalc.Remove(e.TotalProgress); } else { state.LastCount = e.Progress; } } else { state = new ProgressState(); state.LastCount = e.Progress; _progressCalc.Add(e.TotalProgress, state); received = e.Progress; } } _bytesReceived += received; TimeSpan ts = DateTime.UtcNow - _start; int totalSeconds = (int)ts.TotalSeconds; if (totalSeconds < 0) { return; } // Clear all buckets of previous seconds where nothing was received while (_curBuck < totalSeconds) { _curBuck++; int n = _curBuck % _bucketCount; _buckets[n] = 0; } // Add the amount of this second to the right bucket _buckets[_curBuck % _bucketCount] += received; int avg = -1; int calcBuckets; if (_curBuck < 3) { calcBuckets = 0; } else { calcBuckets = Math.Min(5, _curBuck - 1); } if (calcBuckets > 0) { long tot = 0; for (int n = _curBuck - 1; n > (_curBuck - calcBuckets - 1); n--) { tot += _buckets[n % _bucketCount]; } avg = (int)(tot / (long)calcBuckets); } Enqueue(delegate() { string text = string.Format("{0} transferred", SizeStr(_bytesReceived)); if (avg > 0) { text += string.Format(" at {0}/s.", SizeStr(avg)); } else if (totalSeconds >= 1) { text += string.Format(" in {0} seconds.", totalSeconds); } else { text += "."; } progressLabel.Text = text; }); }