public async Task Login(string semail, string spassword)
 {
     var requestModel = new
                        {
                            email = semail,
                            password = spassword
                        };
     var request = new HttpClient().AcceptsJson();
     var result = await request.PostAsync(Endpoints.Session, new JsonContent(requestModel));
     var response = await JsonConvert.DeserializeObjectAsync<WebResponse<SessionWrapper>>(await result.Content.ReadAsStringAsync());
     try
     {
         if (response.Flash != null)
         {
             CloudsdaleWin7.Login.Instance.LoggingInUi.Visibility = Visibility.Hidden;
             CloudsdaleWin7.Login.Instance.LoginUi.Visibility = Visibility.Visible;
             CloudsdaleWin7.Login.Instance.ShowMessage(response.Flash.Message);
             return;
         }
         CurrentSession = response.Result.User;
         App.Settings["token"] = CurrentSession.AuthToken;
         App.Settings["id"] = CurrentSession.Id;
         InitializeClouds();
         RegistrationCheck();
     }
     catch
     {
         CloudsdaleWin7.Login.Instance.LoggingInUi.Visibility = Visibility.Hidden;
         CloudsdaleWin7.Login.Instance.LoginUi.Visibility = Visibility.Visible;
         CloudsdaleWin7.Login.Instance.ShowMessage(response.Flash != null ? response.Flash.Message : "Oops! An error occured that we couldn't seem to detect!");
     }
 }
 public void Logout()
 {
     FayeConnector.Socket.Close();
     FayeConnector.Socket.Closed += (sender, args) =>
     {
         App.Connection.MessageController.CloudControllers = new Dictionary<string, CloudController>();
         CurrentSession = null;
         App.Settings.Clear();
     };
     MainWindow.Instance.MainFrame.Navigate(new Login());
 }