Esempio n. 1
0
        /// <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();
        }
Esempio n. 2
0
        /// <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();
        }
Esempio n. 3
0
        /// <summary>
        /// Write into a svg file then increase the counter.
        /// </summary>
        /// <param name="wordCollection"></param>
        /// <returns></returns>
        public bool Write(WordCollection wordCollection)
        {
            bool done = false;
            if(fileExist) return done;

            CountWord(wordCollection);
            if (null != this.workspace) return done = WriteWorkspace();
            if (null != this.reader) return done = Cloning();
            return done;
        }