/// <summary> /// Reload library collection into screen. /// </summary> private void Reload() { //add basic character into screen punctuationManager = new PunctuationCollection(); textManager = new TextCollection(); //hack: merge character into punctuation temp foreach (PathViewModel item in textManager.Items) punctuationManager.Items.Add(item); khotSpace.ItemsSource = punctuationManager.Items; wordManager = new WordCollection(); wordSpace.ItemsSource = wordManager.Items; this.statusText.Text = "Ready"; this.wordCount.Text = wordManager.Items.Count + " words"; this.richTextBox2.Document.Blocks.Clear(); }
/// <summary> /// Write counter into a file. /// </summary> /// <remarks> /// Count file name instead of name only. /// </remarks> /// <param name="wordCollection"></param> private void CountWord(WordCollection wordCollection) { Counter counter = new Counter(); TextCollection textCollection = new TextCollection(); PunctuationCollection punctuationCollection = new PunctuationCollection(); foreach (PathViewModel item in wordCollection.SelectedWords) { bool isText = textCollection.Items.Where(f => f.Name.ToLower().Contains(item.Name.ToLower())).Count() == 0 ? false : true; bool isPunctuation = punctuationCollection.Items.Where(f => f.Name.ToLower().Contains(item.Name.ToLower())).Count() == 0 ? false : true; if (!isText && !isPunctuation) { counter.Add(item.Name + item.Label); System.Diagnostics.Debug.WriteLine(item.Name + item.Label); } } counter.Store(); }