예제 #1
0
        /// <summary>
        /// Handles the CheckedChanged event of the autostartCheckbox control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void autostartCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            string name = "Backround Cycler";

            // Based on checkbox, call API functions to add or remove
            // application path from registry Run section for current user.
            if (chkAutostartCheckbox.Checked)
            {
                WindowsAPI.AddStartupItem(name,
                                          Assembly.GetEntryAssembly().Location);
            }
            else
            {
                WindowsAPI.RemoveStartupItem(name);
            }
            Settings.Save();
        }