/// <summary>
        /// Initializes a new instance of the LicensePageModel class.
        /// </summary>
        /// <param name="servers">Collection of servers to provide separate
        /// authentication for.</param>
        /// <param name="messenger">The messenger object to be used for
        /// notifications.</param>
        /// <param name="workingStatusController">The object to be used for
        /// managing application working status.</param>
        /// <param name="uriNavigator">The reference to the object to be used
        /// for navigating to URI's.</param>
        public LicensePageModel(
            IEnumerable <AgsServer> servers,
            IMessenger messenger,
            IWorkingStatusController workingStatusController,
            IUriNavigator uriNavigator,
            ILicenseManager licenseManager)
        {
            Debug.Assert(servers != null);
            Debug.Assert(servers.All(server => server != null));
            Debug.Assert(messenger != null);
            Debug.Assert(workingStatusController != null);
            Debug.Assert(licenseManager != null);

            _licenseManager           = licenseManager;
            _licenseExpirationChecker = _licenseManager.LicenseExpirationChecker;

            var items = new ObservableCollection <LoginViewModelBase>();

            var licensingViewModel = new LicensingViewModel(
                messenger,
                workingStatusController,
                uriNavigator,
                licenseManager);

            this.RequiresExpirationWarning      = licensingViewModel.RequiresExpirationWarning;
            licensingViewModel.PropertyChanged += delegate
            {
                this.RequiresExpirationWarning = licensingViewModel.RequiresExpirationWarning;
                _UpdateCompletedState();
            };

            items.Add(licensingViewModel);

            _servers = servers.ToList();
            foreach (var server in _servers)
            {
                items.Add(new ArcGisServerLoginViewModel(
                              server,
                              messenger,
                              workingStatusController));
                server.StateChanged += delegate
                {
                    _UpdateCompletedState();
                };
            }

            this.LoginViewModels = new ReadOnlyObservableCollection <LoginViewModelBase>(items);
            _UpdateCompletedState();
            _UpdateLoggedInState();

            foreach (var vm in this.LoginViewModels)
            {
                vm.LoginState.LoginViewHost = this;
                vm.PropertyChanged         += delegate
                {
                    _UpdateLoggedInState();
                };
            }
        }
        /// <summary>
        /// Initializes a new instance of the LicensePageModel class.
        /// </summary>
        /// <param name="servers">Collection of servers to provide separate
        /// authentication for.</param>
        /// <param name="messenger">The messenger object to be used for
        /// notifications.</param>
        /// <param name="workingStatusController">The object to be used for
        /// managing application working status.</param>
        /// <param name="uriNavigator">The reference to the object to be used
        /// for navigating to URI's.</param>
        public LicensePageModel(
            IEnumerable<AgsServer> servers,
            IMessenger messenger,
            IWorkingStatusController workingStatusController,
            IUriNavigator uriNavigator,
            ILicenseManager licenseManager)
        {
            Debug.Assert(servers != null);
            Debug.Assert(servers.All(server => server != null));
            Debug.Assert(messenger != null);
            Debug.Assert(workingStatusController != null);
            Debug.Assert(licenseManager != null);

            _licenseManager = licenseManager;
            _licenseExpirationChecker = _licenseManager.LicenseExpirationChecker;

            var items = new ObservableCollection<LoginViewModelBase>();

            var licensingViewModel = new LicensingViewModel(
                messenger,
                workingStatusController,
                uriNavigator,
                licenseManager);
            this.RequiresExpirationWarning = licensingViewModel.RequiresExpirationWarning;
            licensingViewModel.PropertyChanged += delegate
            {
                this.RequiresExpirationWarning = licensingViewModel.RequiresExpirationWarning;
                _UpdateCompletedState();
            };

            items.Add(licensingViewModel);

            _servers = servers.ToList();
            foreach (var server in _servers)
            {
                items.Add(new ArcGisServerLoginViewModel(
                    server,
                    messenger,
                    workingStatusController));
                server.StateChanged += delegate
                {
                    _UpdateCompletedState();
                };
            }

            this.LoginViewModels = new ReadOnlyObservableCollection<LoginViewModelBase>(items);
            _UpdateCompletedState();
            _UpdateLoggedInState();

            foreach (var vm in this.LoginViewModels)
            {
                vm.LoginState.LoginViewHost = this;
                vm.PropertyChanged += delegate
                {
                    _UpdateLoggedInState();
                };
            }
        }