0

I have a tool which looks for phrases in a document and gives the count. I have those phrases in xml. I am using hashtable concept for this. I keep getting more and more phrases to add to xml every time. So now i want the controls to be created whn i add a phrase to xml at runtime. My UI has check boxex for each phrase where i can check whichever phrase i want to. I dint find any example relevent to this. Here is part of the code where i use my phrases.

Hashtable _optionTable = null;
            Hashtable _optionOccuranceTable = null;
            if (optionBox.Checked == true)
                ProcessNode(usrXmldoc, "Option", out _optionTable, out _optionOccuranceTable, oWord, oDoc);



                            Hashtable _QualityPhraseTable = null;
            Hashtable _QualityPhraseOccuranceTable = null;
            if (qualityBox.Checked == true)
                ProcessNode(usrXmldoc, "QualityPhrase", out _QualityPhraseTable, out _QualityPhraseOccuranceTable, oWord, oDoc);


            Hashtable _DirectiveTable = null;
            Hashtable _DirectiveOccuranceTable = null;
            if (directiveBox.Checked == true)
                ProcessNode(usrXmldoc, "Directive", out _DirectiveTable, out _DirectiveOccuranceTable, oWord, oDoc);


             Hashtable _ContinuanceTable = null;
            Hashtable _ContinuanceOccuranceTable = null;
            if (continuanceBox.Checked == true)
                ProcessNode(usrXmldoc, "Continuance", out _ContinuanceTable, out _ContinuanceOccuranceTable, oWord, oDoc);



                            This is the XML part



   string usrXmlConfigFile = CurrentDirectory + "\\Dictionary.xml";
   FileStream usrFs = new FileStream(usrXmlConfigFile, FileMode.Open, FileAccess.Read,
                           FileShare.ReadWrite);
    XmlDocument usrXmldoc = new XmlDocument();
                    usrXmldoc.Load(usrFs);
user1665707
  • 615
  • 3
  • 11
  • 24

1 Answers1

0

You can use a FileSystemWatcher to know whenever the xml file has changed, as in this example.

The read and parse the xml file, as in this example.

Finally, add controls dinamically in winforms, as in this example.

Community
  • 1
  • 1
JoanComasFdz
  • 2,911
  • 5
  • 34
  • 50