示例#1
0
 //If it closes check if everything is setup
 private void frmOptions_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!save)
     {
         DialogResult resultExit = MessageBox.Show("Do you want to exit this program?", "Exit?", MessageBoxButtons.YesNo);
         if (resultExit == DialogResult.Yes)
         {
             frmSync.Close();
         }
         else
         {
             if (File.Exists(cfgName))
             {
                 if (Directory.Exists(FromDriveSelect.SelectedItem.ToString().Split(' ')[1]) || Directory.Exists(location2))
                 {
                     frmSync.Show();
                 }
                 else
                 {
                     MessageBox.Show("Source location not found!\nCheck if your drive is connected");
                     e.Cancel = true;
                 }
             }
             else
             {
                 e.Cancel = true;
                 MessageBox.Show("Please setup the settings and press save.");
             }
         }
     }
     else
     {
         if (File.Exists(cfgName))
         {
             if (Directory.Exists(FromDriveSelect.SelectedItem.ToString().Split(' ')[1]) || Directory.Exists(location2))
             {
                 frmSync.Show();
             }
             else
             {
                 MessageBox.Show("Source location not found!\nCheck if your drive is connected");
                 e.Cancel = true;
             }
         }
         else
         {
             e.Cancel = true;
             MessageBox.Show("Please setup the settings and press save.");
         }
     }
 }