public void WriteBackEventArgs(ApiInformationChangedEventArgs arg) { maxCount = arg.ApiInfo.MaxCount; remainCount = arg.ApiInfo.RemainCount; resetTime = arg.ApiInfo.ResetTime; resetTimeInSeconds = arg.ApiInfo.ResetTimeInSeconds; usingCount = arg.ApiInfo.UsingCount; Raise_Changed(); }
private void Raise_Changed() { var arg = new ApiInformationChangedEventArgs(); if (Changed != null) { Changed(this, arg); } maxCount = arg.ApiInfo.MaxCount; remainCount = arg.ApiInfo.RemainCount; resetTime = arg.ApiInfo.ResetTime; resetTimeInSeconds = arg.ApiInfo.ResetTimeInSeconds; }
private void TwitterApiInfo_Changed(object sender, ApiInformationChangedEventArgs e) { SetStatusLabelApiLuncher(); }
private void Twitter_ApiInformationChanged(object sender, ApiInformationChangedEventArgs e) { }
public bool GetInfoApi(ApiInfo info) { if (AccountState != AccountState.Valid) { return true; } if (MyCommon.IsEnding) { return true; } HttpStatusCode res; string content = string.Empty; try { res = _twitterConnection.RateLimitStatus(ref content); } catch (Exception) { MyCommon.TwitterApiInfo.Initialize(); return false; } if (res != HttpStatusCode.OK) { return false; } try { var limit = D.CreateDataFromJson<RateLimitStatus>(content); var homeLimit = limit.ResourcesLimit.Statuses.HomeTimelime; var arg = new ApiInformationChangedEventArgs { ApiInfo = { MaxCount = homeLimit.Limit, RemainCount = homeLimit.Remaining, ResetTime = MyCommon.FromUnixTime(homeLimit.Reset), } }; if (info != null) { arg.ApiInfo.UsingCount = info.UsingCount; info.MaxCount = arg.ApiInfo.MaxCount; info.RemainCount = arg.ApiInfo.RemainCount; info.ResetTime = arg.ApiInfo.ResetTime; info.ResetTimeInSeconds = arg.ApiInfo.ResetTimeInSeconds; } if (ApiInformationChanged != null) { ApiInformationChanged(this, arg); } MyCommon.TwitterApiInfo.WriteBackEventArgs(arg); return true; } catch (Exception ex) { MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content); MyCommon.TwitterApiInfo.Initialize(); return false; } }