Esempio n. 1
0
        private void Connect_Click(object sender, EventArgs e)
        {
            List <ConnectionSearchResult> connectionSearchResults = new List <ConnectionSearchResult>();

            foreach (DataGridViewRow row in m_Connections.Rows)
            {
                if ((bool)row.Cells[0].Value == false)
                {
                    continue;
                }

                connectionSearchResults.Add(row.Tag as ConnectionSearchResult);
            }

            if (connectionSearchResults.Count == 0)
            {
                System.Media.SystemSounds.Exclamation.Play();

                FlashingDialogHelper.FlashWindowEx(this);

                return;
            }

            ConnectionSearchResults.Clear();
            ConnectionSearchResults.AddRange(connectionSearchResults);

            DialogResult = System.Windows.Forms.DialogResult.OK;

            Close();
        }
Esempio n. 2
0
        private void OnDeviceExpired(ConnectionSearchResult connectionSearchResult)
        {
            DataGridViewRow foundRow = null;

            foreach (DataGridViewRow row in m_Connections.Rows)
            {
                if (connectionSearchResult.Equals(row.Tag as ConnectionSearchResult) == false)
                {
                    continue;
                }

                foundRow = row;
            }

            if (foundRow == null)
            {
                return;
            }

            ConnectionSearchResults.Remove(connectionSearchResult);

            m_Connections.Rows.Remove(foundRow);

            if (foundRow.Selected == true)
            {
                if (m_Connections.Rows.Count > 0)
                {
                    m_Connections.ClearSelection();
                    m_Connections.Rows[0].Selected = true;
                }
            }

            if (connectionSearchResult.ConnectionType == NgimuApi.ConnectionType.Udp)
            {
                numberOfUdpConnections--;
            }
            else
            {
                numberOfSerialConnections--;
            }

            SetNumberOfConnectionsText();
        }