private void btDeleteSelected_Click(object sender, RoutedEventArgs e)
        {
            if ((relDataGrid.SelectedItems.Count == 0) || (relDataGrid.SelectedItems[0].GetType() != typeof(Trait)))
            {
                return;
            }
            relDataGrid.EndEdit();
            foreach (Object item in relDataGrid.SelectedItems)
            {
                if ((_parentEntity.GetType() == typeof(Character)) &&
                    (((Trait)item).Name == "Name") &&
                    (numberOfNameTraits() == 1)
                    )
                {
                    Utilities.MakeErrorDialog("A \"Name\" attribute is required. Could not delete from shared traits list", this);
                }
                else if ((_parentEntity.GetType() == typeof(Environment)) &&
                         (((Trait)item).Name == "Name") &&
                         (numberOfNameTraits() == 1))
                {
                    Utilities.MakeErrorDialog("A \"Name\" attribute is required. Could not delete from shared traits list", this);
                }
                else
                {
                    newList.Remove((Trait)item);
                }
            }

            clearDataGrids();
            dataBind();
        }
예제 #2
0
        // Copy trait and keep trait type id to identify it as the same relationship elsewhere in the program
        public Relationship(Relationship anotherRel, StoryEntity originatingEntity, StoryData world)
        {
            UInt64 nullTargetId = 0;

            if (originatingEntity.GetType() == typeof(Character))
            {
                nullTargetId = Character.getNoOneCharacter().Id;
            }
            else if (originatingEntity.GetType() == typeof(Environment))
            {
                nullTargetId = Environment.getNoWhereEnvironment().Id;
            }

            Constructor(anotherRel.Name, originatingEntity.Id, nullTargetId, 0.0, anotherRel.TypeId, world);
        }
예제 #3
0
        // Copy trait and keep trait type id to identify it as the same relationship elsewhere in the program
        public Relationship(Relationship anotherRel, StoryEntity originatingEntity, StoryData world)
        {
            UInt64 nullTargetId = 0;
            if (originatingEntity.GetType() == typeof(Character))
            {
                nullTargetId = Character.getNoOneCharacter().Id;
            }
            else if (originatingEntity.GetType() == typeof(Environment))
            {

                nullTargetId = Environment.getNoWhereEnvironment().Id;
            }

            Constructor(anotherRel.Name, originatingEntity.Id, nullTargetId, 0.0, anotherRel.TypeId, world);
        }
        private void btOK_Click(object sender, RoutedEventArgs e)
        {
            relDataGrid.EndEdit();
            if (dataValid())
            {
                if (_parentEntity.GetType() == typeof(Character))
                {
                    Utilities.SynchronizeGlobalCharacterRelationships(_newList, _currentStoryData);
                }
                else if (_parentEntity.GetType() == typeof(Environment))
                {
                    Utilities.SynchronizeGlobalEnvironmentRelationships(_newList, _currentStoryData);
                }


                this.Close();
            }
        }