void UpdateForDocument() { ThreadAssist.AssertInMainThread(); var current_size = Document.FileSize; string size_str = null; if (original_size_string == null) { size_str = original_size_string = new Hyena.Query.FileSizeQueryValue(current_size).ToUserQuery(); original_size = current_size; } else if (current_size == original_size) { size_str = original_size_string; } else { string current_size_string = new Hyena.Query.FileSizeQueryValue(current_size).ToUserQuery(); if (current_size_string == original_size_string) { size_str = original_size_string; } else { // Translators: this string is used to show current/original file size, eg "2 MB (originally 1 MB)" size_str = String.Format(Catalog.GetString("{0} (originally {1})"), current_size_string, original_size_string); } } status_label.Text = String.Format("{0} \u2013 {1}", String.Format(Catalog.GetPluralString("{0} page", "{0} pages", Document.Count), Document.Count), size_str ); var title = Document.Title; var filename = Document.Filename; if (Document.HasUnsavedChanges) { filename = "*" + filename; } Window.Title = title == null ? filename : String.Format("{0} - {1}", filename, title); }
private void OnDownloaderProgress(HttpDownloader downloader) { FreezeUpdate(); lock (manager.SyncRoot) { double weight = 1.0 / (manager.TotalDownloadCount + finished_count); double progress = finished_count * weight; double speed = 0; int count = 0; foreach (var active_downloader in manager.ActiveDownloaders) { progress += weight * active_downloader.State.PercentComplete; speed = active_downloader.State.TransferRate; count++; } Progress = progress; var human_speed = new Hyena.Query.FileSizeQueryValue((long)Math.Round(speed)).ToUserQuery(); if (manager.PendingDownloadCount == 0) { Status = String.Format( Catalog.GetPluralString( "{0} download at {1}/s", "{0} downloads at {1}/s", count), count, human_speed ); } else { Status = String.Format( Catalog.GetPluralString( "{0} download at {1}/s ({2} pending)", "{0} downloads at {1}/s ({2} pending)", count), count, human_speed, manager.PendingDownloadCount ); } } ThawUpdate(true); }
private void OnDownloaderProgress (HttpDownloader downloader) { FreezeUpdate (); lock (manager.SyncRoot) { double weight = 1.0 / (manager.TotalDownloadCount + finished_count); double progress = finished_count * weight; double speed = 0; int count = 0; foreach (var active_downloader in manager.ActiveDownloaders) { progress += weight * active_downloader.State.PercentComplete; speed = active_downloader.State.TransferRate; count++; } Progress = progress; var human_speed = new Hyena.Query.FileSizeQueryValue ((long)Math.Round (speed)).ToUserQuery (); if (manager.PendingDownloadCount == 0) { Status = String.Format ( Catalog.GetPluralString ( "{0} download at {1}/s", "{0} downloads at {1}/s", count), count, human_speed ); } else { Status = String.Format ( Catalog.GetPluralString ( "{0} download at {1}/s ({2} pending)", "{0} downloads at {1}/s ({2} pending)", count), count, human_speed, manager.PendingDownloadCount ); } } ThawUpdate (true); }
private void AddFileSizeItem(long bytes) { Hyena.Query.FileSizeQueryValue value = new Hyena.Query.FileSizeQueryValue(bytes); AddItem(Catalog.GetString("File Size:"), String.Format("{0} ({1} {2})", value.ToUserQuery(), bytes, Catalog.GetString("bytes"))); }
private void AddFileSizeItem (long bytes) { Hyena.Query.FileSizeQueryValue value = new Hyena.Query.FileSizeQueryValue (bytes); AddItem (Catalog.GetString ("File Size:"), String.Format ("{0} ({1} {2})", value.ToUserQuery (), bytes, Catalog.GetString ("bytes"))); }
void UpdateForDocument () { ThreadAssist.AssertInMainThread (); var current_size = Document.FileSize; string size_str = null; if (original_size_string == null) { size_str = original_size_string = new Hyena.Query.FileSizeQueryValue (current_size).ToUserQuery (); original_size = current_size; } else if (current_size == original_size) { size_str = original_size_string; } else { string current_size_string = new Hyena.Query.FileSizeQueryValue (current_size).ToUserQuery (); if (current_size_string == original_size_string) { size_str = original_size_string; } else { // Translators: this string is used to show current/original file size, eg "2 MB (originally 1 MB)" size_str = String.Format (Catalog.GetString ("{0} (originally {1})"), current_size_string, original_size_string); } } status_label.Text = String.Format ("{0} \u2013 {1}", String.Format (Catalog.GetPluralString ("{0} page", "{0} pages", Document.Count), Document.Count), size_str ); var title = Document.Title; var filename = Document.Filename; if (Document.HasUnsavedChanges) { filename = "*" + filename; } Window.Title = title == null ? filename : String.Format ("{0} - {1}", filename, title); }