コード例 #1
0
        public void TestCleanup()
        {
            _userStorage       = null;
            _serverManager     = null;
            _sortedCountries   = null;
            _serverListFactory = null;

            _user      = null;
            _countries = null;
        }
コード例 #2
0
        public CountriesViewModel(
            IAppSettings appSettings,
            ServerListFactory serverListFactory,
            App app,
            IDialogs dialogs,
            ServerConnector serverConnector,
            CountryConnector countryConnector)
        {
            _appSettings       = appSettings;
            _serverListFactory = serverListFactory;
            _app              = app;
            _dialogs          = dialogs;
            _serverConnector  = serverConnector;
            _countryConnector = countryConnector;

            Connect                 = new RelayCommand <ServerItemViewModel>(ConnectAction);
            ConnectCountry          = new RelayCommand <IServerCollection>(ConnectCountryAction);
            Expand                  = new RelayCommand <IServerCollection>(ExpandAction);
            ToggleSecureCoreCommand = new RelayCommand(ToggleSecureCoreAction);
            ClearSearchCommand      = new RelayCommand(ClearSearchAction);
        }
コード例 #3
0
        public CountriesViewModel(
            IAppSettings appSettings,
            ServerListFactory serverListFactory,
            App app,
            ServerConnector serverConnector,
            CountryConnector countryConnector,
            QuickSettingsViewModel quickSettingsViewModel,
            IVpnReconnector vpnReconnector)
        {
            _appSettings       = appSettings;
            _serverListFactory = serverListFactory;
            _app                   = app;
            _serverConnector       = serverConnector;
            _countryConnector      = countryConnector;
            QuickSettingsViewModel = quickSettingsViewModel;
            _vpnReconnector        = vpnReconnector;

            Connect            = new RelayCommand <ServerItemViewModel>(ConnectAction);
            ConnectCountry     = new RelayCommand <IServerCollection>(ConnectCountryAction);
            Expand             = new RelayCommand <IServerCollection>(ExpandAction);
            ClearSearchCommand = new RelayCommand(ClearSearchAction);
        }
コード例 #4
0
        public void TestInitialize()
        {
            InitializeUserStorage();

            List <LogicalServerContract> servers = new List <LogicalServerContract>
            {
                CreateServer("IT#1", Features.None, "IT"),
                CreateServer("FR#1", Features.None, "FR"),
                CreateServer("CH#1", Features.None, "CH"),
                CreateServer("SE#1", Features.None, "SE"),
                CreateServer("IS#1", Features.None, "IS"),
                CreateServer("US-TX#1", Features.None, "US"),
                CreateServer("IT#2", Features.SecureCore, "IT", "SE"),
                CreateServer("FR#2", Features.SecureCore, "FR", "IS"),
                CreateServer("CH#2", Features.P2P, "CH"),
                CreateServer("CH#3", Features.Tor, "CH"),
                CreateServer("IS#2", Features.Tor, "IS"),
                CreateServer("US-TX#2", Features.P2P, "US")
            };

            _serverManager = Substitute.For <ServerManager>(_userStorage, servers);
            InitializeSortedCountries();
            _serverListFactory = new ServerListFactory(_serverManager, _userStorage, _sortedCountries);
        }
 public SelectAutoConnectViewModel(IServerProvider serverProvider, AppSettings appSettings, UserPreferences userPreferences, ServerListFactory serverListFactory, IEventAggregator eventAggregator) : base(userPreferences)
 {
     this._serverListFactory = serverListFactory;
     serverProvider.add_ServersChanged(new EventHandler(this.OnServersChanged));
     this._appSettings                      = appSettings;
     this._eventAggregator                  = eventAggregator;
     this.< GoBack > k__BackingField        = new RelayCommand(new Action(this.GoBackCommand));
     this.< SelectServer > k__BackingField  = new RelayCommand <ServerItemViewModel>(new Action <ServerItemViewModel>(this.SelectServerCommand));
     this.< SelectCountry > k__BackingField = new RelayCommand <ServersByCountryViewModel>(new Action <ServersByCountryViewModel>(this.SelectCountryCommand));
 }