/// <summary>
 /// Checks whether the client can do the command, if it handles it</summary>
 /// <param name="tag">Command to be done</param>
 /// <returns>True iff client can do the command</returns>
 public bool CanDoCommand(object tag)
 {
     if (tag is Commands)
     {
         CharacterSettingsContext context = m_contextRegistry.GetActiveContext <CharacterSettingsContext>();
         return(context != null);
     }
     return(false);
 }
 /// <summary>
 /// Does the command</summary>
 /// <param name="tag">Command to be done</param>
 public void DoCommand(object tag)
 {
     switch ((Commands)tag)
     {
     case Commands.AddCharacter:
         CharacterSettingsContext context = m_contextRegistry.GetActiveContext <CharacterSettingsContext>();
         if (context != null)
         {
             context.DoTransaction(delegate
             {
                 context.Add();
             }, "Add New Character".Localize());
         }
         break;
     }
 }
Esempio n. 3
0
        private void contextRegistry_ActiveContextChanged(object sender, EventArgs e)
        {
            // make sure we're always tracking the most recently active EventSequenceContext
            StoryContext context = m_contextRegistry.GetMostRecentContext <StoryContext>();

            if (m_storyContext != context)
            {
                m_storyContext = context;
                Story story = m_storyContext.Cast <Story>();
                if (story.Settings == null)
                {
                    //DomNode node = new DomNode(Schema.settingsType.Type, Schema.storyType.settingsChild);
                    //story.Cast<DomNode>().SetChild(Schema.storyType.settingsChild, node);
                    story.Settings = Settings.New(Schema.storyType.settingsChild);
                }
                m_CharacterSettingsContext         = story.Settings.Cast <CharacterSettingsContext>();
                m_characteListViewAdapter.ListView = m_CharacterSettingsContext;
            }
        }
Esempio n. 4
0
 private void contextRegistry_ActiveContextChanged(object sender, EventArgs e)
 {
     // make sure we're always tracking the most recently active EventSequenceContext
     StoryContext context = m_contextRegistry.GetMostRecentContext<StoryContext>();
     if (m_storyContext != context)
     {
         m_storyContext = context;
         Story story = m_storyContext.Cast<Story>();
         if(story.Settings == null)
         {
             //DomNode node = new DomNode(Schema.settingsType.Type, Schema.storyType.settingsChild);
             //story.Cast<DomNode>().SetChild(Schema.storyType.settingsChild, node);
             story.Settings = Settings.New(Schema.storyType.settingsChild);
         }
         m_CharacterSettingsContext = story.Settings.Cast<CharacterSettingsContext>();
         m_characteListViewAdapter.ListView = m_CharacterSettingsContext;
     }
 }