示例#1
0
        public LoginWindowViewModel(UserControl view)
        {
            _view = view as LoginView;

            ForceRefresh = Settings.UserSettings.ContainsKey("ForceRefresh") ?
                           bool.Parse(Settings.UserSettings["ForceRefresh"]) : true;

            Email = Settings.UserSettings["AccountLogin"];

            if (!string.IsNullOrEmpty(Settings.UserSettings["AccountPassword"]))
            {
                _view.txtPassword.Password = string.Empty.PadLeft(8); //For the visuals
            }
            _view.txtPassword.PasswordChanged += new RoutedEventHandler(TxtPassword_PasswordChanged);
            PropertyChanged += LoginWindow_PropertyChanged;

            _characterInjector = new CharacterTabInjector();

            _statusController = new StatusController(_view.StatusBox);

            ApplicationState.Model.Authenticating += Model_Authenticating;
            ApplicationState.Model.Throttled      += Model_Throttled;
            ApplicationState.InitializeFont(Properties.Resources.fontin_regular_webfont);
            ApplicationState.InitializeFont(Properties.Resources.fontin_smallcaps_webfont);

            _statusController.DisplayMessage(ApplicationState.Version + " Initialized.\r");

            VersionChecker.CheckForUpdates();

            //Todo: Feed this in from a setting so that console players will have their preference remembered
            SelectedRealm = AvailableRealms.First();
        }
        private IEnumerable <Item> LoadCharacterInventoryItems(Character character, bool offline)
        {
            bool success;

            if (!offline)
            {
                statusController.DisplayMessage((string.Format("Loading {0}'s inventory...", character.Name)));
            }

            List <Item> inventory;

            try
            {
                inventory = ApplicationState.Model.GetInventory(character.Name);
                success   = true;
            }
            catch (WebException)
            {
                inventory = new List <Item>();
                success   = false;
            }

            CharacterTabInjector.Inject(character, inventory);
            updateStatus(success, offline);

            return(inventory);
        }
示例#3
0
        public LoginWindowViewModel(UserControl view)
        {
            this.view = view as LoginView;

            UseSession = Settings.UserSettings.ContainsKey("UseSessionID") ? bool.Parse(Settings.UserSettings["UseSessionID"]) : false;

            Email            = Settings.UserSettings["AccountLogin"];
            this.formChanged = string.IsNullOrEmpty(Settings.UserSettings["AccountPassword"]);

            if (!this.formChanged)
            {
                this.view.txtPassword.Password = string.Empty.PadLeft(8); //For the visuals
            }
            this.view.txtPassword.PasswordChanged += new System.Windows.RoutedEventHandler(txtPassword_PasswordChanged);

            characterInjector = new CharacterTabInjector();

            statusController = new StatusController(this.view.StatusBox);

            ApplicationState.Model.Authenticating += model_Authenticating;
            ApplicationState.Model.Throttled      += model_Throttled;
            ApplicationState.InitializeFont(Properties.Resources.fontin_regular_webfont);
            ApplicationState.InitializeFont(Properties.Resources.fontin_smallcaps_webfont);

            statusController.DisplayMessage(ApplicationState.Version + " Initialized.\r");

            VersionChecker.CheckForUpdates();
        }