public void Refresh(Entity.HackResult result) { var hackindex = HackListBoxItems.FindIndex(x => x.HackID == result.HackID); var item = new HackListBoxItem() { ProblemTitle = result.ProblemTitle, HackerUserNickName = result.HackerUserNickName, DefenderUserNickName = result.DefenderUserNickName, HackID = result.HackID, RecordID = result.RecordID, Status = result.Status, Time = result.Time }; Dispatcher.Invoke(new Action(() => { if (hackindex == -1) { HackListBoxItems.Add(item); } else { HackListBoxItems[hackindex] = item; } lstHack.Items.Refresh(); })); }
public void OnFragmentNavigation(FirstFloor.ModernUI.Windows.Navigation.FragmentNavigationEventArgs e) { contest_id = int.Parse(e.Fragment); var ids = App.Server.GetHackList(contest_id); HackListBoxItems.Clear(); foreach (var hid in ids) { var hack = App.Server.GetHackGeneral(hid); var item = new HackListBoxItem() { ProblemTitle = hack.ProblemTitle, HackerUserNickName = hack.HackerUserNickName, DefenderUserNickName = hack.DefenderUserNickName, HackID = hack.HackID, RecordID = hack.RecordID, Status = hack.Status, Time = hack.Time }; HackListBoxItems.Add(item); } lstHack.Items.Refresh(); }