private void OnCreatedPagato(object source, FileSystemEventArgs e) { Debug.Log("CashmaticApp", "OnCreatedPagato"); FileInfo file = new FileInfo(e.FullPath); while (Helper.isFileLocked(file)) { Thread.Sleep(50); } try { int pagato = CashmaticCommands.ReadPagato(); 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()); } }
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()); } }