private async void StartAuthHardshake() { _areWeTwitAuthed = false; this._auth = await TwitterInteract.GetAuth(); _areWeTwitAuthed = true; }
private async void StartRequestSequence() { var companymash = CompanyFor.Text.ToLower(); var companiesList = new List <string>(); if (companymash.Contains("+")) { foreach (var company in companymash.Split('+')) { companiesList.Add(company); } } else { companiesList.Add(companymash); } FadeResultsOut.Begin(); _currentResultItems.Clear(); //empty the bottle, reset companies var _tempCurrentResultItems = new List <SummaryReturn.Root>(); var _tempCurrentResultItem = new SummaryReturn.Root(); foreach (var company in companiesList) { _tempCurrentResultItem = (await mdc.Services.ApiInteract.GetSummaryDecoded(company))[0]; //just grab first copy of the company, no dupes. _tempCurrentResultItem.tweets_popular = new List <SummaryReturn.Tweet>(); if (_areWeTwitAuthed) { var tweetObjects = await TwitterInteract.Search(_auth, company, ResultType.Popular); //grab tweets foreach (var tweet in tweetObjects.Statuses) //mash tweets into the root article object { _tempCurrentResultItem.tweets_popular.Add(new SummaryReturn.Tweet { text = tweet.Text, timestamp = tweet.CreatedAt, username = tweet.User.Name }); } } else { Debug.WriteLine("Error, Still Authorising with TW"); _tempCurrentResultItem.tweets_popular.Add(new SummaryReturn.Tweet { text = "Still waiting for Token from Twitter", timestamp = DateTime.Now, username = "******" }); } _tempCurrentResultItems.Add(_tempCurrentResultItem); //mash back together into one list of above } foreach (var item in _tempCurrentResultItems) //strip out nulls { if (item.mission_statement_investigator == null) { item.mission_statement_investigator = "Not Verified!"; } if (item.mission_statement_proof == null) { item.mission_statement_proof = "N/A"; } //remove from view? } //TextBlockDump.Text = string.Concat("RAW Json output:\n", await mdc.Services.ApiInteract.GetSummaryRaw(company.Split('+')[0])); _currentResultItems = _tempCurrentResultItems; ResultItemsControl.ItemsSource = CurrentResultItems; FadeResultsIn.Begin(); }