public AdHocForm(AccessToken token, Uri apiRoot) { InitializeComponent(); _client = new Client(token, apiRoot); _client.SymbolSuggestCompleted += client_SymbolSuggestCompleted; _client.GetSymbolCompleted += client_GetSymbolCompleted; _client.GetQuotesCompleted += client_GetQuotesCompleted; _client.SymbolNotFound += client_SymbolNotFound; }
void MFABrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e) { const string urlToken = "?code="; string url = e.Url.ToString(); if (url.ToLower().Contains(urlToken)) { string tokenValue = url.Substring(url.IndexOf(urlToken) + urlToken.Length); AccessToken token = new AccessToken(); token.Token = tokenValue; OnAccessTokenReceived(this, new AccessTokenReceivedArgs(token)); MFABrowser.Stop(); Close(); } }
public AccessTokenReceivedArgs(AccessToken token) { Token = token; }
internal static BarChartDataListener InitBarchartListener(Uri root, AccessToken token) { return new BarChartDataListener { ApiRoot = root, Token = token }; }
internal static QuoteListener InitQuoteListener(Uri root, AccessToken token) { return new QuoteListener { ApiRoot = root, Token = token }; }
void f_AccessTokenReceived(object sender, AccessTokenReceivedArgs args) { string authToken = args.Token.Token; token = Authorization.GetAccessToken(settings.ApiUri, authToken, settings.ClientId, settings.ClientSecret, settings.RedirectUri); lblConnectedUser.Text = token.UserId; lblStatus.Text = "Connected"; lblStatus.ForeColor = Color.Green; EnableFormButtons(true); }
public QuoteSnapshotForm(AccessToken token, Uri apiRoot) { InitializeComponent(); _client = new Client(token, apiRoot); }
public AuthorizedEventArgs(AccessToken token) { Token = token; }
public bool Equals(AccessToken token) { return this == token; }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { // {"access_token":"dG1..9","expires_in":1200,"token_type":"AccessToken","userid":"bbowen"} AccessToken token = new AccessToken(); while (reader.Read()) { if (reader.Value != null) { switch (reader.Value.ToString()) { case "access_token": if (reader.Read()) token.Token = reader.Value.ToString(); break; case "expires_in": if (reader.Read()) { int test; int.TryParse(reader.Value.ToString(), out test); token.ExpiresIn = test; } break; case "token_type": if (reader.Read()) token.Type = reader.Value.ToString(); break; case "userid": if (reader.Read()) token.UserId = reader.Value.ToString(); break; default: reader.Read(); break; } } else break; } return token; }
public void RefreshToken(AccessToken token) { Token = token; }
public Client(AccessToken token, Uri apiRoot, int sleepTime = SleepDefault) { Token = token; root = apiRoot; this.sleepTime = sleepTime; }
public Client(AccessToken token, WebAPIEnvironment environment, int sleepTime = SleepDefault) : this(token, WebAPILocation.WebAPIEnvironments.First(e => e.Name == environment).Location, sleepTime) { }
public bool Equals(AccessToken token) { return(this == token); }