public void FirstTimeAStringArrives(Actor sender, ActorMatch address, object message) { // 4. reconfigure this actor to have the SecondTimeAStringArrives function to respond when strings are sent. MessageBox.Show((string)message, @"First time"); MatchList.Clear(); MatchList.Add(new ActorMatch(typeof(string), SecondTimeAStringArrives)); }
public void Remove_Team_Test() { // arrange string name = "TestName"; int scoreA = 6; int scoreB = 9; int id = 98; //act Match testMatch = new Match() { Name = name, ID = id, TeamAScore = scoreA, TeamBScore = scoreB }; MatchList testmatchList = new MatchList(); testmatchList.Add(testMatch); //testmatchList.Remove(30); //assert Match lookingMatch = testmatchList.FindByID(id); Assert.AreEqual(null, lookingMatch, "Incompatibility in Remove Match from list"); }
protected override void OnInitialized() { base.OnInitialized(); ImportService.MatchUpdated = match => { var existing = MatchList.FirstOrDefault(m => m.Id == match.Id); if (existing == null) { MatchList.Add(match); } else { existing.Group = match.Group; existing.LocalizedNames = match.LocalizedNames; existing.MatchTeams = match.MatchTeams; existing.Number = match.Number; existing.PlaceHolderAway = match.PlaceHolderAway; existing.PlaceHolderHome = match.PlaceHolderHome; } StateHasChanged(); }; Resources.CultureChanged += (e, a) => { StateHasChanged(); }; }
public void Add_Match_Test() { //arrange string name = "TestName"; int scoreA = 6; int scoreB = 9; int id = 98; //act Match testMatch = new Match() { Name = name, ID = id, TeamAScore = scoreA, TeamBScore = scoreB }; MatchList testmatchList = new MatchList(); testmatchList.Add(testMatch); //assert Match lookingMatch = testmatchList.FindByID(id); Assert.AreEqual(name, lookingMatch.Name, "Incompatibility in Add Match to List"); Assert.AreEqual(id, lookingMatch.ID, "Incompatibility in Add Match to List"); Assert.AreEqual(scoreA, lookingMatch.TeamAScore, "Incompatibility in Add Match to List"); Assert.AreEqual(scoreB, lookingMatch.TeamBScore, "Incompatibility in Add Match to List"); }
public Counter(string keyWord, string userSentence) { string lowerCaseKeyWord = keyWord.ToLower(); KeyWord = lowerCaseKeyWord; UserSentence = userSentence; Matches = this.RepeatCounter(); MatchList.Add(this); Id = MatchList.Count; }
internal void ProcessConfigSet(TestProgram parent, string[] args) { for (int index = 0; index < args.Length; index++) { switch (args[index].ToUpper()) { case RUN_ARG: index++; immediateRun = args[index].ToUpper(); break; case EXCLUDE_ARG: index++; exclusions.Add(args[index]); break; case INCLUDE_ARG: index++; HandleInclusion(parent, new FileInfo(args[index])); break; case DECLARE_ARG: DoDeclare(args, index + 1); return; case PORT_ARG: index++; if (!parent.ContinueService) { parent.WEBUI_PORT = int.Parse(args[index]); } // will silently ignore if serving. return; /* * case ADDRESS_ARG: * index++; * if (!parent.ContinueService) * { * try * { * parent.address = InetAddress.getByName(args[index]); * } * catch (UnknownHostException e) * { * Console.WriteLine("Unable to set local address to " + args[index]); * } * } // will silently ignore if serving. * return; */ default: UnprocessedArguments.Add(args[index]); break; } } }
private void GetMatches() { foreach (var url in UserGameProfile.MatchUrls) { DispatcherHelper.CheckBeginInvokeOnUI(async() => MatchList.Add(await _scrapper.GetPersonalGameDetails(UserGameProfile.Nickname, url))); if (MatchListHome.Count < 5 && MatchList.Any()) { DispatcherHelper.CheckBeginInvokeOnUI(() => MatchListHome.Add(MatchList.Last())); } Thread.Sleep(TimeSpan.FromSeconds(1)); } }
/// <summary> /// Download all updates of matches /// </summary> private async void ForceDownloadMatches() { ConnectionStatus = Properties.Resources.tinder_update_getting_matches; try { bool setUpMatchList = false; var updates = await TinderHelper.GetUpdates(); // FIXME For 200 matches this hangs for ~10s foreach (var item in updates.Matches.Where(x => x.Person != null)) { var match = MatchList.FirstOrDefault(x => x.Person.Id == item.Person.Id); if (match != null) { SerializationHelper.UpdateMatchModel(match, item); } else { MatchList.Add(item); setUpMatchList = true; } } if (setUpMatchList) { MatchListSetup(); } Messenger.Default.Send(new SerializationPacket(MatchList), MessengerToken.ShowSerializationDialog); ConnectionStatus = Properties.Resources.tinder_auth_okay; } catch (TinderRequestException e) { MessageBox.Show(e.Message); } }
public Actor3D() { // 4. Also register for string messages. MatchList.Add(new ActorMatch(typeof(string), StringReceiver)); }
public Actor2D() { // 3. Register for string messages. MatchList.Add(new ActorMatch(typeof(string), StringReceiver1)); MatchList.Add(new ActorMatch(typeof(string), StringReceiver2)); }
public Actor2C() { // 3. Configure this actor to have the FirstTimeAStringArrives function to respond when strings are sent. MatchList.Add(new ActorMatch(typeof(string), FirstTimeAStringArrives)); }
public Actor2B() { //Configure to send strings to one function and ints to another. MatchList.Add(new ActorMatch(typeof(string), I_accept_strings)); MatchList.Add(new ActorMatch(typeof(int), I_accept_ints)); }
public RowColumns(int row, MatchList matches1, MatchList matches2) { Row = row; Matches = new MatchList(); if (matches1 == null) { if (matches2 != null) { Matches.AddRange(matches2); } } else if (matches2 == null) { Matches.AddRange(matches1); } else { int index1 = 0; int index2 = 0; while (true) { if (matches1[index1].StartCol < matches2[index2].StartCol) { Matches.Add(matches1[index1++]); if (index1 >= matches1.Count) { Matches.AddRange(matches2, index2); break; } } else if (matches1[index1].StartCol > matches2[index2].StartCol) { Matches.Add(matches2[index2++]); if (index2 >= matches2.Count) { Matches.AddRange(matches1, index1); break; } } else if (matches1[index1].EndCol >= matches2[index2].EndCol) { Matches.Add(matches1[index1++]); index2++; if (index1 >= matches1.Count) { Matches.AddRange(matches2, index2); break; } if (index2 >= matches2.Count) { Matches.AddRange(matches1, index1); break; } } else //if (matches1[index1].EndCol < matches2[index2].EndCol) { index1++; Matches.Add(matches2[index2++]); if (index1 >= matches1.Count) { Matches.AddRange(matches2, index2); break; } if (index2 >= matches2.Count) { Matches.AddRange(matches1, index1); break; } } } } }
public void AddTilePosition(int x, int y) { matchlist.Add(new Point2D(x, y)); }