예제 #1
0
        private void btGoalFragEdit_Click(object sender, RoutedEventArgs e)
        {
            Object itemToEdit = goalFragsTreeView.SelectedItem;

            if (itemToEdit == null)
            {
                return;
            }


            if (itemToEdit.GetType() == typeof(AuthorGoal))
            {
                Window newWin = new WindowAuthorGoalEditor((AuthorGoal)itemToEdit, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();
            }
            else if (itemToEdit.GetType() == typeof(PlotFragment))
            {
                Window newWin = new WindowPlotFragmentEditor((PlotFragment)itemToEdit, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();
            }
            else if (itemToEdit.GetType() == typeof(ActionSubgoal))
            {
                //Find the parent plot fragment using its stored id, then use that plot fragment to look up
                //the parent author goal id, which is then used to get the actual AuthorGoal object (whew!)
                AuthorGoal goalToEdit = _currentStoryData.findAuthorGoalById(((ActionSubgoal)itemToEdit).SubGoalId);

                if (goalToEdit != null)
                {
                    Window newWin = new WindowAuthorGoalEditor(goalToEdit, _currentStoryData);
                    newWin.Owner = this;
                    newWin.ShowDialog();
                    clearDataElements();
                    dataBindWindow();
                }
            }
            else
            {
                return;
            }
        }
예제 #2
0
        private void btGoalFragNew_Click(object sender, RoutedEventArgs e)
        {
            List <string> editChoices = new List <string>();

            editChoices.Add("Author Goal");
            editChoices.Add("Plot Fragment");

            int result = -1;

            if (_currentStoryData.AuthorGoals.Count > 0)
            {
                result = Utilities.MakeListChoiceDialog("What type of Story Object would you like to create?", editChoices, this);
            }
            else
            {
                result = 0;
            }
            if (result < 0)
            {
                return;
            }
            else if (result == 0) //Author Goal
            {
                List <string> choiceConstraints = new List <string>();
                foreach (AuthorGoal goal in _currentStoryData.AuthorGoals)
                {
                    choiceConstraints.Add(goal.Name);
                }
                string newName = Utilities.MakeConstrainedTextDialog(
                    "Please enter a name for your new Author Goal:",
                    "That name is already in use by another Author Goal.",
                    choiceConstraints, this);

                if (newName == null)
                {
                    return;
                }

                AuthorGoal newAuthGoal = new AuthorGoal(newName, _currentStoryData);
                _currentStoryData.AuthorGoals.Add(newAuthGoal);
                //If first author goal, set it to the start goal
                if (_currentStoryData.AuthorGoals.Count == 1)
                {
                    _currentStoryData.StartGoalId = newAuthGoal.Id;
                }
                clearDataElements();
                dataBindWindow();

                Window newWin = new WindowAuthorGoalEditor(newAuthGoal, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();
            }
            else if (result == 1) //Plot Fragment
            {
                //Get parent author goal
                editChoices.Clear();
                foreach (AuthorGoal goal in _currentStoryData.AuthorGoals)
                {
                    editChoices.Add(goal.Description);
                }

                result = Utilities.MakeListChoiceDialog("Choose the Author Goal for this new Plot Fragment:", editChoices, this);
                if (result < 0)
                {
                    return;
                }

                AuthorGoal parentAuthorGoal = _currentStoryData.AuthorGoals[result];

                // Get name
                List <string> choiceConstraints = new List <string>();

                foreach (PlotFragment frag in parentAuthorGoal.PlotFragments)
                {
                    choiceConstraints.Add(frag.Name);
                }
                string newName = Utilities.MakeConstrainedTextDialog(
                    "Please enter a name for your new Plot Fragment:",
                    "That name is already in use by another Plot Fragment.",
                    choiceConstraints, this);

                if (newName == null)
                {
                    return;
                }


                PlotFragment newPlotFrag = new PlotFragment(newName, parentAuthorGoal.Id, _currentStoryData);
                parentAuthorGoal.PlotFragments.Add(newPlotFrag);

                clearDataElements();
                dataBindWindow();

                Window newWin = new WindowPlotFragmentEditor(newPlotFrag, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();
            }
        }
예제 #3
0
        private void btGoalFragNew_Click(object sender, RoutedEventArgs e)
        {
            List<string> editChoices = new List<string>();
            editChoices.Add("Author Goal");
            editChoices.Add("Plot Fragment");

            int result = -1;
            if(_currentStoryData.AuthorGoals.Count > 0)
                result = Utilities.MakeListChoiceDialog("What type of Story Object would you like to create?", editChoices, this);
            else
            {
                result = 0;
            }
            if(result < 0)
            {
                return;
            }
            else if(result == 0) //Author Goal
            {
                List<string> choiceConstraints = new List<string>();
                foreach (AuthorGoal goal in _currentStoryData.AuthorGoals)
                {
                    choiceConstraints.Add(goal.Name);

                }
                string newName = Utilities.MakeConstrainedTextDialog(
                    "Please enter a name for your new Author Goal:",
                    "That name is already in use by another Author Goal.",
                    choiceConstraints, this);

                if(newName == null)
                {
                    return;
                }

                AuthorGoal newAuthGoal = new AuthorGoal(newName, _currentStoryData);
                _currentStoryData.AuthorGoals.Add(newAuthGoal);
                //If first author goal, set it to the start goal
                if (_currentStoryData.AuthorGoals.Count == 1)
                {
                    _currentStoryData.StartGoalId = newAuthGoal.Id;
                }
                clearDataElements();
                dataBindWindow();

                Window newWin = new WindowAuthorGoalEditor(newAuthGoal, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();
            }
            else if(result == 1) //Plot Fragment
            {
                //Get parent author goal
                editChoices.Clear();
                foreach (AuthorGoal goal in _currentStoryData.AuthorGoals)
                {

                    editChoices.Add(goal.Description);
                }

                result = Utilities.MakeListChoiceDialog("Choose the Author Goal for this new Plot Fragment:", editChoices, this);
                if(result < 0)
                {
                    return;
                }

                AuthorGoal parentAuthorGoal = _currentStoryData.AuthorGoals[result];

                // Get name
                List<string> choiceConstraints = new List<string>();

                foreach (PlotFragment frag in parentAuthorGoal.PlotFragments)
                {
                    choiceConstraints.Add(frag.Name);

                }
                string newName = Utilities.MakeConstrainedTextDialog(
                    "Please enter a name for your new Plot Fragment:",
                    "That name is already in use by another Plot Fragment.",
                    choiceConstraints, this);

                if(newName == null)
                {
                    return;
                }

                PlotFragment newPlotFrag = new PlotFragment(newName, parentAuthorGoal.Id, _currentStoryData);
                parentAuthorGoal.PlotFragments.Add(newPlotFrag);

                clearDataElements();
                dataBindWindow();

                Window newWin = new WindowPlotFragmentEditor(newPlotFrag, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();

            }
        }
예제 #4
0
        private void btGoalFragEdit_Click(object sender, RoutedEventArgs e)
        {
            Object itemToEdit = goalFragsTreeView.SelectedItem;
            if (itemToEdit == null) { return;}

            if(itemToEdit.GetType() == typeof(AuthorGoal))
            {
                Window newWin = new WindowAuthorGoalEditor((AuthorGoal)itemToEdit, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();
            }
            else if (itemToEdit.GetType() == typeof(PlotFragment))
            {

                Window newWin = new WindowPlotFragmentEditor((PlotFragment)itemToEdit, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();
            }
            else if (itemToEdit.GetType() == typeof(ActionSubgoal))
            {
                //Find the parent plot fragment using its stored id, then use that plot fragment to look up
                //the parent author goal id, which is then used to get the actual AuthorGoal object (whew!)
                AuthorGoal goalToEdit = _currentStoryData.findAuthorGoalById(((ActionSubgoal)itemToEdit).SubGoalId);

                if(goalToEdit != null)
                {
                    Window newWin = new WindowAuthorGoalEditor(goalToEdit, _currentStoryData);
                    newWin.Owner = this;
                    newWin.ShowDialog();
                    clearDataElements();
                    dataBindWindow();
                }

            }
            else {

                return;
            }
        }