This method first requests the user to select the XML file (it can be in the standard Visio XML file format too) that contains the rule or rule sets to import from. It then iterates through the rule set and rule elements to add them to the selected VEDocument.
If it encounters a rule set with the same name as an existing rule set in the selected VEDocument
, then the user is prompted to overwrite or not.
Imported rule sets are immediately added to the Rules Explorer tree view.
public void ImportRuleSets() { try { string title = "RuleSets"; string shortName = System.IO.Path.GetFileNameWithoutExtension( this.document.FullName); string fileName = System.IO.Path.Combine( this.document.Path, shortName + ".xml"); 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 = "XML documents...