コード例 #1
0
        /// <inheritdoc/>
        public DynamicServerListLoadBalancer(string name, IRule rule, IPing ping, IServerList <Server> serverList, IServerListUpdater serverListUpdater, IServerListFilter <Server> serverListFilter, ILoadBalancerSettings settings, ILogger logger = null) : base(name, rule, ping, settings, logger)
        {
            _serverList        = serverList;
            _serverListUpdater = serverListUpdater;
            _serverListFilter  = serverListFilter;

            UpdateListOfServersAsync().GetAwaiter().GetResult();
            if (serverListUpdater != null)
            {
                var updateProcessing = false;
                serverListUpdater.Start(async() =>
                {
                    if (updateProcessing)
                    {
                        return;
                    }

                    updateProcessing = true;

                    try
                    {
                        await UpdateListOfServersAsync();
                    }
                    finally
                    {
                        updateProcessing = false;
                    }
                });
            }
        }
コード例 #2
0
 public Executor(
     IServerList windowsServers,
     ISqlServerList sqlServers,
     ISqlServerVersionMap sqlServerVersionMap,
     IReportSink sink)
 {
     m_WindowsServers      = windowsServers;
     m_SqlServers          = sqlServers;
     m_SqlServerVersionMap = sqlServerVersionMap;
     m_Sink = sink;
 }
コード例 #3
0
        public ServerLibrarySetup(ServerLibraryViewModel library, IServerList serverList)
        {
            _library     = library;
            _serverList  = serverList;
            BuiltInGroup = new ServerLibraryGroupViewModel(library, null)
            {
                IsRoot = true, SortOrder = 0
            };

            _builtinFeatured =
                new ServerLibraryItemViewModel <BuiltInServerContainer>(library, new BuiltInServerContainer("Featured"),
                                                                        new CleanServerFilter(), null,
                                                                        SixIconFont.withSIX_icon_Ribbon, BuiltInGroup, true)
            {
                IconForeground = SixColors.SixOrange,
                IsRoot         = true,
                SortOrder      = 7,
                IsHead         = true
            };
            _builtinFavorites =
                new ServerLibraryItemViewModel <BuiltInServerContainer>(library, new BuiltInServerContainer("Favorites"),
                                                                        new CleanServerFilter(), null,
                                                                        SixIconFont.withSIX_icon_Star, BuiltInGroup, true)
            {
                IconForeground = SixColors.SixOrange,
                IsRoot         = true,
                SortOrder      = 8
            };
            _builtinRecent =
                new ServerLibraryItemViewModel <BuiltInServerContainer>(library, new BuiltInServerContainer("Recent"),
                                                                        new CleanServerFilter(), null,
                                                                        SixIconFont.withSIX_icon_Clock, BuiltInGroup, true)
            {
                IsRoot = true, SortOrder = 9
            };

            Groups = new LibraryGroupViewModel <ServerLibraryViewModel>[] { null, BuiltInGroup };

            if (serverList != null)
            {
                Setup();
            }

            Items.AddRange(Groups.Where(x => x != null && x != BuiltInGroup));
            CreateItemsView();
        }
コード例 #4
0
 public WindowsServerUpdateGatherer(IServerList servers)
 {
     m_Servers = servers.Servers;
 }
コード例 #5
0
        public ServerLibraryViewModel(Game game, Lazy <ServersViewModel> serversVm, IContentManager contentList,
                                      IServerList serverList, LaunchManager launchManager, IDialogManager dialogManager, ISpecialDialogManager specialDialogManager)
        {
            _serversVm            = serversVm;
            _contentList          = contentList;
            Settings              = DomainEvilGlobal.Settings;
            _launchManager        = launchManager;
            ServerList            = serverList;
            _dialogManager        = dialogManager;
            _specialDialogManager = specialDialogManager;

            SearchItem = new SearchServerLibraryItemViewModel(this, new CleanServerFilter());

            this.SetCommand(x => x.JoinServ);
            JoinServ.RegisterAsyncTask(
                x => JoinServer((Server)x))
            .Subscribe();

            this.SetCommand(x => x.ServerInfoCommand).Cast <Server>().Subscribe(ServerInfo);
            UpdateCommand = UiTaskHandlerExtensions.CreateCommand("UpdateCommand", true, true);
            UpdateCommand.RegisterAsyncTaskVoid <Server>(UpdateServer).Subscribe();
            this.SetCommand(x => x.ResetFiltersCommand).Subscribe(RefreshFilter);
            this.SetCommand(x => x.Note).Cast <Server>().Subscribe(ShowNotes);

            ViewType = Settings.ServerOptions.ViewType;
            this.ObservableForProperty(x => x.ViewType)
            .Select(x => x.Value)
            .BindTo(Settings, s => s.ServerOptions.ViewType);

            this.WhenAnyValue(x => x.ActiveItem)
            .Skip(1)
            .Subscribe(x => game.CalculatedSettings.Server = x);

            DomainEvilGlobal.SelectedGame.WhenAnyValue(x => x.ActiveGame.CalculatedSettings.Server)
            .Subscribe(x => ActiveItem = x);

            var playerSortDescriptions =
                new[] {
                new SortDescription("Score", ListSortDirection.Descending),
                new SortDescription("Deaths", ListSortDirection.Ascending)
            };

            Players = new ReactiveList <Player>();
            Players.EnableCollectionSynchronization(_playersLock);
            PlayersView = Players.SetupDefaultCollectionView(playerSortDescriptions, null, null, null, true);

            this.WhenAnyValue(x => x.SelectedItem.SelectedItem)
            .OfType <Server>()
            .BindTo(this, x => x.SelectedServer);

            this.WhenAnyValue(x => x.SelectedServer.Players)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(UpdatePlayers);

            this.WhenAnyValue(x => x.SelectedItem.SelectedItem)
            .Subscribe(x => {
                if (x == null)
                {
                    Players.Clear();
                }
            });

            IsLoading = true;
        }