Ejemplo n.º 1
0
        private void InitPayment()
        {
            Debug.Log("CashmaticApp", "InitPayment");
            int amountLeft = Global.subtotale;

            if (_ob.panda.OnPayment)
            {
                int saldato = CashmaticCommands.ReadSaldato();
                amountLeft = Global.subtotale - saldato;
            }
            else
            {
                CashmaticCommands.DeleteCashmaticFiles();
                CashmaticCommands.WriteSubtotale(Global.subtotale);
                _ob.panda.OnPayment = true;
            }

            tblPrice.Text = String.Format("{0:0.00}€", amountLeft / (double)100);

            SetSaldatoChangeListener();
            SetPagatoChangeListener();
            SetErogatoChangeListener();
            SetNonerogatoChangeListener();
            SetErogazioneChangeListener();
        }
Ejemplo n.º 2
0
        private void OnErogazioneChange(object source, FileSystemEventArgs e)
        {
            Debug.Log("CashmaticApp", "OnErogazioneChange");
            FileInfo file = new FileInfo(e.FullPath);

            while (Helper.isFileLocked(file))
            {
                Thread.Sleep(50);
            }
            try
            {
                int saldato    = CashmaticCommands.ReadSaldato();
                int erogazione = CashmaticCommands.ReadErogazione();
                int pagato     = CashmaticCommands.ReadPagato();
                saldato = (Global.subtotale - saldato);

                if (saldato < 0)
                {
                    saldato = saldato * -1;
                }
                saldato = saldato - erogazione;

                Application.Current.Dispatcher.BeginInvoke(
                    DispatcherPriority.Background, new Action(() => tblPrice.Text = String.Format("{0:0.00}€", saldato / (double)100)));

                pagato = pagato - erogazione;

                if (pagato == Global.subtotale)
                {
                    file.Delete();
                    StopListeners();
                    Application.Current.Dispatcher.BeginInvoke(
                        DispatcherPriority.Background, new Action(() => Application.Current.MainWindow.Content = new ThankYouCash(_ob)));
                }
            }
            catch (Exception ex)
            {
                Debug.Log("CashmaticApp", ex.ToString());
            }
        }
Ejemplo n.º 3
0
        private void OnChangeSaldato(object source, FileSystemEventArgs e)
        {
            Debug.Log("CashmaticApp", "OnChangeSaldato");
            FileInfo file = new FileInfo(e.FullPath);

            while (Helper.isFileLocked(file))
            {
                Thread.Sleep(50);
            }
            try
            {
                int saldato = CashmaticCommands.ReadSaldato();
                Global.pagato = saldato;
                saldato       = Global.subtotale - saldato;

                int signChanger = saldato < 0 ? -1:1;
                if (saldato <= 0)
                {
                    Application.Current.Dispatcher.BeginInvoke(
                        DispatcherPriority.Background, new Action(() => tblPrice.Foreground = green));
                }

                Application.Current.Dispatcher.BeginInvoke(
                    DispatcherPriority.Background, new Action(() => tblPrice.Text = String.Format("{0:0.00}€", (saldato * signChanger) / (double)100)));

                if (signChanger < 0)
                {
                    Application.Current.Dispatcher.BeginInvoke(
                        DispatcherPriority.Background, new Action(() => tblRemaining.Text = (string)FindResource("titleRemainReturn")));
                }
            }
            catch (Exception ex)
            {
                Debug.Log("CashmaticApp", ex.ToString());
            }
        }