Example #1
0
        /// <summary>
        /// Fermeture du programme
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ffs2play_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!pm.AutoExit)
            {
                DialogResult dialogResult = MessageBox.Show("Etes vous sûr de vouloir quitter ffs2play?", "Confirmation de sortie", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.No)
                {
                    e.Cancel = true;
                    return;
                }
            }
            P2P.Init(false);
            // On ferme la connexion avec simconnect
            scm.closeConnection();
            // Sauvegarde du status de la fenêtre seulement normal ou maximised)
            switch (WindowState)
            {
            case FormWindowState.Normal:
            case FormWindowState.Maximized:
                Properties.Settings.Default.WindowState = WindowState;
                break;

            default:
                Properties.Settings.Default.WindowState = FormWindowState.Normal;
                break;
            }
            // Sauvegarde de la configuration
            settings.Save();
            if (pm.IsConnected())
            {
                pm.AutoExit = true;
                e.Cancel    = true;
                pm.Disconnect(PirepManager.Disco_mode.Close);
            }
        }
Example #2
0
 private void btnConnexion_Click(object sender, EventArgs e)
 {
     if (btnAppliquer.Enabled)
     {
         UpdateUser();
         SaveUsers();
     }
     Properties.Settings.Default.DernierUser = tbProfil.Text;
     Properties.Settings.Default.Save();
     if (pm.IsConnected())
     {
         pm.Disconnect(PirepManager.Disco_mode.Reco);
     }
     else
     {
         pm.Connect(Users[position]);
     }
     Close();
     DialogResult = DialogResult.OK;
 }