static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args.Length > 0) { var firstArgs = args[0]; if (firstArgs == "--normalize") { TransactionHelper.CalculateSubtotal(true); return; } else if (firstArgs == "--daemon") { if (AppHelper.ExpiredDate < DateTime.Now) { //If Installation already expired DataHelper.DestoryDB(); } timer = new System.Threading.Timer(new TimerCallback(TimerTick), null, 60 * 1000, 20 * 60 * 1000); Application.Run(); return; } else if (firstArgs == "--setup") { InitApp("http://assets.app.local/index.html#/setup/db"); return; } } InitApp(); }
private void CalcTransaction(object sender, CfrV8HandlerExecuteEventArgs e) { try { var normalize = e.Arguments[0]; var callback = e.Arguments[1]; if (!normalize.IsBool) { e.Exception = "Parameter 1 expected Boolean"; return; } var is_normalize = normalize.BoolValue; var th = new Thread(() => TransactionHelper.CalculateSubtotal(is_normalize)); th.Start(); th.Join(); ExecuteCallback(callback); } catch (Exception ex) { e.Exception = ex.Message; } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args.Length > 0) { var firstArgs = args[0]; if (firstArgs == "--calc-all-transaction") { TransactionHelper.CalculateSubtotal(true); return; } else if (firstArgs == "--calc-transaction") { TransactionHelper.CalculateSubtotal(); TransactionHelper.ClosingTransaction(); return; } else if (firstArgs == "--calc-booking") { TransactionHelper.CalculateBooking(); return; } else if (firstArgs == "--setup") { InitApp("http://assets.app.local/index.html#/setup/db"); return; } } InitApp(); }
private void CalcTransaction(object sender, CfrV8HandlerExecuteEventArgs e) { try { var callback = e.Arguments[0]; var th = new Thread(() => TransactionHelper.CalculateSubtotal(false)); th.Start(); th.Join(); ExecuteCallback(callback); } catch (Exception ex) { e.Exception = ex.Message; } }
public static void TimerTick(object state) { TransactionHelper.CalculateSubtotal(); TransactionHelper.CalculateBooking(); }