Ejemplo n.º 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MBoyForm mbf_log;
            MBoyMain mbm;
            int      o = -1;


            bool bol = BDGestionAccess2013.OUVRIRconnexionBD("memoireboy2013");

            if (bol)
            {
                o = BDGestionAccess2013.COUNT("users", "select count(*) from users");
                bool lob = BDGestionAccess2013.FERMERconnexionBD("memoireboy2013");
            }


            if (o > 0)
            {
                mbf_log = new MBoyForm();
                Application.Run(mbf_log);
            }
            else
            {
                mbm = new MBoyMain();
                Application.Run(mbm);
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            WebClient _webClient = new WebClient();

            try
            {
                string urlDuFichier = @"http://www.memoireboy.fr/memoireboy/version.txt";



                WebClient              wc = new WebClient();
                System.IO.Stream       st = wc.OpenRead(urlDuFichier);
                System.IO.StreamReader sr = new System.IO.StreamReader(st);
                string fichierEntier      = sr.ReadToEnd().Trim();
                wc.Dispose();

                BDGestionAccess2013.OUVRIRconnexionBD("MemoireBoy2013");
                int vs         = Convert.ToInt32(fichierEntier);
                int oldversion = Convert.ToInt32(BDGestionAccess2013.LIT_OLDVERSIONMB());

                if (vs > oldversion)
                {
                    this.metAJlaVersionDsBD(vs.ToString());
                }

                string url_exe = "http://www.memoireboy.fr/memoireboy/memoireboy2013.exe";
                string _path   = Application.StartupPath + @"\" + "MemoireBoy2013.exe";

                if (vs > oldversion)
                {
                    if (File.Exists(Application.StartupPath + @"\" + "MemoireBoy2013.exe"))
                    {
                        File.Delete(Application.StartupPath + @"\" + "MemoireBoy2013.exe");
                    }

                    _webClient.Headers.Add("User-Agent", "Mozilla");
                    _webClient.DownloadFileCompleted   += new AsyncCompletedEventHandler(_webClient_DownloadFileCompleted);
                    _webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(_webClient_DownloadProgressChanged);
                    _webClient.DownloadFileAsync(new Uri(url_exe), _path);
                    this.button1.Text = "téléchargement en cours...";
                }

                BDGestionAccess2013.FERMERconnexionBD("MemoireBoy2013");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 3
0
 private void MBoyMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     bool lob = BDGestionAccess2013.FERMERconnexionBD("memoireboy2013");
     Application.Exit();
 }