Skip to content

Commit 9d9c15d

Browse files
committed
Update dependencies (#954)
1 parent 4f49fc1 commit 9d9c15d

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

Daybreak/Daybreak.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.4" />
6363
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.4" />
6464
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.4" />
65-
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3179.45" />
65+
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3240.44" />
6666
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
6767
<PackageReference Include="NAudio" Version="2.2.1" />
6868
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

Daybreak/Views/MetricsView.xaml.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public MetricsView(
4949

5050
private void UserControl_Loaded(object sender, RoutedEventArgs e)
5151
{
52-
this.Metrics.AddRange(this.metricsService.GetMetrics().Select(s => new MetricSetViewModel { Instrument = s.Instrument, AggregationType = s.AggregationType, Metrics = new ObservableCollection<Metric>(s.Metrics ?? new List<Metric>()) }).ToList());
52+
this.Metrics.AddRange([.. this.metricsService.GetMetrics().Select(s => new MetricSetViewModel { Instrument = s.Instrument, AggregationType = s.AggregationType, Metrics = [.. s.Metrics ?? []] })]);
5353
this.metricsService.SetRecorded += this.MetricsService_SetRecorded;
5454
this.metricsService.MetricRecorded += this.MetricsService_MetricRecorded;
5555
}
@@ -71,7 +71,7 @@ private void MetricsService_SetRecorded(object? sender, MetricSet e)
7171
{
7272
this.Dispatcher.Invoke(() =>
7373
{
74-
this.Metrics.Add(new MetricSetViewModel { AggregationType = e.AggregationType, Instrument = e.Instrument, Metrics = new ObservableCollection<Metric>(e.Metrics ?? new List<Metric>()) });
74+
this.Metrics.Add(new MetricSetViewModel { AggregationType = e.AggregationType, Instrument = e.Instrument, Metrics = [.. e.Metrics ?? []] });
7575
});
7676
}
7777

@@ -114,8 +114,8 @@ metricSet.Metrics is null ||
114114
}
115115

116116
cartesianChart.DrawMargin = new LiveChartsCore.Measure.Margin(30);
117-
cartesianChart.XAxes = new Axis[]
118-
{
117+
cartesianChart.XAxes =
118+
[
119119
new Axis
120120
{
121121
Name = "Time",
@@ -133,10 +133,10 @@ metricSet.Metrics is null ||
133133
TicksPaint = this.transparentPaint,
134134
ZeroPaint = this.transparentPaint,
135135
}
136-
};
136+
];
137137

138-
cartesianChart.YAxes = new Axis[]
139-
{
138+
cartesianChart.YAxes =
139+
[
140140
new Axis
141141
{
142142
Name = metricSet.Instrument.Unit,
@@ -150,18 +150,18 @@ metricSet.Metrics is null ||
150150
TicksPaint = this.transparentPaint,
151151
ZeroPaint = this.transparentPaint,
152152
}
153-
};
153+
];
154154

155-
cartesianChart.Series = new ISeries[]
156-
{
155+
cartesianChart.Series =
156+
[
157157
new LineSeries<Metric>
158158
{
159159
Values = metricSet.AggregationType switch
160160
{
161-
AggregationTypes.NoAggregate => this.PlotNoAggregation(metricSet.Metrics),
162-
AggregationTypes.P95 => this.PlotPercentageAggregation(metricSet.Metrics, 0.95),
163-
AggregationTypes.P98 => this.PlotPercentageAggregation(metricSet.Metrics, 0.98),
164-
AggregationTypes.P99 => this.PlotPercentageAggregation(metricSet.Metrics, 0.99),
161+
AggregationTypes.NoAggregate => PlotNoAggregation(metricSet.Metrics),
162+
AggregationTypes.P95 => PlotPercentageAggregation(metricSet.Metrics, 0.95),
163+
AggregationTypes.P98 => PlotPercentageAggregation(metricSet.Metrics, 0.98),
164+
AggregationTypes.P99 => PlotPercentageAggregation(metricSet.Metrics, 0.99),
165165
_ => throw new InvalidOperationException("Unable to plot metrics. Unknown aggregation")
166166
},
167167
Fill = default,
@@ -173,7 +173,7 @@ metricSet.Metrics is null ||
173173
GeometrySize = default,
174174
Name = string.Empty
175175
}
176-
};
176+
];
177177

178178
cartesianChart.Title = new LabelVisual
179179
{
@@ -183,23 +183,23 @@ metricSet.Metrics is null ||
183183
};
184184
}
185185

186-
private IEnumerable<Metric> PlotNoAggregation(IEnumerable<Metric> dataSet)
186+
private void InterceptScroll(object sender, System.Windows.Input.MouseWheelEventArgs e)
187+
{
188+
e.Handled = true;
189+
}
190+
191+
private static ObservableCollection<Metric> PlotNoAggregation(ObservableCollection<Metric> dataSet)
187192
{
188193
return dataSet;
189194
}
190195

191-
private IEnumerable<Metric> PlotPercentageAggregation(IEnumerable<Metric> dataSet, double percentage)
196+
private static IReadOnlyCollection<Metric> PlotPercentageAggregation(ObservableCollection<Metric> dataSet, double percentage)
192197
{
193198
var dataSetArray = dataSet.ToArray();
194199
var valuesToTake = Math.Round(dataSetArray.Length * percentage).ToInt();
195200
var orderedByValueDataSet = dataSetArray.OrderBy(s => s.Measurement);
196201
var finalDataSet = orderedByValueDataSet.Take(valuesToTake).OrderBy(s => s.Timestamp);
197202

198-
return finalDataSet;
199-
}
200-
201-
private void InterceptScroll(object sender, System.Windows.Input.MouseWheelEventArgs e)
202-
{
203-
e.Handled = true;
203+
return [.. finalDataSet];
204204
}
205205
}

0 commit comments

Comments
 (0)