private async void FlyoutLogInButtonClick(object sender, RoutedEventArgs e) { if (lUser.Text == "" || lPass.Password == "") { return; } flyoutPw.IsActive = true; var jnc = new JNClient(); var res = await jnc.Auth.Authenticate(lUser.Text.Trim(), lPass.Password); if (!res.Success) { var error = new MessageDialog("Login attempt failed! Check your username and password or try again later.", "Error!"); await error.ShowAsync(); return; } lUser.Text = ""; lPass.Password = ""; var key = "userAuth"; var roaming = ApplicationData.Current.RoamingSettings.Values; var token = JsonConvert.SerializeObject(res.Result); if (roaming.ContainsKey(key)) { roaming[key] = token; } else { roaming.Add(key, token); } flyoutPw.IsActive = false; flyoutLogInPanel.Visibility = Visibility.Collapsed; flyoutLogOutPanel.Visibility = Visibility.Visible; }
public static JNClient InstantiateClient() { var key = "userAuth"; var roaming = ApplicationData.Current.RoamingSettings.Values; JNClient jnc = null; if (roaming.ContainsKey(key)) { jnc = new JNClient(JsonConvert.DeserializeObject <AuthenticationToken>(roaming[key].ToString())); } else { jnc = new JNClient(); } return(jnc); }
public AuthAPI(JNClient client) { _client = client; }
public PostsAPI(JNClient client) { _client = client; }
public PartsAPI(JNClient client) { _client = client; }
public EventsAPI(JNClient client) { _client = client; }
public APIBase(JNClient client) { _client = client; }
public SeriesAPI(JNClient client) { _client = client; }