Exemple #1
0
        private void CheckForLogonTask()
        {
            if (StartupTaskManager.TaskExists())
            {
                // A logon task is defined

                if (Profiles.Exists(pr => pr.Name == StartupTaskManager.GetTaskParameter()))
                {
                    // The logon profile still exists
                    chkProfileLogOn.Checked      = true;
                    cmbProfileLogOn.SelectedItem = Profiles.Find(pr => pr.Name == StartupTaskManager.GetTaskParameter());
                }
                else
                {
                    // The logon profile doesn't exist anymore, delete the task
                    StartupTaskManager.DeleteTask();
                    chkProfileLogOn.Checked       = false;
                    cmbProfileLogOn.Enabled       = false;
                    cmbProfileLogOn.SelectedIndex = 0;
                }
            }
            else
            {
                // No logon task defined
                chkProfileLogOn.Checked       = false;
                cmbProfileLogOn.Enabled       = false;
                cmbProfileLogOn.SelectedIndex = 0;
            }
        }
Exemple #2
0
 private void chkProfileLogOn_CheckedChanged(object sender, EventArgs e)
 {
     if (chkProfileLogOn.Checked)
     {
         cmbProfileLogOn.Enabled = true;
         AddSelectedProfileInComboboxToLogon();
     }
     else
     {
         cmbProfileLogOn.Enabled = false;
         StartupTaskManager.DeleteTask();
     }
 }