Add project files.
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Serialization;
|
||||
using System.Windows.Threading;
|
||||
using System.Diagnostics;
|
||||
using SafeBagDE70.Services;
|
||||
|
||||
namespace SafeBagDE70
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
///
|
||||
public partial class MainWindow : HandyControl.Controls.Window
|
||||
{
|
||||
private WelcomeUC _welcomeUC;
|
||||
private DepositSMUC _depositUC;
|
||||
private CollectionUC _collectionUC;
|
||||
private InformationUC _informationUC;
|
||||
private ErrorUC _errorUC;
|
||||
private UserControl _currentUC;
|
||||
private UserControl _prevUC;
|
||||
private TimeoutUC _timeoutUC;
|
||||
private MaintainanceUC _maintainanceUC;
|
||||
private object objLock = new object();
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += MainWindow_Loaded;
|
||||
}
|
||||
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AppData.Init();
|
||||
if (_welcomeUC == null) _welcomeUC = new WelcomeUC();
|
||||
if (_collectionUC == null) _collectionUC = new CollectionUC();
|
||||
if (_informationUC == null) _informationUC = new InformationUC();
|
||||
if (_errorUC == null) _errorUC = new ErrorUC();
|
||||
if (_depositUC == null) _depositUC = new DepositSMUC();
|
||||
if (_timeoutUC == null) _timeoutUC = new TimeoutUC();
|
||||
if (_maintainanceUC == null) _maintainanceUC = new MaintainanceUC();
|
||||
|
||||
|
||||
gridMain.Children.Add(_welcomeUC);
|
||||
gridMain.Children.Add(_depositUC);
|
||||
gridMain.Children.Add(_collectionUC);
|
||||
gridMain.Children.Add(_informationUC);
|
||||
gridMain.Children.Add(_errorUC);
|
||||
gridMain.Children.Add(_timeoutUC);
|
||||
gridMain.Children.Add(_maintainanceUC);
|
||||
|
||||
ShowWelcomeScreen();
|
||||
//ShowDepositScreen();
|
||||
}
|
||||
|
||||
public void HideAll()
|
||||
{
|
||||
lock(objLock)
|
||||
{
|
||||
foreach (var item in gridMain.Children)
|
||||
{
|
||||
if (item != null)
|
||||
(item as UserControl).Visibility = Visibility.Hidden;
|
||||
}
|
||||
_collectionUC.Visibility = Visibility.Hidden;
|
||||
_informationUC.Visibility = Visibility.Hidden;
|
||||
_errorUC.Visibility = Visibility.Hidden;
|
||||
_depositUC.Visibility = Visibility.Hidden;
|
||||
_welcomeUC.Visibility = Visibility.Hidden;
|
||||
_maintainanceUC.Visibility=Visibility.Hidden;
|
||||
SoundManager.StopWarningSound();
|
||||
}
|
||||
|
||||
}
|
||||
public void ShowInformationScreen(string strInfor,bool bContinue=false,bool bPlaySound=true)
|
||||
{
|
||||
_prevUC = _currentUC;
|
||||
_currentUC = _informationUC;
|
||||
HideAll();
|
||||
_informationUC.Visibility = Visibility.Visible;
|
||||
_informationUC.ShowInfor(strInfor, bContinue, bPlaySound);
|
||||
}
|
||||
public void ShowErrorScreen(string strError)
|
||||
{
|
||||
_prevUC = _currentUC;
|
||||
_currentUC = _errorUC;
|
||||
HideAll();
|
||||
_errorUC.Visibility = Visibility.Visible;
|
||||
_errorUC.ShowInfor(strError);
|
||||
}
|
||||
public void ShowWelcomeScreen()
|
||||
{
|
||||
_prevUC = _currentUC;
|
||||
_currentUC = _welcomeUC;
|
||||
HideAll();
|
||||
_welcomeUC.Init();
|
||||
_welcomeUC.Visibility = Visibility.Visible;
|
||||
}
|
||||
public void ShowDepositScreen(bool bInit=true)
|
||||
{
|
||||
_prevUC = _currentUC;
|
||||
_currentUC = _depositUC;
|
||||
HideAll();
|
||||
_depositUC.Visibility = Visibility.Visible;
|
||||
if(bInit)
|
||||
{
|
||||
_depositUC.EndTransaction();
|
||||
_depositUC.InitTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowCollectionScreen()
|
||||
{
|
||||
_prevUC = _currentUC;
|
||||
_currentUC = _collectionUC;
|
||||
HideAll();
|
||||
_collectionUC.Init();
|
||||
_collectionUC.Visibility = Visibility.Visible;
|
||||
}
|
||||
public bool IsMaintainanceScreen()
|
||||
{
|
||||
return _currentUC == _maintainanceUC;
|
||||
}
|
||||
public DepositSMUC GetDepositScreen()
|
||||
{
|
||||
return _depositUC;
|
||||
}
|
||||
public void ShowMaintainanceScreen()
|
||||
{
|
||||
_prevUC = _currentUC;
|
||||
HideAll();
|
||||
_maintainanceUC.Visibility = Visibility.Visible;
|
||||
}
|
||||
public void ShowTimeoutScreen()
|
||||
{
|
||||
_prevUC = _currentUC;
|
||||
HideAll();
|
||||
_timeoutUC.Visibility = Visibility.Visible;
|
||||
}
|
||||
public void BackScreen()
|
||||
{
|
||||
HideAll();
|
||||
_prevUC.Visibility = Visibility.Visible;
|
||||
_currentUC = _prevUC;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using DE70_CMDv2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SafeBagDE70.Admin
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AdminConfigurationUC.xaml
|
||||
/// </summary>
|
||||
public partial class AdminConfigurationUC : UserControl
|
||||
{
|
||||
public AdminConfigurationUC()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnResetCounter_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AppData.cCmdRsp != null)
|
||||
{
|
||||
CCmdRsp cCmdRsp = AppData.cCmdRsp;
|
||||
cCmdRsp.SendDeSense();
|
||||
Thread.Sleep(1000);
|
||||
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_UNLOCK);
|
||||
Thread.Sleep(1000);
|
||||
cCmdRsp.SendDeSense();
|
||||
Thread.Sleep(1000);
|
||||
//Event fix
|
||||
var recvData = cCmdRsp.recv_dat;
|
||||
|
||||
if (recvData.dat[14] == recvData.dat[16])
|
||||
{
|
||||
cCmdRsp.SendLock();
|
||||
}
|
||||
else
|
||||
{
|
||||
cCmdRsp.SendEventFix(recvData.dat[16]);
|
||||
cCmdRsp.SendLock();
|
||||
}
|
||||
|
||||
var currentMode = cCmdRsp.GetLockParam().mode;
|
||||
cCmdRsp.GetLockParam().mode = Mode.MODE_COLLECTION;
|
||||
cCmdRsp.SendLock();
|
||||
Thread.Sleep(10000);
|
||||
cCmdRsp.SendDeSense();
|
||||
Thread.Sleep(1000);
|
||||
recvData = cCmdRsp.recv_dat;
|
||||
|
||||
if (recvData.dat[14] != recvData.dat[16])
|
||||
{
|
||||
lblStatus.Text = "TRẠNG THÁI: KHỞI TẠO BỘ ĐẾM THÀNH CÔNG";
|
||||
((MainWindow)Application.Current.MainWindow).ShowWelcomeScreen();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOpenEscrow_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AppData.cCmdRsp != null)
|
||||
AppData.cCmdRsp.SendXXCmd((byte)Command.CMD_DE_CANCEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user