private JObject ProcessSignUp(JObject param) { JObject result = null; LogUtil.Default.Log("SignUp Request: " + param.ToString()); using (CeremonySQL ceremonySQL = new CeremonySQL()) { if (ceremonySQL.GetCeremonyStatus() == CeremonyStatus.CEREMONY_STATUS_WAITING) { if (ceremonySQL.reconnect().SignUpUser(param)) { result = BuildResponse(true); System.Windows.Application.Current.Dispatcher.Invoke(delegate { Window.RefreshView(); }); } else { result = BuildResponse(false, "Sign up failed."); } } else { result = BuildResponse(false, "Ceremony already has been started."); } } LogUtil.Default.Log("SignUp Response: " + result.ToString()); return(result); }
public void StartTimeInterval(int interval = PARTICIPANT_INTERVAL) { LogUtil.Default.Log("Interval: " + interval); StopTimeInterval(); Application.Current.Dispatcher.Invoke(delegate { RefreshView(); }); using (CeremonySQL ceremonySQL = new CeremonySQL()) { if (ceremonySQL.GetCeremonyStatus() != CeremonyStatus.CEREMONY_STATUS_STARTED) { return; } if (ceremonySQL.reconnect().GetUserIndex() == ceremonySQL.reconnect().GetSelectedUserIndex()) { return; } } dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Interval = new TimeSpan(interval / 3600, (interval % 3600) / 60, interval % 60); dispatcherTimer.Start(); Settings.Default.SendEmailToSelectedUser(); }
public bool StartCeremony() { using (CeremonySQL ceremonySQL = new CeremonySQL()) { if (ceremonySQL.GetCeremonyStatus() != CeremonyStatus.CEREMONY_STATUS_WAITING) { return(false); } if (!ceremonySQL.reconnect().StartCeremony()) { return(false); } } return(true); }