示例#1
0
        private void AddInstanceButton_Click(object sender, RoutedEventArgs e)
        {
            NewEnemyInstanceWindow instWindow = new NewEnemyInstanceWindow(this.NewEnemyElement);
            var helper = new WindowInteropHelper(instWindow);
            helper.Owner = new WindowInteropHelper(this).Handle;
            bool? res = instWindow.ShowDialog();
            if (res != null && (bool)res)
            {

            }
            else
            {
               // MessageBox.Show("Did not add new enemy instance");
            }
            /*
             * NewEnemyWindow eneWindow = new NewEnemyWindow();
            var helper = new WindowInteropHelper(eneWindow);
            helper.Owner = new WindowInteropHelper(this).Handle;
            bool? res = eneWindow.ShowDialog();
            if (res != null && (bool)res)
            {
            }
            else
            {
                MessageBox.Show("Did not add new enemy");
            }
             */
        }
示例#2
0
        private void AddNewEnemyInstanceButton_Click(object sender, RoutedEventArgs e)
        {
            if (EnemyListBox.SelectedItem is XmlElement)
            {
                NewEnemyInstanceWindow instWindow = new NewEnemyInstanceWindow((XmlElement)EnemyListBox.SelectedItem);
                var helper = new WindowInteropHelper(instWindow);
                helper.Owner = new WindowInteropHelper(this).Handle;
                bool? res = instWindow.ShowDialog();
                if (res != null && (bool)res)
                {

                }
                else
                {
                    //MessageBox.Show("Did not add new enemy");
                }
            }
            else
            {
                MessageBox.Show("You must select ane enemy before adding an instance");
            }
        }