private void Add_Click(object sender, RoutedEventArgs e)
        {
            Character newCharacter = new Character();

            var nameWindow = new CharacterNameWindow();

            if (nameWindow.ShowDialog() == true)
            {
                var Tab = (RadioButton)this.TryFindResource("TabButton");
                Tab.Content = nameWindow.CharacterName;
                CharTabs.Children.Add(Tab);

                this.Hide();
                var creationWindow = new CharacterCreationWindow();
                if (creationWindow.ShowDialog() == true)
                {
                    newCharacter = creationWindow.character;

                    int newCharacterID;
                    db.CreateBlankCharacter(currentUser, nameWindow.CharacterName, out newCharacterID);
                    characterIDs.Add(newCharacterID);
                    newCharacter.ID   = newCharacterID;
                    newCharacter.Name = nameWindow.CharacterName;
                    db.SaveCharacter(new CharacterData(newCharacter));

                    this.Show();
                }
                else
                {
                    this.Close();
                }
            }
        }
示例#2
0
        private void OpenCaracterCreationExe(object obj)
        {
            var win = new CharacterCreationWindow()
            {
                DataContext = new CharacterCreationViewModel()
            };

            win.ShowDialog();
        }
        private Character New()
        {
            try
            {
                //Application.Current.MainWindow.Hide();
                Application.Current.MainWindow.IsEnabled = false;

                var newCharWin = new CharacterCreationWindow();
                newCharWin.ShowDialog();

                return(newCharWin.GetNewCharacter());
            }
            finally
            {
                //Application.Current.MainWindow.Show();
                Application.Current.MainWindow.IsEnabled = true;
            }
        }