예제 #1
0
        private void OnUserStatsReceived(APITypes.UserStatsReceived param)
        {
            if (param.Result != 1)
            {
                this._GameStatusLabel.Text = string.Format(
                    CultureInfo.CurrentCulture,
                    "Error while retrieving stats: {0}",
                    TranslateError(param.Result));
                this.EnableInput();
                return;
            }

            if (this.LoadUserGameStatsSchema() == false)
            {
                this._GameStatusLabel.Text = "Failed to load schema.";
                this.EnableInput();
                return;
            }

            try
            {
                this.GetAchievements();
                this.GetStatistics();
            }
            catch (Exception e)
            {
                this._GameStatusLabel.Text = "Error when handling stats retrieval.";
                this.EnableInput();
                MessageBox.Show(
                    "Error when handling stats retrieval:\n" + e,
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            this._GameStatusLabel.Text = string.Format(
                CultureInfo.CurrentCulture,
                "Retrieved {0} achievements and {1} statistics.",
                this._AchievementListView.Items.Count,
                this._StatisticsDataGridView.Rows.Count);
            this.EnableInput();
        }
예제 #2
0
 private void OnUserStatsReceived(SAM.API.Types.UserStatsReceived param)
 {
     if (param.m_eResult != 1)
     {
         this.gameStatusLabel.Text = string.Format("Error while retrieving stats: {0}", (object)this.TranslateError(param.m_eResult));
         this.EnableInput();
     }
     else if (!this.LoadUserGameStatsSchema())
     {
         this.gameStatusLabel.Text = "Failed to load schema.";
         this.EnableInput();
     }
     else
     {
         this.GetAchievements();
         this.GetStatistics();
         this.gameStatusLabel.Text = string.Format("Retrieved {0} achievements and {1} statistics.", (object)this.achievementList.Items.Count, (object)this.statisticsList.Rows.Count);
         this.EnableInput();
     }
 }
예제 #3
0
        private void OnUserStatsReceived(APITypes.UserStatsReceived param)
        {
            if (param.Result != 1)
            {
                this._GameStatusLabel.Text = string.Format(ResourcesUI.GAME_STATUS_RETRIEVE_ERROR, param.Result.ToString());
                this.EnableInput();
                return;
            }

            if (this.LoadUserGameStatsSchema() == false)
            {
                this._GameStatusLabel.Text = ResourcesUI.GAME_STATUS_SCHEMA_ERROR;
                this.EnableInput();
                return;
            }

            try
            {
                this.GetAchievements();
                this.GetStatistics();
            }
            catch (Exception e)
            {
                this._GameStatusLabel.Text = ResourcesUI.GAME_STATUS_STATS_ERROR;
                this.EnableInput();
                MessageBox.Show(
                    ResourcesUI.GAME_STATUS_STATS_ERROR + "\n" + e,
                    "Steam Achievement Manager",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            this._GameStatusLabel.Text = string.Format(ResourcesUI.GAME_STATUS_RETRIEVE_MSG,
                                                       this._AchievementListView.Items.Count,
                                                       this._StatisticsDataGridView.Rows.Count);
            this.EnableInput();
        }
        private void OnUserStatsReceived(APITypes.UserStatsReceived param)
        {
            if (param.Result != 1)
            {
                this._GameStatusLabel.Text = string.Format(
                    "Error while retrieving stats: {0}",
                    TranslateError(param.Result));
                this.EnableInput();
                return;
            }

            if (this.LoadUserGameStatsSchema() == false)
            {
                this._GameStatusLabel.Text = "Failed to load schema.";
                this.EnableInput();
                return;
            }

            try
            {
                this.GetAchievements();
                this.GetStatistics();
            }
            catch (Exception e)
            {
                this._GameStatusLabel.Text = "Error when handling stats retrieval.";
                this.EnableInput();
                MessageBox.Show(
                    "Error when handling stats retrieval:\n" + e,
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            this._GameStatusLabel.Text = string.Format(
                "Retrieved {0} achievements and {1} statistics.",
                this._AchievementListView.Items.Count,
                this._StatisticsDataGridView.Rows.Count);
            this.EnableInput();


            if (isAutomatic)
            {
                // Check all.
                foreach (ListViewItem item in this._AchievementListView.Items)
                {
                    item.Checked = true;
                }

                if (this._AchievementListView.Items.Count == 0)
                {
                    Application.Exit();
                }

                // Store
                var achievements = new List <Stats.AchievementInfo>();
                foreach (ListViewItem item in this._AchievementListView.Items)
                {
                    var achievementInfo = item.Tag as Stats.AchievementInfo;
                    if (achievementInfo != null &&
                        achievementInfo.IsAchieved != item.Checked)
                    {
                        achievementInfo.IsAchieved = item.Checked;
                        achievements.Add(item.Tag as Stats.AchievementInfo);
                    }
                }

                if (achievements.Count == 0)
                {
                    Application.Exit();
                }

                foreach (Stats.AchievementInfo info in achievements)
                {
                    if (this._SteamClient.SteamUserStats.SetAchievement(info.Id, info.IsAchieved) == false)
                    {
                        Application.Exit();
                    }
                }

                // Done
                Application.Exit();
            }
        }