private void BtnChat3_Click(object sender, EventArgs e) { if (NetworkFacade.Cities.Count == 0) { MessageBox.Show("No cityserver online! Disconnecting..."); Reset(); ////This doesn't work here, because this is a callback. TODO: Find a work around... //NetworkFacade.Client.Disconnect(); return; } ChatFrm Chat; if (NetworkFacade.Avatars.Count == 2) { PacketSenders.RequestCityToken(NetworkFacade.Client, NetworkFacade.Avatars[1]); Chat = new ChatFrm(NetworkFacade.Avatars[1]); Chat.Show(); } else { PacketSenders.RequestCityToken(NetworkFacade.Client, NetworkFacade.Avatars[2]); Chat = new ChatFrm(NetworkFacade.Avatars[2]); Chat.Show(); } this.Visible = false; }
private void BtnChat2_Click(object sender, EventArgs e) { if (NetworkFacade.Cities.Count == 0) { MessageBox.Show("No cityserver online!"); Reset(); //This doesn't work here, because this is a callback. TODO: Find a work around... //NetworkFacade.Client.Disconnect(); return; } ChatFrm Chat = new ChatFrm(NetworkFacade.Avatars[1]); Chat.Show(); //NetworkController.Reconnect(); //Because BtnChat2 is disabled unless the user has 3 avatars, //it means BtnChat2 will always represent NetworkFacade.Avatars[1]. PacketSenders.RequestCityToken(NetworkFacade.Client, NetworkFacade.Avatars[1]); this.Visible = false; }