private void App_DispatcherUnhandledException( object sender, DispatcherUnhandledExceptionEventArgs e) { App.logger.Fatal("UNEXPECTED EXCEPTION:" + e.Exception.Message + (object)e.Exception.InnerException); CashDrawerService.Disconnect(); if (WPFMessageBox.Show(Resources.ExceptionGeneral + e.Exception.Message, Resources.ExceptionGeneralTitle, MessageBoxButton.OK, MessageBoxImage.Hand) == MessageBoxResult.OK) { e.Handled = true; MediaTypeNames.Application.Current.Shutdown(); } e.Handled = true; }
private void CoinKeypadEnterCommandExec() { if (string.IsNullOrEmpty(this.KeypadEntry)) { return; } int num1 = int.Parse(this.KeypadEntry); if ((double)num1 == this.NewTransaction.Transaction.Amount) { CashDrawerService.OpenDrawer(); ((CoinTransaction)this.NewTransaction.Transaction).CoinsReceived = num1; this.KeypadEntry = string.Empty; } else { int num2 = (int)WPFMessageBox.Show("The received amount of coins has to be the exact amount due.", "Validation warning", MessageBoxButton.OK, MessageBoxImage.Asterisk); } }
private void KeypadEnterCommandExec() { if (string.IsNullOrEmpty(this.KeypadEntry)) { return; } double num1 = double.Parse(this.KeypadEntry); if (num1 >= this.CurrentTicket.Ticket.TotalRemaining) { CashDrawerService.OpenDrawer(); ((CashTransaction)this.NewTransaction.Transaction).MoneyReceived = num1; ((CashTransaction)this.NewTransaction.Transaction).MoneyReturned = ((CashTransaction)this.NewTransaction.Transaction).MoneyReceived - this.CurrentTicket.Ticket.TotalRemaining; this.KeypadEntry = string.Empty; } else { int num2 = (int)WPFMessageBox.Show("The entered price has to be bigger then the total remaining price.", "Validation warning", MessageBoxButton.OK, MessageBoxImage.Asterisk); } }
public App() { this.InitializeComponent(); MediaTypeNames.Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; if (Pos.Properties.Settings.Default.UpdateSettings) { Pos.Properties.Settings.Default.Upgrade(); Pos.Properties.Settings.Default.UpdateSettings = false; Pos.Properties.Settings.Default.Save(); } Dal.Settings.ConnectionString = new SqlConnectionStringBuilder() { Password = Pos.Properties.Settings.Default.DbPassword, UserID = Pos.Properties.Settings.Default.DbUser, InitialCatalog = Pos.Properties.Settings.Default.DbCatalog, DataSource = Pos.Properties.Settings.Default.DbInstance }.ToString(); MainWindowView mainWindowView = new MainWindowView(); MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(); mainWindowView.DataContext = (object)mainWindowViewModel; MediaTypeNames.Application.Current.MainWindow = (Window)mainWindowView; NavigatorHelper.NavigationService = mainWindowView.MainFrame.NavigationService; mainWindowView.Show(); mainWindowView.Visibility = Visibility.Hidden; if (!string.IsNullOrEmpty(Pos.Properties.Settings.Default.SerialPortCashDrawer)) { CashDrawerService.ComPortName = Pos.Properties.Settings.Default.SerialPortCashDrawer; if (!CashDrawerService.Connect()) { int num = (int)WPFMessageBox.Show(Resources.ExceptionSerial, Resources.ExceptionSerialTitle, MessageBoxButton.OK, MessageBoxImage.Exclamation); } } try { new UnitOfWork().CategoryRepository.GetAll(); } catch (SqlException ex) { SplashScreenHelper.CloseInstant(); int num = (int)WPFMessageBox.Show(Resources.ExceptionDbWarning + ex.Message, Resources.ExceptionDbWarningTitle, MessageBoxButton.OK, MessageBoxImage.Hand); App.logger.Error("Database error: {0}", ex.Message); NavigatorHelper.NavigationService.Navigate(new Uri("Views/Settings/SettingsPageView.xaml", UriKind.Relative)); NavigatorHelper.NavigationService.RemoveBackEntry(); return; } catch (DataException ex) { SplashScreenHelper.CloseInstant(); int num = (int)WPFMessageBox.Show(Resources.ExceptionDbWarning + ex.Message, Resources.ExceptionDbWarningTitle, MessageBoxButton.OK, MessageBoxImage.Hand); App.logger.Error("Database error: {0}", ex.Message); NavigatorHelper.NavigationService.Navigate(new Uri("Views/Settings/SettingsPageView.xaml", UriKind.Relative)); NavigatorHelper.NavigationService.RemoveBackEntry(); return; } catch (InvalidOperationException ex) { SplashScreenHelper.CloseInstant(); int num = (int)WPFMessageBox.Show(Resources.ExceptionDbWarning + ex.Message, Resources.ExceptionDbWarningTitle, MessageBoxButton.OK, MessageBoxImage.Hand); App.logger.Error("Database error: {0}", ex.Message); NavigatorHelper.NavigationService.Navigate(new Uri("Views/Settings/SettingsPageView.xaml", UriKind.Relative)); NavigatorHelper.NavigationService.RemoveBackEntry(); return; } if (string.IsNullOrEmpty(Pos.Properties.Settings.Default.NfcReaderName)) { LockScreenHelper.Hide(); NavigatorHelper.NavigationService.Navigate(new Uri("Views/Settings/SettingsPageView.xaml", UriKind.Relative)); NavigatorHelper.NavigationService.RemoveBackEntry(); } else { AuthenticationService.Instance.Inititialize(new PcscService(Pos.Properties.Settings.Default.NfcReaderName), Pos.Properties.Settings.Default.AuthenticationTimeout); AuthenticationService.Instance.MemberAuthenticated += (AuthenticationService.AuthenticationEventHandler)((o, e) => { if (!e.AuthenticatedMember.Roles.Any <Role>()) { return; } LockScreenHelper.Hide(); }); AuthenticationService.Instance.MemberDeauthenticated += (AuthenticationService.AuthenticationEventHandler) delegate { LockScreenHelper.Show(); }; NavigatorHelper.NavigationService.Navigate(new Uri("Views/NewTicket/NewTicketPageView.xaml", UriKind.Relative)); NavigatorHelper.NavigationService.RemoveBackEntry(); } }
protected override void OnExit(ExitEventArgs e) { base.OnExit(e); CashDrawerService.Disconnect(); }
private void OpenCashDrawerExec() { CashDrawerService.OpenDrawer(); }