Example #1
0
        /// <summary>
        /// Use a Dialog Box to ask for a New Favorite Channel to Add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            //ask for a new channel to add
            InputBoxDialog i = new InputBoxDialog();

            i.FormCaption = "Add Favorite Channel";
            i.FormPrompt  = "Enter a channel to add";

            i.ShowDialog();
            if (i.InputResponse.Length > 0)
            {
                listChannels.Items.Add(i.InputResponse);
            }

            //write out the settings file
            WriteSettings();
        }
Example #2
0
        /// <summary>
        /// Edit a Favorite Channel selected with a Dialog Box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            int s = listChannels.SelectedIndex;

            if (s == -1)
            {
                return;
            }

            InputBoxDialog i = new InputBoxDialog();

            i.FormCaption  = "Edit Favorite Channel";
            i.FormPrompt   = "Enter the new channel name";
            i.DefaultValue = listChannels.Items[s].ToString();

            i.ShowDialog();
            if (i.InputResponse.Length > 0)
            {
                listChannels.Items[s] = i.InputResponse;
            }

            WriteSettings();
        }