Skip to content

Commit

Permalink
Various small fixes (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdahlblom authored Oct 15, 2023
1 parent ec700dd commit 0ade9bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/client/DCSInsight/Communication/TCPClientHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class TCPClientHandler : IDisposable, ICommandListener
private Thread _clientThread;
private bool _isRunning;
private readonly string _host;
private string _port;
private readonly string _port;
private bool _apiListReceived = false;
private int _metaDataPollCounter;
public bool LogJSON { get; set; }
Expand Down
5 changes: 1 addition & 4 deletions src/client/DCSInsight/Misc/ResultComparator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ namespace DCSInsight.Misc
internal class ResultComparator
{
private readonly DCSAPI _dcsApi;
private bool _resultHasChanged;
private object _lockObject = new();
private readonly object _lockObject = new();

public ResultComparator(DCSAPI dcsApi)
{
Expand Down Expand Up @@ -61,7 +60,6 @@ public bool SetResult(DCSAPI dcsApi)
if (dcsApi.Result != _dcsApi.Result)
{
_dcsApi.Result = dcsApi.Result;
_resultHasChanged = true;
return true;
}
}
Expand All @@ -71,7 +69,6 @@ public bool SetResult(DCSAPI dcsApi)
Common.ShowErrorMessageBox(ex);
}

_resultHasChanged = false;
return false;
}

Expand Down
13 changes: 7 additions & 6 deletions src/client/DCSInsight/Windows/WindowRangeTest.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public partial class WindowRangeTest : Window, IErrorListener, IConnectionListen
private bool _stopRunning;
private bool _doLoop;
private bool _showChangesOnly;
private static readonly AutoResetEvent AutoResetEvent1 = new AutoResetEvent(false);
private static readonly AutoResetEvent AutoResetEvent1 = new(false);
private Thread _thread;
private int _threadLoopSleep = 50;
private readonly int _threadLoopSleep = 50;
private readonly List<ResultComparator> _resultComparatorList = new();
private object _lockObject = new();
private readonly object _lockObject = new();

public WindowRangeTest(List<DCSAPI> dcsAPIList)
{
Expand Down Expand Up @@ -137,7 +137,6 @@ public void DataReceived(DataEventArgs args)

var hasChanged = _resultComparatorList.First(o => o.IsMatch(args.DCSApi)).SetResult(args.DCSApi);

Debug.WriteLine($"Has Changed = {hasChanged}");
if (_showChangesOnly && !hasChanged)
{
AutoResetEvent1.Set();
Expand Down Expand Up @@ -351,8 +350,10 @@ private void BuildUI()

foreach (var dcsAPIParameterType in _dcsAPI.Parameters)
{
var stackPanel = new StackPanel();
stackPanel.Orientation = Orientation.Horizontal;
var stackPanel = new StackPanel
{
Orientation = Orientation.Horizontal
};

var label = new Label
{
Expand Down

0 comments on commit 0ade9bf

Please sign in to comment.