예제 #1
0
        private void switchStartWithWindow_CheckedChanged(object sender, EventArgs e)
        {
            if (switchStartWithWindow.Checked == true)
            {
                AutoStartup.AddApplicationToStartup();
            }
            else
            {
                AutoStartup.RemoveApplicationFromStartup();
            }

            using (var dbContext = new TODOContext())
            {
                us.StartWithWin = switchStartWithWindow.Checked;
                dbContext.UserSettings.AddOrUpdate(us);
                dbContext.SaveChanges();
            }

            if (switchStartWithWindow.Checked)
            {
                AlertForm af = new AlertForm();
                af.setAlert("The application will start with Window", AlertForm.alertTypeEnum.Info);
            }
        }