public ServerListViewModel(IoCContainer iocc) { this.iocc = iocc; config = iocc.RetrieveContract<Configuration>(); tokenSource = new CancellationTokenSource(); token = tokenSource.Token; RefreshCommand = new ActionCommand(x => Application.Current.Dispatcher.InvokeAsync(UpdateServerList), x => true); JoinServerCommand = new ActionCommand(ConnectTo, x => Servers.CurrentItem != null); servers = new ObservableCollection<ServerViewModel>(); viewSource = new CollectionViewSource {Source = servers}; viewSource.SortDescriptions.Add(new SortDescription("Players", ListSortDirection.Descending)); viewSource.Filter += (s, e) => { ServerViewModel model = e.Item as ServerViewModel; e.Accepted = model != null && model.Version.Equals(RxVersion, StringComparison.OrdinalIgnoreCase); }; Servers = viewSource.View; pingTask = Task.Factory.StartNew(PingServers, token); }
public Launcher(Server server, IoCContainer iocc) { config = iocc.RetrieveContract<Configuration>(); this.server = server; }