Example #1
0
        private void EditSpellCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ObservableCollection <Spell> cc = this[this.TabControl_Spellbook.SelectedIndex];

            if (this.GetSpellCollection(this.TabControl_Spellbook.SelectedIndex).SelectedItem is Spell s)
            {
                CreateSpellWindow csw = new CreateSpellWindow();
                csw.SetDataContext(s.Copy());
                if (csw.ShowDialog() ?? false)
                {
                    cc[this.GetSpellCollection(this.TabControl_Spellbook.SelectedIndex).SelectedIndex] = (Spell)csw.DataContext;
                }
            }
        }
Example #2
0
        private void NewSpellCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            Spell s = new Spell()
            {
                Level     = this.TabControl_Spellbook.SelectedIndex,
                ImageList = this.Images
            };

            CreateSpellWindow csw = new CreateSpellWindow();

            csw.SetDataContext(s);
            if (csw.ShowDialog() ?? false)
            {
                this[s.Level].Add(s);
            }
        }
Example #3
0
        public void Execute(object parameter)
        {
            if (parameter is SpellTemplate st)
            {
                Spell s = new Spell(st)
                {
                    ImageList = AppState.Current.TSpellbook.Images
                };

                CreateSpellWindow csw = new CreateSpellWindow();
                csw.SetDataContext(s);
                if (csw.ShowDialog() ?? false)
                {
                    AppState.Current.TSpellbook[s.Level].Add(s);
                }
            }
        }