We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public sealed class SymbolLoadStatus : INotifyPropertyChanged { private static readonly int TotalCount = Database.GetAllSymbolKeys().Count(); private string? displayText; private int processed; private DateTimeOffset? startTime; private DateTimeOffset? endTime; public event PropertyChangedEventHandler? PropertyChanged; public int Total => TotalCount; public TimeSpan? Elapsed => (this.EndTime ?? DateTimeOffset.Now) - this.startTime; public TimeSpan? Average => this.Elapsed / this.Processed; public string? DisplayText { get => this.displayText; private set { if (value == this.displayText) { return; } this.displayText = value; this.OnPropertyChanged(); } } public int Processed { get => this.processed; private set { if (value == this.processed) { return; } this.processed = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.Average)); } } public DateTimeOffset? StartTime { get => this.startTime; private set { if (value == this.startTime) { return; } this.startTime = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.Elapsed)); this.OnPropertyChanged(nameof(this.Average)); } } public DateTimeOffset? EndTime { get => this.endTime; private set { if (value == this.endTime) { return; } this.endTime = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.Elapsed)); this.OnPropertyChanged(nameof(this.Average)); } } public void Load(SymbolKey key) { if (this.startTime is null) { this.StartTime = DateTimeOffset.Now; } this.Processed++; this.DisplayText = $"Loading {this.processed} of {this.Total} in {this.Elapsed:mm\\:ss} average {this.Average?.TotalMilliseconds:F0} ms {key}"; } private void OnPropertyChanged([CallerMemberName] string? propertyName = null) { this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: