示例#1
0
        /// <summary>
        /// Saves the custom XML parts that are used to persist the cells, scenarios and false positives.
        /// </summary>
        private void Workbook_BeforeSave(bool SaveAsUI, ref bool Cancel)
        {
            //Save the violations
            XMLPartManager.Instance.SaveXMLPart(this, new XElement(XName.Get("violations"), from p in this.Violations select p.ToXElement("violation")), "Violations");

            //Save the false positives
            XMLPartManager.Instance.SaveXMLPart(this, new XElement(XName.Get("ignoredviolations"), from p in this.IgnoredViolations select p.ToXElement("ignoredviolations")), "IgnoredViolations");

            // Save the later violations
            XMLPartManager.Instance.SaveXMLPart(this, new XElement(XName.Get("laterviolations"), from p in this.LaterViolations select p.ToXElement("laterviolation")), "LaterViolations");

            // Save the solved violations
            XMLPartManager.Instance.SaveXMLPart(this, new XElement(XName.Get("archivedviolations"), from p in this.SolvedViolations select p.ToXElement("archivedviolation")), "ArchivedViolations");

            // Save the scenarios
            XMLPartManager.Instance.SaveXMLPart(this, this.Accept(new ScenarioToXMLVisitor()) as XElement, "Scenario");

            // Save the cell definitions
            XMLPartManager.Instance.SaveXMLPart(this, this.Accept(new CellDefinitionToXMLVisitor()) as XElement, "CellDefinitions");

            // Save the policy configuration
            XElement polSettings = new XElement("policySettings");

            policySettings.saveXML(polSettings);
            XMLPartManager.Instance.SaveXMLPart(this, polSettings, "policySettings");
        }