Exemplo n.º 1
0
        private void btnAddToList_Click(object sender, EventArgs e)
        {
            bool   ret  = false;
            string name = string.Empty;

            try
            {
                DisplayClient dc = new DisplayClient();
                ret  = dc.Connect(ipbManual.IP);
                name = dc.RequestName();
                if (!ret)
                {
                    throw new Exception("Error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "There was an issue connecting to this DisplayServer.", "Projection", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            ret = AddGridEntry(true, ipbManual.IP, name);
            if (!ret)
            {
                MessageBox.Show(this, "Doh, this Display Server is already added!", "Projection", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 2
0
        private void AddDisplay(string ip)//string name, Image img)
        {
            for (int i = 0; i < grid.RowCount; i++)
            {
                if (grid.Rows[i].Tag.Equals(ip))
                {
                    return;
                }
            }


            int    id         = grid.Rows.Add();
            string name       = "--Offline--";
            string resolution = "--Offline--";

            //Connection Test
            Probe probe       = new Probe();
            bool  isConnected = probe.TestIP(ip, true);

            grid.Rows[id].Tag = ip;
            if (isConnected)
            {
                grid.Rows[id].Cells[0].Value = Projection_Client.Properties.Resources.connected_sm;
                DisplayClient dc = new DisplayClient();
                dc.Connect(ip);
                name       = dc.RequestName();
                resolution = dc.RequestResolution();
                dc.Disconnect();
            }
            else
            {
                grid.Rows[id].Cells[0].Value = Projection_Client.Properties.Resources.disconnected_sm;
            }
            //gridDisplays.Rows[id].Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            grid.Rows[id].Cells[1].Value = name;
            grid.Rows[id].Cells[2].Value = resolution;
            //gridDisplays.Rows[id].Tag
            File.AppendAllText("screens.txt", ip + "\n");
        }