コード例 #1
0
        private void confirmBtn_Click(object sender, RoutedEventArgs e)
        {
            if (ZhName.Text == "" || EnName.Text == "")
            {
                MessageBox.Show("信息不完全!", "message", MessageBoxButton.OK);
            }
            else if (isEditing)
            {
                ZhName.IsEnabled        = false;
                EnName.IsEnabled        = false;
                addGameBtn.IsEnabled    = true;
                updateGameBtn.IsEnabled = true;
                deleteGameBtn.IsEnabled = true;
                confirmBtn.IsEnabled    = false;
                cancelBtn.IsEnabled     = false;

                AccessHelper.UpdateGameInfo(gameID, ZhName.Text, EnName.Text);
                isEditing = false;
                BrowseBtnsControl(true);
            }
            else if (isAdding)
            {
                ZhName.IsEnabled        = false;
                EnName.IsEnabled        = false;
                addGameBtn.IsEnabled    = true;
                updateGameBtn.IsEnabled = true;
                deleteGameBtn.IsEnabled = true;
                confirmBtn.IsEnabled    = false;
                cancelBtn.IsEnabled     = false;
                updatePicBtn.IsEnabled  = true;

                AccessHelper.AddGameInfo(ZhName.Text, EnName.Text);
                gameCount = AccessHelper.GetGameCount();
                gameIndex = gameCount - 1;

                UpdateWindow();
                isAdding = false;
                BrowseBtnsControl(true);
            }
        }