GitHubDashboard/Dashboard.cs
/// <summary>
/// Process the event information.  Here, we extract the ID so we don't process the same event multiple times.
/// We also get the repo URL and query the API for the repo's description and language, which are used to
/// populate the other two word clouds.
/// </summary>
/// <param name="html"></param>
Process the event information.  Here, we extract the ID so we don't process the same event multiple times.
We also get the repo URL and query the API for the repo's description and language, which are used to
populate the other two word clouds.
Process the event information . Here we extract the ID so we don ' t process the same event multiple times . We also get the repo URL and query the API for the repo ' s description and language which are used to populate the other two word clouds .
protected void ProcessEvents(string html)
		{
			dynamic events = JsonConvert.DeserializeObject<List<Object>>(html);
			foreach (dynamic ev in events)
			{
				string id = ev.id.ToString();
				if (!eventIdTypeMap.ContainsKey(id))
				{
					string eventType = ev.type.ToString();
					eventIdTypeMap[id] = eventType;
					string repoUrl = ev.repo.url.ToString();
					ElapseOneSecond();		
					string repoData = GetData(repoUrl);
					if (!String.IsNullOrEmpty(repoData))
					{
						dynamic repoInfo = JsonConvert.DeserializeObject(repoData);
						string description = repoInfo.description;
						string language = repoInfo.language;
						lock (this)
						{
							if (!String.IsNullOrEmpty(eventType)) ++totalEvents;
							AddOrUpdateNode(eventType, rootNodeEvents, eventsWordNodeMap, () => totalEvents);
							if (!String.IsNullOrEmpty(language)) ++totalLanguages;
							AddOrUpdateNode(language, rootNodeLanguages, languagesWordNodeMap, () => totalLanguages);
							if (!String.IsNullOrEmpty(description))
							{
								description.Split(' ').ForEach(w =>
									{
										if (!EliminateWord(w))
										{
											if (descriptionsWordNodeMap.Count > 100)
											{
												RemoveAStaleWord(descriptionsWordNodeMap);
											}
											if (!String.IsNullOrEmpty(w)) ++totalDescriptionWords;
											AddOrUpdateNode(w, rootNodeDescriptions, descriptionsWordNodeMap, () => totalDescriptionWords);
										}
									});
							}
						}
					}
				}
			}
		}
protected void ProcessEvents ( string html ) { dynamic events = JsonConvert . DeserializeObject < List < Object > > ( html ) ; foreach ( dynamic ev in events ) { string id = ev . id . ToString ( ) ; if ( ! eventIdTypeMap . ContainsKey ( id ) ) { string eventType = ev . type . ToString ( ) ; eventIdTypeMap [ id ] = eventType ; string repoUrl = ev . repo . url . ToString ( ) ; ElapseOneSecond ( ) ; string repoData = GetData ( repoUrl ) ; if ( ! String . IsNullOrEmpty ( repoData ) ) { dynamic repoInfo = JsonConvert . DeserializeObject ( repoData ) ; string description = repoInfo . description ; string language = repoInfo . language ; lock ( this ) { if ( ! String . IsNullOrEmpty ( eventType ) ) ++ totalEvents ; AddOrUpdateNode ( eventType , rootNodeEvents , eventsWordNodeMap , ( ) => totalEvents ) ; if ( ! String . IsNullOrEmpty ( language ) ) ++ totalLanguages ; AddOrUpdateNode ( language , rootNodeLanguages , languagesWordNodeMap , ( ) => totalLanguages ) ; if ( ! String . IsNullOrEmpty ( description ) ) { description . Split ( ' ' ) . ForEach ( w => { if ( ! EliminateWord ( w ) ) { if ( descriptionsWordNodeMap . Count > 100 ) { RemoveAStaleWord ( descriptionsWordNodeMap ) ; } if ( ! String . IsNullOrEmpty ( w ) ) ++ totalDescriptionWords ; AddOrUpdateNode ( w , rootNodeDescriptions , descriptionsWordNodeMap , ( ) => totalDescriptionWords ) ; } } ) ; } } } } } }
Process the event information.
Process the event information .
// TODO: Are we wanting to grow this infinitely? // Again, don't overtax the API. // Don't collide with the WinForm thread's Paint functions. // TODO: Could be optimized a bit to spend less time in the locked state. // We never show more than 100 description words.
html
string
None