Exemple #1
0
            public override void ProcessServerInfo(ServerQuerier.SRB2ServerInfo srb2si)
            {
                ListView lv = form1.listViewServers;

                // Build a list item.
                ListViewItem lvi = new ListViewItem(srb2si.strName);

                // So we can get address and whatever else we might need.
                lvi.Tag = srb2si;

                // Gametype string, or number if not recognised.
                if (dicGametypes.ContainsKey(srb2si.byGametype))
                {
                    lvi.SubItems.Add(dicGametypes[srb2si.byGametype]);
                }
                else
                {
                    lvi.SubItems.Add(Convert.ToString(srb2si.byGametype));
                }

                lvi.SubItems.Add(Convert.ToString(srb2si.uiTime));
                lvi.SubItems.Add(srb2si.byPlayers + "/" + srb2si.byMaxplayers);
                lvi.SubItems.Add(srb2si.strVersion);

                // Make the tooltip.
                BuildTooltip(lvi, form1.settings.ShowDefaultWads);

                // Is the game full?
                if (srb2si.byPlayers >= srb2si.byMaxplayers)
                {
                    lvi.ForeColor = Color.DimGray;
                }
                // Modified?
                else if (srb2si.bModified)
                {
                    lvi.ForeColor = Color.Red;
                }

                // Thread-safe goodness.
                if (lv.InvokeRequired)
                {
                    // Call ourselves in the context of the form's thread.
                    AddToListCallback addtolistcallback = new AddToListCallback(lv.Items.Add);
                    lv.Invoke(addtolistcallback, new object[] { lvi });
                }
                else
                {
                    // Add it!
                    lv.Items.Add(lvi);
                }
            }
Exemple #2
0
            public override void ProcessServerInfo(ServerQuerier.SRB2ServerInfo srb2si)
            {
                ListView lv = form1.listViewServers;

                // Build a list item.
                ListViewItem lvi = new ListViewItem(srb2si.strName);

                // So we can get address and whatever else we might need.
                lvi.Tag = srb2si;

                // Gametype string, or number if not recognised.
                if (dicGametypes.ContainsKey(srb2si.byGametype))
                    lvi.SubItems.Add(dicGametypes[srb2si.byGametype]);
                else
                    lvi.SubItems.Add(Convert.ToString(srb2si.byGametype));

                lvi.SubItems.Add(Convert.ToString(srb2si.uiTime));
                lvi.SubItems.Add(srb2si.byPlayers + "/" + srb2si.byMaxplayers);
                lvi.SubItems.Add(srb2si.strVersion);

                // Make the tooltip.
                BuildTooltip(lvi, form1.settings.ShowDefaultWads);

                // Is the game full?
                if (srb2si.byPlayers >= srb2si.byMaxplayers)
                    lvi.ForeColor = Color.DimGray;
                // Modified?
                else if (srb2si.bModified)
                    lvi.ForeColor = Color.Red;

                // Thread-safe goodness.
                if (lv.InvokeRequired)
                {
                    // Call ourselves in the context of the form's thread.
                    AddToListCallback addtolistcallback = new AddToListCallback(lv.Items.Add);
                    lv.Invoke(addtolistcallback, new object[] { lvi });
                }
                else
                {
                    // Add it!
                    lv.Items.Add(lvi);
                }

            }