Skip to content
New issue

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

Various small fixes #26

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading