public GameNetworkInstanceDiscoveryController(NetworkGameInstance gameInstance) : base(UITableViewStyle.Grouped, null) { this.model = ServiceContainer.Resolve<NetworkBrowserModel> (); this.model.CurrentGameInstance = gameInstance; this.Root = new RootElement (String.Empty) { new Section ("Discovered game instances") { }, }; }
public void TestDiscovery() { ServiceContainer.Register<INetworkService>(new MockupNetworkService()); ServiceContainer.Register<ILoggingService>(new FileLoggingService()); var model = new NetworkBrowserModel () { PollIntervallMilliseconds = 0, CurrentGameInstance = new NetworkGameInstance() { Name = "Local instance", SenderAddress = "Local address", UniqueId = "Local ID", Version = "1.0" } }; model.StartBroadcastingAndDiscovery (); Task.WaitAll (new Task[] { model.gameInstanceBroadcastTask, model.gameInstanceDiscoveryTask }, 3000); model.StopBroadcastingAndDiscovery (); Assert.IsFalse (model.gameInstanceBroadcastTask.IsFaulted, "Broadcasting failed"); Assert.IsFalse (model.gameInstanceDiscoveryTask.IsFaulted, "Discovery failed"); Assert.That (model.DiscoveredGameInstances.Count > 0, "No instances discovered"); }
void HandleInstanceTapped(NetworkBrowserModel.GameInstanceInfo gameInstanceInfo) { Console.WriteLine ("Tapped: " + gameInstanceInfo.GameInstance); }
public GameInstanceElement(NetworkBrowserModel.GameInstanceInfo gameInstanceInfo, NSAction tapped) : base(gameInstanceInfo.GameInstance.Name, tapped) { this.GameInstanceInfo = gameInstanceInfo; }