Skip to content

Commit

Permalink
Verification view and working web results
Browse files Browse the repository at this point in the history
  • Loading branch information
Jocke-G committed May 14, 2018
1 parent 511f84f commit 7ef301c
Show file tree
Hide file tree
Showing 42 changed files with 18,217 additions and 9,342 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ public void PersistModel()
PersistenceService.Save(Model);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 18 additions & 9 deletions src/SportidentLapCounter/Controls/MainForm/MainFormView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Nancy;
using Nancy.Hosting.Self;
using SportidentLapCounter.DataTypes;
using SportidentLapCounter.Helpers;
using SPORTident;
using SPORTident.Common;
using System.Net.Sockets;
using SportidentLapCounter.Controls.CardInjectorForm;
using SportidentLapCounter.Controls.VerificationForm;

namespace SportidentLapCounter.Controls.MainForm
{
Expand All @@ -20,10 +19,9 @@ public partial class MainFormView : Form
private MainFormPresenter _presenter;

private MainFormPresenter Presenter => _presenter ?? (_presenter = new MainFormPresenter());


private NancyHost _host;
private Reader _reader;
private VerificationFormView _verificationForm;

public MainFormView()
{
Expand All @@ -50,7 +48,6 @@ private void InitializeSportidentReader()
GetSiDevices();
}


private void GetSiDevices()
{
ReaderDeviceInfo.GetAvailableDeviceList();
Expand Down Expand Up @@ -86,10 +83,12 @@ private void SavePunchData(CardPunchData punchData) {
Presenter.Model.Teams.Add(new Team { SportidentCardNumber1 = sportidentCardnumber });
}

foreach (var x in Presenter.Model.Teams.Where(x => x.SportidentCardNumber1 == sportidentCardnumber || x.SportidentCardNumber2 == sportidentCardnumber).ToList())
foreach (var team in Presenter.Model.Teams.Where(x => x.SportidentCardNumber1 == sportidentCardnumber || x.SportidentCardNumber2 == sportidentCardnumber).ToList())
{
x.Laps += 1;
x.LatestPunchTime = punchData.PunchDateTime;
team.Laps += 1;
team.LatestPunchTime = punchData.PunchDateTime;

_verificationForm?.ShowPunch(team);
}

SortUpdatePersist();
Expand Down Expand Up @@ -326,9 +325,19 @@ private void button_Fake_Click(object sender, EventArgs e)
cardInjectForm.CallbackMethod += Callback;
}

private void button1_Click_1(object sender, EventArgs e)
{
if (_verificationForm == null)
{
_verificationForm = new VerificationFormView();
_verificationForm.Closed += (o, args) => _verificationForm = null;
_verificationForm.Show(this);
}
}

public void Callback(CardPunchData card)
{
SavePunchData(card);
}
}
}
}
18 changes: 0 additions & 18 deletions src/SportidentLapCounter/Controls/MainForm/MainFormView.resx
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,4 @@
<metadata name="columnLatestPunchTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="columnNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="columnName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="columnSportidentCardNumber1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="columnSportidentCardNumber2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="columnLaps.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="columnLatestPunchTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Drawing;
using System.Windows.Forms;
using SportidentLapCounter.DataTypes;

namespace SportidentLapCounter.Controls.VerificationForm
{
public partial class VerificationFormView : Form
{
public VerificationFormView()
{
InitializeComponent();
}

public void ShowPunch(Team team)
{
teamNumberLabel.Text = team.Number.ToString();
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.Add) || keyData == (Keys.Control | Keys.Oemplus))
{
Bigger();
return true;
}

if (keyData == (Keys.Control | Keys.Subtract) || keyData == (Keys.Control | Keys.OemMinus))
{
Smaller();
return true;
}

return base.ProcessCmdKey(ref msg, keyData);
}

private void Smaller()
{
var font = new Font(teamNumberLabel.Font.FontFamily, teamNumberLabel.Font.Size - 10);
teamNumberLabel.Font = font;
}

private void Bigger()
{
var font = new Font(teamNumberLabel.Font.FontFamily, teamNumberLabel.Font.Size + 10);
teamNumberLabel.Font = font;
}
}
}
Loading

0 comments on commit 7ef301c

Please sign in to comment.