//*******************************************************************
        // method: ReadWords()
        // description: Reads the dictionary information for each word from WordDefinitions.txt
        // returns: void
        //*******************************************************************
        public void ReadWords()
        {
            weaList = new List <WordEventArgs>();
            WordEventArgs wea;
            List <string> chunkList = new List <string>();
            List <string> lineList  = new List <string>();

            string executableLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //Get path to Debug folder
            string listPath           = Path.Combine(executableLocation, "WordDefinitions.txt");         //Slap the filename on the path
            //direct file variable to WordDefinitions.txt
            var file = File.ReadAllLines(listPath);

            lineList = new List <string>(file);

            for (int i = 0; i < lineList.Count; i++)
            {
                wea       = new WordEventArgs();
                chunkList = (lineList[i].Split('*').ToList());//split string by asterisk delimiter

                wea.Headword = chunkList[0];
                wea.Pos1     = chunkList[1];
                wea.Pron     = chunkList[2];
                wea.SemF     = chunkList[3];
                wea.SocU     = chunkList[4];
                wea.CR       = chunkList[5];
                wea.DefNum   = chunkList[6];
                wea.Pos2     = chunkList[7];
                wea.SDef     = chunkList[8];

                weaList.Add(wea);
            }
        }
  // This function parses in information from "WordDefinitions.txt" in the following format:
  // headword*pos1*pronunciation*semantic fields*social usage*
  // cross references*definition number*pos2*definition*short definition*
  public void readWordDefinitions()
        {
            char [] tokensMain = {'*'};
            char [] tokensSub = { ',' };
            string [] inputLine;
            string inputLineWhole;
            StreamReader sr;
            
            using (sr = new StreamReader("WordDefinitions.txt") )
            {
                while ((inputLineWhole = sr.ReadLine()) != null)
                {
                    // Container to read in our data.
                    WordEventArgs wea = new WordEventArgs(); 
                    
                    // Tokenize the line and read in each part of data.
                    inputLine = inputLineWhole.Split(tokensMain); 

                    wea.Headword = inputLine[0];
                    wea.Pos1 = inputLine[1];
                    wea.Pronunciation = inputLine[2];

                    wea.SemainticFields = inputLine[3].Split(tokensSub).ToList();
                    wea.SocialUsage = inputLine[4].Split(tokensSub).ToList();
                    wea.CrossReferences = inputLine[5].Split(tokensSub).ToList();

                    wea.DefinitionNumber = inputLine[6];
                    wea.Pos2 = inputLine[7];
                    wea.Definition = inputLine[8];
                    wea.ShortDefinition = inputLine[9];

                    dictWordInfoLine.Add(wea);  // Add the item, WordEventArgs to the list.
                }
            }
        } // End public void getHeadWordInfo()
        // This function responds to an event and updates the GUI fields with all the
        // the information needed from the WordEventArgs fields.
        private void setWordInformation(Object o, WordEventArgs wea)
        {
            // Change the color to red, sleep for a second, then change it back.
              Color originalColor = btn_wordsOnOff.BackColor;
              btn_wordsOnOff.BackColor = Color.Red;
              System.Threading.Thread.Sleep(1000);
              btn_wordsOnOff.BackColor = originalColor;

              // Change all the GUI fields to reflect the new word.
              cb_PartOfSpeech.SelectedIndex = cb_PartOfSpeech.FindString(wea.Pos1);
              tb_HeadWord.Text = wea.Headword;
              tb_Pronunciation.Text = wea.Pronunciation;
              tb_CrossReference.Lines = wea.CrossReferences.ToArray();

              // Set the selections for the semantic and socialUsage listboxes.
              // Select none if there is no listing.
              lb_Semantics.SelectedIndex = -1;
              lb_SocialUsage.SelectedIndex = -1;
              wea.SemainticFields.ForEach(delegate(string str)
              {
            lb_Semantics.SelectedItem = str;
              });
              wea.SocialUsage.ForEach(delegate(string str)
              {
            lb_SocialUsage.SelectedItem = str;
              });
        }
 protected virtual void OnWordEventArgsEvent(WordEventArgs wea)
 {
     if (WordEventArgsEvent != null)
       WordEventArgsEvent(this, wea);
 }
        // This function parses in information from "WordDefinitions.txt" in the following format:
        // headword*pos1*pronunciation*semantic fields*social usage*
        // cross references*definition number*pos2*definition*short definition*
        public void readWordDefinitions()
        {
            char [] tokensMain = {'*'};
            char [] tokensSub = { ',' };
            string [] inputLine;
            string inputLineWhole;
            StreamReader sr;

            using (sr = new StreamReader("WordDefinitions.txt") )
            {
                while ((inputLineWhole = sr.ReadLine()) != null)
                {
                    // Container to read in our data.
                    WordEventArgs wea = new WordEventArgs();

                    // Tokenize the line and read in each part of data.
                    inputLine = inputLineWhole.Split(tokensMain);

                    wea.Headword = inputLine[0];
                    wea.Pos1 = inputLine[1];
                    wea.Pronunciation = inputLine[2];

                    wea.SemainticFields = inputLine[3].Split(tokensSub).ToList();
                    wea.SocialUsage = inputLine[4].Split(tokensSub).ToList();
                    wea.CrossReferences = inputLine[5].Split(tokensSub).ToList();

                    wea.DefinitionNumber = inputLine[6];
                    wea.Pos2 = inputLine[7];
                    wea.Definition = inputLine[8];
                    wea.ShortDefinition = inputLine[9];

                    dictWordInfoLine.Add(wea);  // Add the item, WordEventArgs to the list.
                }
            }
        }
  }  // End public SpellCheck()   


  protected virtual void OnWordEventArgsEvent(WordEventArgs wea)
  {
    if (WordEventArgsEvent != null)
      WordEventArgsEvent(this, wea);
  }