コード例 #1
0
        internal void OnCheckModelValidity(object sender, EventArgs e)
        {
            ValidationController controller = this.CurrentData.ValidationController;
            ValidationCategory   category   = ValidationCategory.Menu;

            bool isValid = controller.Validate(this.CurrentData.Store, category);

            bool errorsOccurred = false;

            foreach (ValidationMessage message in controller.ValidationMessages)
            {
                if (message.Type == ViolationType.Error)
                {
                    errorsOccurred = true;
                    break;
                }
            }

            if (errorsOccurred)
            {
                System.Windows.Forms.MessageBox.Show("Cannot generate XML from model: There were validation errors!", "Model Invalidity", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                Microsoft.VisualStudio.Modeling.Diagrams.Diagram diagram = this.CurrentView.CurrentDiagram;
                ISpySoft.FeatureModelLanguage.Designer.Custom.XmlFileGenerator xmlFileGenerator = new ISpySoft.FeatureModelLanguage.Designer.Custom.XmlFileGenerator();
                xmlFileGenerator.GenerateXmlFile(diagram);
            }
        } // OnCheckModelValidity
コード例 #2
0
        } // OnCheckModelValidity

        internal void OnMenuGenerateXmlFromModel(object sender, EventArgs e)
        {
            Microsoft.VisualStudio.Modeling.Diagrams.Diagram diagram = this.CurrentView.CurrentDiagram;
            ISpySoft.FeatureModelLanguage.Designer.Custom.XmlFileGenerator xmlFileGenerator = new ISpySoft.FeatureModelLanguage.Designer.Custom.XmlFileGenerator();
            xmlFileGenerator.GenerateXmlFile(diagram);
        }