Remove unused code

This commit is contained in:
2021-01-26 20:44:35 +01:00
parent bd39b41aff
commit 96ec0245b9
3 changed files with 0 additions and 160 deletions

View File

@@ -94,7 +94,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="MQTTService.cs" />
<Compile Include="Views\DataDisplay.cs" />
<Compile Include="Views\EditUserDisplay.cs" />
<Compile Include="Views\EntryDialog.cs" />
<Compile Include="Views\FingerprintDialog.cs" />
@@ -103,7 +102,6 @@
<Compile Include="Views\ManageUsersDisplay.cs" />
<Compile Include="Views\NewUserDialog.cs" />
<Compile Include="Views\SettingsDisplay.cs" />
<Compile Include="Views\SleepDisplay.cs" />
<Compile Include="Views\TUIManager.cs" />
<Compile Include="Users\User.cs" />
<Compile Include="Users\UsersManager.cs" />

View File

@@ -1,58 +0,0 @@
using System.IO;
using Terminal.Gui;
namespace Akari.Provider.WaveshareUART.Views
{
public class DataDisplay : Toplevel
{
private string _title;
private byte[] _data;
public DataDisplay(string title, byte[] data)
{
_title = title;
_data = data;
Init();
}
private void Init()
{
ColorScheme = Colors.TopLevel;
// Creates the top-level window to show
var win = new Window(_title)
{
X = 0,
Y = 0,
// By using Dim.Fill(), it will automatically resize without manual intervention
Width = Dim.Fill(),
Height = Dim.Fill()
};
win.ColorScheme = Colors.ColorSchemes["Dialog"];
Add(win);
var quitButton = new Button("_Ok")
{
X = Pos.Right(this) - 9,
Y = Pos.Bottom(this) - 2
};
quitButton.Clicked += () => Application.RequestStop();
var stream = new MemoryStream(_data);
var text = new HexView(stream)
{
X = Pos.Center(),
Y = Pos.Center(),
Height = Dim.Fill() - 5,
Width = Dim.Fill() - 2,
AllowEdits = false
};
Add(text, quitButton);
}
}
}

View File

@@ -1,100 +0,0 @@
using Terminal.Gui;
using WaveshareUARTFingerprintSensor;
namespace Akari.Provider.WaveshareUART.Views
{
public class SleepDisplay : Toplevel
{
private FingerprintSensor _fingerprintSensor;
private int _count;
private int _lastID;
private Label _sleepModeLabel;
private Label _readCountLabel;
private Label _lastReadLabel;
public SleepDisplay(FingerprintSensor fingerprintSensor)
{
_fingerprintSensor = fingerprintSensor;
_count = 0;
_lastID = -1;
Init();
}
private void Init()
{
ColorScheme = Colors.Error;
// Creates the top-level window to show
var win = new Window("Sleep")
{
X = 0,
Y = 0,
// By using Dim.Fill(), it will automatically resize without manual intervention
Width = Dim.Fill(),
Height = Dim.Fill()
};
win.ColorScheme = Colors.ColorSchemes["Dialog"];
Add(win);
// Window Content
_sleepModeLabel = new Label("Sleep mode is on, waiting for fingerprints...")
{
X = 2,
Y = 1,
Width = Dim.Fill()
};
_readCountLabel = new Label("Read: 0")
{
X = Pos.Left(_sleepModeLabel),
Y = Pos.Bottom(_sleepModeLabel) + 1,
Width = Dim.Fill()
};
_lastReadLabel = new Label("Last User: - 1")
{
X = Pos.Left(_readCountLabel),
Y = Pos.Bottom(_readCountLabel),
Width = Dim.Fill()
};
var stopButton = new Button("_Stop")
{
X = Pos.Right(this) - 11,
Y = Pos.Bottom(this) - 2
};
stopButton.Clicked += () => { _fingerprintSensor.Waked -= FingerprintSensor_Waked; Application.RequestStop(); };
win.Add(_sleepModeLabel, _readCountLabel, _lastReadLabel);
Add(stopButton);
_fingerprintSensor.Waked += FingerprintSensor_Waked;
_fingerprintSensor.Sleep();
}
private void UpdateInfo()
{
_readCountLabel.Text = $"Read: {_count}";
_lastReadLabel.Text = $"Last User: {_lastID}";
}
private void FingerprintSensor_Waked(FingerprintSensor sender)
{
_fingerprintSensor.Wake();
if (_fingerprintSensor.TryComparison1N(out var userInfo))
{
_count += 1;
_lastID = userInfo.userID;
Application.MainLoop.Invoke(UpdateInfo);
}
_fingerprintSensor.Sleep();
}
}
}