private void uiOkButton_Click(object sender, EventArgs e)
 {
     this.uiOkButton.Enabled           = false;
     this.uiChannelNameTextBox.Enabled = false;
     this.ProfileJsonPacket            = null;
     this.uiVerifyingLabel.Text        = "Verifying...";
     this.worker.RunWorkerAsync();
 }
 private void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         this.ProfileJsonPacket = this.engine.GetProfileJsonInfo(this.uiChannelNameTextBox.Text);
     }
     catch (Exception)
     {
         this.ProfileJsonPacket = null;
     }
 }
        /// <summary>
        /// Adds a new channel profile to the list of profiles.
        /// </summary>
        /// <param name="packet">A profile packet describing the profile to be added.</param>
        private void AddChannel(ProfileJsonPacket packet)
        {
            //------------------------------------------------------------------
            //  Don't add the channel if it's already in the tree.
            //------------------------------------------------------------------
            foreach (ListViewItem item in this.uiChannelsListView.Items)
            {
                if (item.Text.Equals(packet.name))
                {
                    return;
                }
            }

            UserProfile userProfile = new UserProfile();

            userProfile.ChannelName = packet.name;
            this.userProfiles.Add(userProfile);
            ListViewItem newItem = this.uiChannelsListView.Items.Add(userProfile.ChannelName);

            newItem.Tag      = userProfile;
            newItem.Selected = true;
            this.ApplyNewChannelSelection();
            this.uiChannelsListView.Select();
        }