private void BF3Servers_ServerChanged(IBFServerList <API_BF3ServerBase> list, uint id, API_BF3ServerBase server, ServerChangeTypes changeType) { RespondToChange(ZloBFGame.BF_3, list, server, changeType); }
private void RespondToChange(ZloBFGame game, IBFServerList senderList, IBFServerBase serverBase, ServerChangeTypes changeType) { Application.Current.Dispatcher.Invoke(() => { var guiList = GetGUIServerList(game); var equi = guiList.Cast <BF_GUI_Server>().FirstOrDefault(x => x.ID == serverBase.ServerID); switch (changeType) { case ServerChangeTypes.Add: if (equi == null) { guiList.Add(equi = CreateServer(game, serverBase)); } AnimateRow(DataGrids[game], equi); break; case ServerChangeTypes.Update: if (equi != null) { //notify the gui equi.UpdateAllProps(); AnimateRow(DataGrids[game], equi); } break; case ServerChangeTypes.Remove: //remove from current list if (equi != null) { guiList.Remove(equi); } break; default: break; } }); }