private Backend() { um = new EmployeeManager(); efm = new ExpenseFormManager(); em = new ExpenseManager(); curAPI = new CurrencyAPI(); _projectCodes = new Dictionary<int, string>(); }
// Form manipulations public void send(string signature, string remarks, bool notification, Action<object> onSuccess, Action<Exception> onFail) { DeviceContext.DeviceContext.Current.RunOnBackground (() => { try{ efm = new ExpenseFormManager (um.getId (), signature, remarks, notification, em.getExpenses ()); efm.setToken(um.getToken ()); efm.send (); em.deleteAllExpenses (); DeviceContext.DeviceContext.Current.RunOnForeground(() => { onSuccess(null); }); }catch(Exception ex){ DeviceContext.DeviceContext.Current.RunOnForeground(() => { onFail(ex); }); } }); }