Skip to content

Commit

Permalink
Address SonarCloud comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davewalker5 committed Sep 23, 2023
1 parent 981d088 commit 88a1628
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System.Diagnostics.CodeAnalysis;

#nullable disable

namespace BaseStationReader.Data.Migrations
{
/// <inheritdoc />
[ExcludeFromCodeCoverage]
public partial class AircraftStatus : Migration
{
/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System.Diagnostics.CodeAnalysis;

#nullable disable

namespace BaseStationReader.Data.Migrations
{
/// <inheritdoc />
[ExcludeFromCodeCoverage]
public partial class MessageCount : Migration
{
/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// <auto-generated />
using System;
using System.Diagnostics.CodeAnalysis;
using BaseStationReader.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
Expand All @@ -10,6 +11,7 @@
namespace BaseStationReader.Data.Migrations
{
[DbContext(typeof(BaseStationReaderDbContext))]
[ExcludeFromCodeCoverage]
partial class BaseStationReaderDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
Expand Down
2 changes: 1 addition & 1 deletion src/BaseStationReader.Entities/Messages/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private void AppendField(StringBuilder builder, object? value)
/// <param name="value"></param>
private void AppendBooleanFiled(StringBuilder builder, bool value)
{
var append = value == true ? "1" : "0";
var append = value ? "1" : "0";
AppendField(builder, append);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/BaseStationReader.Simulator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace BaseStationReader.Simulator
{
internal class Program
internal static class Program
{
static void Main(string[] args)
{
Expand Down
3 changes: 3 additions & 0 deletions src/BaseStationReader.UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public MainWindowViewModel()
{
var dialogViewModel = new FiltersWindowViewModel(LiveViewFilters);
var result = await ShowFiltersDialog.Handle(dialogViewModel);
return result;
});

// Wire up the tracking options dialog
Expand All @@ -56,6 +57,7 @@ public MainWindowViewModel()
{
var dialogViewModel = new TrackingOptionsWindowViewModel(Settings!);
var result = await ShowTrackingOptionsDialog.Handle(dialogViewModel);
return result;
});

// Wire up the database search dialog
Expand All @@ -64,6 +66,7 @@ public MainWindowViewModel()
{
var dialogViewModel = new DatabaseSearchWindowViewModel(DatabaseSearchCriteria);
var result = await ShowDatabaseSearchDialog.Handle(dialogViewModel);
return result;
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/BaseStationReader.UI/Views/DatabaseSearchWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void OnFromDateChanged(object sender, DatePickerSelectedValueChangedEven
private void OnToDateChanged(object sender, DatePickerSelectedValueChangedEventArgs e)
{
ViewModel!.From = GetDateFromOffset(e.NewDate);
Debug.Print(ViewModel.From.ToString() ?? "");
Debug.Print(ViewModel.To.ToString() ?? "");
}

/// <summary>
Expand All @@ -105,7 +105,7 @@ private void OnToDateChanged(object sender, DatePickerSelectedValueChangedEventA
var day = offset.Value.Day;

// Create a new date from the extracted values
date = new DateTime(year, month, day);
date = new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Local);
}

return date;
Expand Down
11 changes: 10 additions & 1 deletion src/BaseStationReader.UI/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,16 @@ private async Task DoShowTrackingOptionsAsync(InteractionContext<TrackingOptions
// Check we have a dialog result i.e. user didn't cancel
if (result != null)
{
// TODO : Reconfigure the tracker
// Apply the settings
ViewModel!.Settings!.Host = result.Host;
ViewModel.Settings.Port = result.Port;
ViewModel.Settings.SocketReadTimeout = result.SocketReadTimeout;
ViewModel.Settings.TimeToRecent = result.TimeToRecent;
ViewModel.Settings.TimeToStale = result.TimeToStale;
ViewModel.Settings.TimeToRemoval = result.TimeToRemoval;
ViewModel.Settings.TimeToLock = result.TimeToLock;
ViewModel.Settings.RefreshInterval = result.RefreshInterval;
_timer.Interval = new TimeSpan(0, 0, 0, 0, result.RefreshInterval);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/BaseStationReader.UI/Views/TrackingOptionsWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@
<Label Grid.Row="1" Grid.Column="0" Margin="0 0 10 10" >Port:</Label>
<TextBox Grid.Row="1" Grid.Column="1" Name="Port" Margin="0 0 10 10" KeyUp="OnPortKeyUp"/>

<Label Grid.Row="2" Grid.Column="0" Margin="0 0 10 10" >Socket Read Timeout (s):</Label>
<Label Grid.Row="2" Grid.Column="0" Margin="0 0 10 10" >Socket Read Timeout (ms):</Label>
<TextBox Grid.Row="2" Grid.Column="1" Name="SocketReadTimeout" Margin="0 0 10 10" KeyUp="OnSocketReadTimeoutKeyUp"/>

<Label Grid.Row="3" Grid.Column="0" Margin="0 0 10 10" >Time to inactive (s):</Label>
<Label Grid.Row="3" Grid.Column="0" Margin="0 0 10 10" >Time to inactive (ms):</Label>
<TextBox Grid.Row="3" Grid.Column="1" Name="TimeToInactive" Margin="0 0 10 10" KeyUp="OnTimeToInactiveKeyUp"/>

<Label Grid.Row="4" Grid.Column="0" Margin="0 0 10 10" >Time to stale (s):</Label>
<Label Grid.Row="4" Grid.Column="0" Margin="0 0 10 10" >Time to stale (ms):</Label>
<TextBox Grid.Row="4" Grid.Column="1" Name="TimeToStale" Margin="0 0 10 10" KeyUp="OnTimeToStaleKeyUp"/>

<Label Grid.Row="5" Grid.Column="0" Margin="0 0 10 10" >Time to removal (s):</Label>
<Label Grid.Row="5" Grid.Column="0" Margin="0 0 10 10" >Time to removal (ms):</Label>
<TextBox Grid.Row="5" Grid.Column="1" Name="TimeToRemoval" Margin="0 0 10 10" KeyUp="OnTimeToRemovalKeyUp"/>

<Label Grid.Row="6" Grid.Column="0" Margin="0 0 10 10" >Time to locked (s):</Label>
<Label Grid.Row="6" Grid.Column="0" Margin="0 0 10 10" >Time to locked (ms):</Label>
<TextBox Grid.Row="6" Grid.Column="1" Name="TimeToLocked" Margin="0 0 10 10" KeyUp="OnTimeToLockedKeyUp"/>

<Label Grid.Row="7" Grid.Column="0" Margin="0 0 10 10" >Refresh interval (s):</Label>
<Label Grid.Row="7" Grid.Column="0" Margin="0 0 10 10" >Refresh interval (ms):</Label>
<TextBox Grid.Row="7" Grid.Column="1" Name="RefreshInterval" Margin="0 0 10 10" KeyUp="OnRefreshIntervalKeyUp"/>

<StackPanel Orientation="Horizontal" Grid.Row="8" Grid.Column="1" Margin="0 10 0 0">
Expand Down
2 changes: 1 addition & 1 deletion src/BaseStationReader.UI/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"TimeToLock": 900000,
"LogFile": "C:\\MyApps\\AircraftTracker.log",
"MinimumLogLevel": "Info",
"EnableSqlWriter": false,
"EnableSqlWriter": true,
"WriterInterval": 30000,
"WriterBatchSize": 20000,
"RefreshInterval": 1000,
Expand Down
Binary file modified wireframes/Aircraft Tracker.bmpr
Binary file not shown.
Binary file modified wireframes/Wireframe - v1.00.pdf
Binary file not shown.

0 comments on commit 88a1628

Please sign in to comment.