Importing rulesets from XML
This method first requests the user to select the XML file (this can be in the standard Visio XML file format too) which contains the ruleset or rulesets to import from. It then iterates through the ruleset and rule elements to add them to the selected
VEDocument
.
If it encounters a ruleset with the same name as an existing ruleset in the selected VEDocument
, then the user is prompted to overwrite or not.
Imported rulesets are immediately added to the Rules Explorer tree view.
public void ImportRuleSets()
{
try
{
string title = "RuleSets";
string fileName = "";
Microsoft.Win32.OpenFileDialog dlg =
new Microsoft.Win32.OpenFileDialog();
dlg.Title = "Import " + title;
dlg.InitialDirectory =
System.Environment.GetFolderPath(
System.Environment.SpecialFolder.MyDocuments);
dlg.DefaultExt = ".xml";
dlg.Filter =
...