Exemple #1
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);
            }
        }
Exemple #2
0
        internal void NewFile()
        {
            if (ArrowState.Self.CurrentArrowElementSave != null)
            {
                TextInputWindow tiw = new TextInputWindow();

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



                List <string> toAddToTreeView = new List <string>();
                toAddToTreeView.Add("Scene (.scnx)");
                tiw.AddTreeView(toAddToTreeView);

                var result = tiw.ShowDialog();

                if (result.HasValue && result.Value)
                {
                    SceneSave sceneSave = new SceneSave();
                    //    bool isInvalid = CheckAndShowMessageIfInvalid(tiw.Result);

                    //    if (!isInvalid)
                    //    {
                    //        SpriteSave spriteSave = new SpriteSave();
                    //        spriteSave.ScaleX = 16;
                    //        spriteSave.ScaleY = 16;
                    //        spriteSave.Name = tiw.Result;
                    //        spriteSave.ColorOperation = "Color";

                    //        spriteSave.TintRed = 255;
                    //        spriteSave.TintGreen = 255;

                    //        ArrowState.Self.CurrentArrowElementSave.Sprites.Add(spriteSave);

                    //        AfterAddLogic(ArrowState.Self.CurrentArrowElementSave, spriteSave);
                    //    }
                }
            }
        }