private void New_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     StateMachine sm = DataContext as StateMachine;
     if (e.Parameter is StateMachine)
     {
         StringQueryItem sqi = new StringQueryItem("Enter new state's name", "New State");
         StringQuery sq = new StringQuery();
         sq.DataContext = sqi;
         bool? result = sq.ShowDialog();
         if (result.Value)
         {
             State state = new State(sqi.Text);
             sm.addState(state);
         }
     }
 }
Exemple #2
0
 public void renameTemplate(ObjectBuilder template)
 {
     StringQueryItem qry = new StringQueryItem("Enter new name", "New Name", "NewName");
     StringQuery q = new StringQuery();
     q.DataContext = qry;
     bool? res = q.ShowDialog();
     if (res.Value)
     {
         template.Name = qry.Text;
     }
 }
Exemple #3
0
 public void registerMacroInScript(ObjectBuilder macro)
 {
     if (macro.IsRegistered)
     {
         System.Windows.MessageBox.Show("Macro is already registered!", "Error");
     }
     else if (macro == ObjectBuilder)
     {
         System.Windows.MessageBox.Show("Cannot register macro within itself!", "Error");
     }
     else
     {
         MacroRegistration macroReg = new MacroRegistration();
         StringQueryItem qry = new StringQueryItem("Enter new macro name", "New Macro", "Macro");
         StringQuery q = new StringQuery();
         q.DataContext = qry;
         bool? result = q.ShowDialog();
         if (result.Value)
         {
             macro.IsRegistered = true;
             macro.RegisteredName = qry.Text;
             macroReg.Name = qry.Text;
             macroReg.Script = macro;
             ObjectBuilder.ScriptObjects.Add(macroReg);
         }
     }
 }
Exemple #4
0
 public void newTemplate(ProjectFilter parent)
 {
     StringQueryItem qry = new StringQueryItem("Enter new template name", "New Template", "New");
     StringQuery q = new StringQuery();
     q.DataContext = qry;
     bool? result = q.ShowDialog();
     if (result.Value)
     {
         newTemplate(parent, qry.Text);
     }
 }
Exemple #5
0
 public GameObject newGameObject()
 {
     StringQueryItem qry = new StringQueryItem("Enter new GameObject name", "New GameObject", "New");
     StringQuery q = new StringQuery();
     q.DataContext = qry;
     bool? result = q.ShowDialog();
     if (result.Value)
     {
         GameObject go = ObjectBuilder.newGameObject(qry.Text);
         go.ParentObjectBuilder = ObjectBuilder;
         ObjectBuilder.Dirty = true;
         return go;
     }
     return null;
 }
        private void Rename_Executed_ProjectFile(object sender, ExecutedRoutedEventArgs e)
        {
            App app = (App)App.Current;
            if (e.Parameter is IProjectElement)
            {
                IProjectElement element = e.Parameter as IProjectElement;
                element.Editable = true;
                StringQuery querry = new StringQuery();
                StringQueryItem qry = new StringQueryItem("Enter the new name", "Rename", element.Name);
                querry.DataContext = qry;
                bool? result = querry.ShowDialog();
                if (result.HasValue && result.Value)
                {
                    element.Name = qry.Text;

                    // TODO check if Template already open
                    ObjectBuilder template = app.openTemplate(element.Name);
                    int index = element.Name.LastIndexOf(".");
                    String templateName = element.Name.Substring(0, index);
                    index = templateName.LastIndexOfAny(new char[] { '\\', '/' });
                    templateName = templateName.Substring(index);
                    template.Name = template.Name;
                    app.saveTemplate(template, true);
                }
                //app.renameProjectItem(element);
            }
            else if (sender is TreeView)
            {
                TreeView tv = sender as TreeView;
                IProjectElement projectElement = tv.SelectedItem as IProjectElement;
                projectElement.Editable = true;
                //app.renameProjectItem(tv.SelectedItem as IProjectElement);
            }
        }