コード例 #1
0
 public void AddRequirementsForIntent(ArrowElementSave element, ArrowIntentSave intent)
 {
     foreach (var component in intent.Components)
     {
         AddRequirementForComponent(element, component);
     }
 }
コード例 #2
0
        public ArrowElementSave Element()
        {
            TextInputWindow tiw = new TextInputWindow();

            tiw.Text = "Enter new element name:";

            List <string> intentNames = new List <string>();

            const string noIntent = "<NO INTENT>";

            intentNames.Add(noIntent);
            foreach (var item in ArrowState.Self.CurrentArrowProject.Intents)
            {
                intentNames.Add(item.Name);
            }



            var treeView = tiw.AddTreeView(intentNames);


            var result = tiw.ShowDialog();

            if (result.HasValue && result.Value)
            {
                ArrowElementSave toReturn = new ArrowElementSave();
                toReturn.Name = tiw.Result;
                ArrowProjectSave projectToAddTo = ArrowState.Self.CurrentArrowProject;

                if (treeView.SelectedItem as string != noIntent)
                {
                    toReturn.Intent = treeView.SelectedItem as string;

                    ArrowIntentSave intent = new ArrowIntentSave();
                    IntentManager.Self.AddRequirementsForIntent(toReturn, intent);
                }

                projectToAddTo.Elements.Add(toReturn);

                ArrowCommands.Self.File.SaveProject();
                ArrowCommands.Self.File.GenerateGlux();
                ArrowState.Self.CurrentArrowProjectVm.Refresh();

                return(toReturn);
            }
            else
            {
                return(null);
            }
        }