protected virtual void OnWordTyped(WordTypedEventArgs e) { EventHandler <WordTypedEventArgs> handler = WordTyped; if (handler != null) { handler(this, e); } }
private void Interceptor_WordTyped(object sender, WordTypedEventArgs e) { // add entry in dictionary if missing if (!typingTimes.ContainsKey(e.word)) { typingTimes.Add(e.word, new List <double>()); } // add the event to the collection for later analysis typingTimes[e.word].Add(e.typingTime); }
private void endWord() { if (currentWord.Length > 1) { var timeNow = getTimeNow(); var typingDuration = timeNow - startTimeStamp; var eventArgs = new WordTypedEventArgs() { word = currentWord.ToString(), typingTime = typingDuration }; OnWordTyped(eventArgs); } reset(); }