public static void SetServer(Server server, MainForm form) { form.treeView.Nodes[server.GetGame().GetGameName()].Nodes.Add(server.GetServerName() + " " + server.GetDnsIP()); form.treeView.ExpandAll(); string[] row = { server.GetServerName(), server.GetDnsIP(), server.GetGame().GetGameName(), server.GetGame().GetGameGenre() }; ListViewItem lvi = new ListViewItem(row); form.listView.Items.Add(lvi); }
public void tracker(Server s, MainForm form) { form.notifyIconTray.ShowBalloonTip(300,"Connected to"+s.GetServerName(),"Ping is"+" "+Commands.pingHost(s.GetDnsIP()),ToolTipIcon.Info); while (!_Disable) { int ping = Commands.pingHost(s.GetDnsIP()); if (ping < 150 && ping >= 0) form.notifyIconTray.Icon = new Icon("Resources/iconG.ico"); else if (ping < 400 && ping >=150) form.notifyIconTray.Icon = new Icon("Resources/iconY.ico"); else if (ping >= 400) form.notifyIconTray.Icon = new Icon("Resources/iconR.ico"); else form.notifyIconTray.Icon = new Icon("Resources/icon404.ico"); if(ping>=0) form.notifyIconTray.Text = s.GetServerName().ToUpper() + " " + s.GetDnsIP() + "\n" + ping + "ms"+" "+s.GetGame().GetGameName(); else form.notifyIconTray.Text = s.GetServerName().ToUpper() + " " + s.GetDnsIP() + "\n" + "Host Unreachable" + " " + s.GetGame().GetGameName(); System.Threading.Thread.Sleep(2000); } }
private void newServerToolStripMenuItem_Click(object sender, EventArgs e) { NewServer NewServer = new NewServer(); Server server; NewServer.ShowDialog(this); if (NewServer.DialogResult == DialogResult.OK) { server = new Server(NewServer.GetServerName(), NewServer.GetServerIP(),(Game)(Arrays.games[NewServer.GetGame()])); NewServer.Dispose(); Arrays.servers.Add(server); Commands.SetServer(server,this); } else { NewServer.Dispose(); } }