Exemplo n.º 1
0
        /// <summary>
        /// Handler for Search button click
        /// </summary>
        private void SearchButton_Click(object sender, System.EventArgs e)
        {
            SearchButton.Enabled = false;
            this.Cursor          = Cursors.WaitCursor;

            // Clear the current host list
            App.FoundSessions.Clear();

            // Have the application perform the enumeration
            App.EnumerateSessions(SearchAddressTextBox.Text, RemotePort);

            this.Cursor          = Cursors.Default;
            SearchButton.Enabled = true;
            App.UpdateUI();

            DetectedSessionsListBox.Items.Clear();

            // Add detected items to thelist
            foreach (HostInfo host in App.FoundSessions)
            {
                DetectedSessionsListBox.Items.Add(host);
                DetectedSessionsListBox.Enabled = true;
            }

            // Give default message for no hosts
            if (App.FoundSessions.Count == 0)
            {
                DetectedSessionsListBox.Items.Add("No hosts found.");
            }
        }