private void changeGame_Loaded(object sender, RoutedEventArgs e)
        {
            int gameCount = AccessHelper.GetGameCount();

            for (int i = 0; i < gameCount; i++)
            {
                changeGame.Items.Add(AccessHelper.GetGameZhName(i));
            }
            changeGame.Visibility = Visibility.Hidden;
            changeGameIsLoaded    = true;
        }
        private void UpdateWindow()
        {
            ZhName.IsEnabled = false;
            EnName.IsEnabled = false;
            ZhName.Text      = AccessHelper.GetGameZhName(gameIndex);
            EnName.Text      = AccessHelper.GetGameEnName(gameIndex);
            gameID           = AccessHelper.GetGameID(gameIndex);
            Pic.Source       = AccessHelper.GetGameImage(gameID);

            gameCount = AccessHelper.GetGameCount();
        }
Example #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            EventCenter.AddListener <string, string>(EventType.Login, UserLogin);
            EventCenter.AddListener(EventType.Logout, UserLogout);
            EventCenter.AddListener <string>(EventType.ViewDetail, ViewGameStorageInfo);
            EventCenter.AddListener <string>(EventType.ReleaseInfo, ReleaseGameStorageInfo);
            EventCenter.AddListener <string>(EventType.UpdateGameList, UpdateGameInfo);
            EventCenter.AddListener <string>(EventType.UpdateNickname, UpdateUserNickname);
            EventCenter.AddListener <string>(EventType.ViewMessage, ViewStorageMessage);
            EventCenter.AddListener <string>(EventType.EditRelease, EditUserRelease);

            userCenterBtn.Visibility  = Visibility.Hidden;
            viewReleaseBtn.Visibility = Visibility.Hidden;

            int gameCount = AccessHelper.GetGameCount();

            for (int i = 0; i < gameCount; i++)
            {
                MenuCenter.CreateGameInfo(list, i);
            }
        }
        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);
            }
        }