public FormMain()
        {
            InitializeComponent();

            using (FormUserSelection formUserSelection = new FormUserSelection()) {
                formUserSelection.ShowDialog(this);

                if (formUserSelection.DialogResult == DialogResult.OK) {
                    this.userProfiles = formUserSelection.userProfiles;
                    this.currentUser = formUserSelection.selectedUser;
                    this.selectedUser = true;

                    this.dataManager = new DataManager(currentUser);
                    this.entityManager = new EntityManager(currentUser);

                    this.currentUser.applicationSettingsField = dataManager.ReadUserSettingsFile(this.currentUser);

                    if (this.currentUser.applicationSettingsField.DefaultsRestored) {
                        dataManager.SaveUserSettings();

                        this.currentUser.applicationSettingsField.DefaultsRestored = false;
                    }
                }
            }
        }
        /// <summary>
        /// Gets the user's league
        /// </summary>
        /// <param name="user">User</param>
        /// <returns>League object</returns>
        private static HTEntities.WorldDetails.League GetLeague(User user)
        {
            EntityManager entityManager = new EntityManager(user);

            HTEntities.WorldDetails.WorldDetails worldDetails = entityManager.GetWorldDetails();
            HTEntities.TeamDetails.TeamDetails teamDetails = entityManager.GetTeamDetails();
            uint leagueId = teamDetails.teamField.leagueField.leagueIdField;
            return worldDetails.leagueListField.Single(l => l.leagueIdField == leagueId);
        }
 public FormDownload(HMEntities.UserProfiles.User currentUser)
 {
     InitializeComponent();
     this.currentUser = currentUser;
     this.downloadManager = new DownloadManager(currentUser);
     this.entityManager = new EntityManager(currentUser);
     this.dataManager = new DataManager(currentUser);
     downloadManager.ChppDownloadProgressChanged += new ChppDownloadProgressChangedEventHandler(OnChppDownloadProgressChanged);
 }
        public PlayerList(User user)
        {
            InitializeComponent();

            this.user = user;

            if (user != null) {
                this.entityManager = new EntityManager(user);
                this.dataManager = new DataManager(user);
                this.entityInterface = new Entities.EntityInterface(user);
                this.players = entityManager.GetPlayersDetails();
            }
        }