コード例 #1
0
        /// <summary>
        /// Delete the profile currently signed in to the user quadrant
        /// quadrants referred to as 1, 2, 3, 4
        /// </summary>
        /// <param name="user">User number</param>
        public void DeleteProfile(int user)
        {
            // user must be 1, 2, 3 or 4
            if (user <= 0 || user > 4)
            {
                return;
            }

            ConsoleProfileViewItem profile = null;

            switch (user)
            {
            case 1: profile = this.Profile1;
                break;

            case 2: profile = this.Profile2;
                break;

            case 3: profile = this.Profile3;
                break;

            case 4: profile = this.Profile4;
                break;
            }

            if (profile == null)
            {
                return;
            }

            string deletedGamertag = profile.Profile.Gamertag;

            if (MessageBoxResult.Yes == MessageBox.Show(
                    "Delete profile " +
                    profile.Profile.ToString() + " from console "
                    + this.XboxName + "?",
                    "Certification Assistance Tool",
                    MessageBoxButton.YesNo))
            {
                // Remove the profile from our local list
                this.AllProfiles.Remove(profile);

                // Shuffle list off and back so any bound controls will update:
                // ObservableCollection<ConsoleProfile> tempProfileList = new ObservableCollection<ConsoleProfile>();
                // foreach (ConsoleProfile p in AllProfiles)
                //    tempProfileList.Add(p);
                // tempProfileList.AddRange(AllProfiles);
                // AllProfiles = tempProfileList;
                // NotifyPropertyChanged("AllProfiles");

                // delete the profile from the console
                try
                {
                    this.profilesManager.DeleteConsoleProfile(profile.Profile);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(
                        "There was a problem deleting profile " + profile.Profile + "\n\nException " + exception.Message,
                        "Certification Assistance Tool");
                }

                this.moduleContext.Log(" Deleted Profile " + deletedGamertag);

                this.UpdateAllStates();

                return;
            }
        }
コード例 #2
0
        /// <summary>
        /// ToggleSignInOut - toggles sign-in state of the user
        /// </summary>
        /// <param name="user">integer value 1, 2, 3 or 4</param>
        public void ToggleSignInOut(int user)
        {
            // user must be 1, 2, 3 or 4
            if (user <= 0 || user > 4)
            {
                return;
            }

            ConsoleProfileViewItem profile = null;

            switch (user)
            {
            case 1:
                if (this.profile1Busy)
                {
                    break;
                }

                profile = this.Profile1;
                break;

            case 2:
                if (this.profile2Busy)
                {
                    break;
                }

                profile = this.Profile2;
                break;

            case 3:
                if (this.profile3Busy)
                {
                    break;
                }

                profile = this.Profile3;
                break;

            case 4:
                if (this.profile4Busy)
                {
                    break;
                }

                profile = this.Profile4;
                break;
            }

            if (profile == null)
            {
                return;
            }

            // toggle sign-in state
            if (SignInState.NotSignedIn == profile.Profile.GetUserSigninState())
            {
                this.SignIn(user);
            }
            else
            {
                this.SignOut(user);
            }
        }