This commit is contained in:
2024-04-19 02:24:05 +01:00
parent 13b8eda0c9
commit 7fd9f6998d
50 changed files with 3286 additions and 154 deletions

View File

@@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Emit;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HCI_Coursework_EVCHARGE
{
public partial class AccountDetailForm : Form
{
Keyboard keyboard;
Pinpad pinpad;
public AccountDetailForm()
{
InitializeComponent();
this.ActiveControl = this.loginLabel;
StartPosition = FormStartPosition.CenterScreen;
}
private void accountNo_Focus(object sender, EventArgs e)
{
TextBox textBox = (TextBox)sender; // take a copy of the object reference for the particular textbox pressed
if (keyboard == null) // check if the keyboard is already created
{
keyboard = new Keyboard(); // no keyboard so create an instance of one
keyboard.FormClosed += delegate
{
keyboard = null; // when the keyboard is closed, dispose of the keyboard instance
this.ActiveControl = loginLabel; // when the keyboard is closed, reset focus to the dummy label else
// it will give focus to a textbox which would trigger the event to
// make another keyboard appear.
};
}
keyboard.setTextBox(textBox); // tell the keyboard which textbox to send its characters too
keyboard.Show(); // show the keyboard
keyboard.Top = this.Top + textBox.Top + textBox.Height + 30;
}
private void accountPin_Focus(object sender, EventArgs e) {
TextBox textBox = (TextBox)sender;
if ( pinpad == null )
{
pinpad = new Pinpad();
pinpad.FormClosed += delegate
{
pinpad = null;
this.ActiveControl = loginLabel;
};
}
pinpad.setTextBox(textBox);
pinpad.Show();
pinpad.Top = this.Top + textBox.Top + textBox.Height + 30;
}
private void cancel_Click(object sender, EventArgs e)
{
keyboard?.Close();
pinpad?.Close();
Close();
}
private void login_Click(object sender, EventArgs e)
{
if ( accountNoTextBox.Text == "" )
{
if ( accountPinTextBox.Text == "" )
{
BaySelection baySelection = new BaySelection( accountNoTextBox.Text );
baySelection.Show();
baySelection.FormClosed += delegate
{
baySelection = null;
};
Close();
}
}
}
private void accountNo_LoseFocus(object sender, EventArgs e)
{
if (keyboard != null)
{
keyboard.Close();
}
}
private void accountPin_LoseFocus(Object sender, EventArgs e)
{
if (pinpad != null )
{
pinpad.Close();
}
}
}
}