[GPAS-Developers] SF.net SVN: gpas:[80] trunk/kiosk/gui
Brought to you by:
martinalderson,
paulspink
|
From: <mar...@us...> - 2009-12-09 18:01:58
|
Revision: 80
http://gpas.svn.sourceforge.net/gpas/?rev=80&view=rev
Author: martinalderson
Date: 2009-12-09 18:01:44 +0000 (Wed, 09 Dec 2009)
Log Message:
-----------
A 3 second logging out message is displayed to allow coins inserted but not yet accepted when the user logged out (via log out button or time out) enough time to be accounted for. In case this is not long enough subsequent coins accepted will be credited to the last user rather than just ignored.
Modified Paths:
--------------
trunk/kiosk/gui/CashMech/AbstractCashMech.cs
trunk/kiosk/gui/KioskWindow.xaml.cs
trunk/kiosk/gui/Panels/CreditAccountPanel.xaml.cs
trunk/kiosk/gui/Panels/UsernamePanel.xaml.cs
Modified: trunk/kiosk/gui/CashMech/AbstractCashMech.cs
===================================================================
--- trunk/kiosk/gui/CashMech/AbstractCashMech.cs 2009-12-07 18:04:39 UTC (rev 79)
+++ trunk/kiosk/gui/CashMech/AbstractCashMech.cs 2009-12-09 18:01:44 UTC (rev 80)
@@ -461,10 +461,9 @@
}
else
{
- UIElement uiElement = theApp.getDisplayPanel();
- if (uiElement != null && uiElement is CreditAccountPanel)
+ CreditAccountPanel creditAccountPanel = CreditAccountPanel.LastCreditAccountPanel;
+ if (creditAccountPanel != null)
{
- CreditAccountPanel creditAccountPanel = (CreditAccountPanel)uiElement;
object[] args = { deposit.value - 1 };
((CreditAccountPanel)uiElement).getDispatcher().BeginInvoke(DispatcherPriority.Input, new SR3CoinDepositedDelegate(CoinsDeposited), creditAccountPanel, args);
}
@@ -498,10 +497,9 @@
{
App.writeEventLogEntry("CoinAccepted: " + (cashInputEventArgs.InputValue * 100).ToString() + ", channel: " + deposit, EventLogEntryType.Information);
- UIElement uiElement = theApp.getDisplayPanel();
- if (uiElement != null && uiElement is CreditAccountPanel)
+ CreditAccountPanel creditAccountPanel = CreditAccountPanel.LastCreditAccountPanel;
+ if (creditAccountPanel != null)
{
- CreditAccountPanel creditAccountPanel = (CreditAccountPanel)uiElement;
object[] args = { deposit };
creditAccountPanel.getDispatcher().BeginInvoke(DispatcherPriority.Input, new NetshiftCoinAcceptedDelegate(CoinsDeposited), creditAccountPanel, args);
}
@@ -517,10 +515,9 @@
{
App.writeEventLogEntry("NoteAccepted: " + cashInputEventArgs.InputValue.ToString(), EventLogEntryType.Information);
- UIElement uiElement = theApp.getDisplayPanel();
- if (uiElement != null && uiElement is CreditAccountPanel)
+ CreditAccountPanel creditAccountPanel = CreditAccountPanel.LastCreditAccountPanel;
+ if (creditAccountPanel != null)
{
- CreditAccountPanel creditAccountPanel = (CreditAccountPanel)uiElement;
object[] args = { (int)cashInputEventArgs.InputValue };
creditAccountPanel.getDispatcher().BeginInvoke(DispatcherPriority.Input, new NetshiftNoteAcceptedDelegate(NotesEntered), creditAccountPanel, args);
}
@@ -528,10 +525,9 @@
private void UBA10NotesEnteredCallback(object sender, AxUBA10Lib._DUba10Events_DepositEvent deposit)
{
- UIElement uiElement = theApp.getDisplayPanel();
- if (uiElement != null && uiElement is CreditAccountPanel)
+ CreditAccountPanel creditAccountPanel = CreditAccountPanel.LastCreditAccountPanel;
+ if (creditAccountPanel != null)
{
- CreditAccountPanel creditAccountPanel = (CreditAccountPanel)uiElement;
object[] args = { deposit.value };
creditAccountPanel.getDispatcher().BeginInvoke(DispatcherPriority.Input, new UBA10NoteEnteredDelegate(NotesEntered), creditAccountPanel, args);
}
Modified: trunk/kiosk/gui/KioskWindow.xaml.cs
===================================================================
--- trunk/kiosk/gui/KioskWindow.xaml.cs 2009-12-07 18:04:39 UTC (rev 79)
+++ trunk/kiosk/gui/KioskWindow.xaml.cs 2009-12-09 18:01:44 UTC (rev 80)
@@ -254,7 +254,7 @@
{
if (displayPanel != null && displayPanel is CreditAccountPanel)
{
- ((CreditAccountPanel)displayPanel).OnClick_ButtonFinish(null, null);
+ ((CreditAccountPanel)displayPanel).OnTimeout();
}
else
{
Modified: trunk/kiosk/gui/Panels/CreditAccountPanel.xaml.cs
===================================================================
--- trunk/kiosk/gui/Panels/CreditAccountPanel.xaml.cs 2009-12-07 18:04:39 UTC (rev 79)
+++ trunk/kiosk/gui/Panels/CreditAccountPanel.xaml.cs 2009-12-09 18:01:44 UTC (rev 80)
@@ -49,6 +49,13 @@
public partial class CreditAccountPanel : System.Windows.Controls.Grid
{
+ // Store the last creditAccountPanel globally so any coins accepted after the credit panel is removed from the screen can be credited to the right user.
+ private static CreditAccountPanel lastCreditAccountPanel = null;
+ public static CreditAccountPanel LastCreditAccountPanel
+ {
+ get { return lastCreditAccountPanel; }
+ }
+
private KioskWindow theApp;
private KioskAPI.ValidatedUser validatedUser;
@@ -73,8 +80,12 @@
private int maximumBalance = 0;
private int initialBalance = -999999;
+ private System.Windows.Forms.Timer finishTimer = new System.Windows.Forms.Timer();
+ private Boolean finishing = false;
+
public CreditAccountPanel(KioskWindow theApp, KioskAPI.ValidatedUser validatedUser)
{
+ lastCreditAccountPanel = this;
this.theApp = theApp;
this.validatedUser = validatedUser;
@@ -261,6 +272,22 @@
public void OnClick_ButtonFinish(Object sender, RoutedEventArgs args)
{
+ Finish("You are being logged out");
+ }
+
+ public void OnTimeout()
+ {
+ Finish("Your session has timed out");
+ }
+
+ private void Finish(string message)
+ {
+ if (finishing)
+ {
+ return;
+ }
+ finishing = true;
+
if (acceptCoins)
{
theApp.getCashMech().setCoinConnected(false);
@@ -277,6 +304,29 @@
acceptNotes = false;
}
+ this.Dispatcher.Invoke(DispatcherPriority.Normal, new System.Windows.Forms.MethodInvoker(delegate()
+ {
+ textBlock_CreditLine1.Text = message;
+ textBlock_CreditLine2.Text = "";
+ textBlock_CreditLine3.Text = "Please Wait...";
+ stackPanel_CreditPage.InvalidateVisual();
+
+ textBlock_CreditLine3.Margin = new Thickness(0, 15, 0, 0);
+ textBlock_CashDeposited.Margin = new Thickness(0, 20, 0, 0);
+ button_Finish.Visibility = Visibility.Hidden;
+ button_Print.Visibility = Visibility.Hidden;
+ }));
+
+ // Allow pending payments to be processed.
+ finishTimer.Tick += new EventHandler(FinishTimer_Tick);
+ finishTimer.Interval = 3000;
+ finishTimer.Start();
+ }
+
+ private void FinishTimer_Tick(Object sender, EventArgs args)
+ {
+ finishTimer.Stop();
+
if (cashDeposited > 0)
{
bool printReceipt = true;
@@ -323,7 +373,6 @@
}
finally
{
- this.validatedUser = null;
cashDeposited = 0;
}
}
Modified: trunk/kiosk/gui/Panels/UsernamePanel.xaml.cs
===================================================================
--- trunk/kiosk/gui/Panels/UsernamePanel.xaml.cs 2009-12-07 18:04:39 UTC (rev 79)
+++ trunk/kiosk/gui/Panels/UsernamePanel.xaml.cs 2009-12-09 18:01:44 UTC (rev 80)
@@ -75,6 +75,7 @@
if (theApp.getKioskConfig().getGeneralSettings().getInactivityTimeout() > 0)
{
+ theApp.getInactivityTimer().Stop();
theApp.getInactivityTimer().Start();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|