public OAuthToken GetOAuth() { var localSettings = ApplicationData.Current.LocalSettings; OAuthToken o = new OAuthToken(); ImgurUser u = new ImgurUser(); try { u.Bio = (string)localSettings.Values["User_Bio"]; u.Created = (int)localSettings.Values["User_Created"]; u.Id = (int)localSettings.Values["User_Id"]; u.Pro = (int)localSettings.Values["User_Pro"]; u.Rep = (float)localSettings.Values["User_Rep"]; u.Url = (string)localSettings.Values["User_Url"]; o.Authenticated = (bool)localSettings.Values["Authenticated"]; o.Expires = DateTime.FromBinary((long)localSettings.Values["Expires"]); o.RefreshToken = (string)localSettings.Values["RefreshToken"]; o.Token = (string)localSettings.Values["Token"]; o.User = u; BuisnessLayer.BLImgurAPI bl = new BuisnessLayer.BLImgurAPI(); u = bl.logIn(u.Url, o.Token); o.User = u; } catch { o = new OAuthToken(); u = new ImgurUser(); o.User = u; } return o; }
private DataLayer.ImgurUser logIn(string username, String OAuth = null) { DataLayer.ImgurUser user; //------------------------ HttpClient client = GetHttpClient(OAuth); string URI = BaseURL; URI += "account/" + username + ".json"; var jsonStr = client.GetStringAsync(URI).Result; JsonObject json = new JsonObject(); JsonObject.TryParse(jsonStr, out json); //TODO: Process JSON user = new DataLayer.ImgurUser(); // user.id = ... // etc... // throw new Exception("Method not implemented yet"); // return logged in user: return(user); }
private DataLayer.ImgurUser logIn(string username, String OAuth = null) { DataLayer.ImgurUser user; //------------------------ HttpClient client = GetHttpClient(OAuth); string URI = BaseURL; URI += "account/" + username + ".json"; var jsonStr = client.GetStringAsync(URI).Result; JsonObject json = new JsonObject(); JsonObject.TryParse(jsonStr, out json); //TODO: Process JSON user = new DataLayer.ImgurUser(); // user.id = ... // etc... // throw new Exception("Method not implemented yet"); // return logged in user: return user; }