Exemplo n.º 1
0
        void Init()
        {
            if (isConnect == false)
            {
                return;
            }
            if (ToolStripMenuItemAuto.Checked == false)
            {
                return;
            }

            labelStatus.Visible    = true;
            labelStatus.Text       = "正在连接数据库......";
            progressBar1.Visible   = true;
            progressBar1.Value     = 90;
            panelSqlServer.Enabled = false;
            ToolStripMenuItemConnectServer.Enabled = false;

            InitThread = new Thread(new ThreadStart(() =>
            {
                var result = ComWithSqlServer.OpenDatabase();
                RenewData(result);
            }));
            InitThread.Start();
        }
Exemplo n.º 2
0
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     ComWithSqlServer = new ComWithSql();
     if (ComWithSqlServer.OpenDatabase() == true)
     {
         MessageBox.Show("连接数据库成功!!");
         GatherDatas  = new List <GatherData>();
         StationCodes = new List <StationCode>();
         GatherErrors = new List <GatherError>();
         //for (int i = 0; i < 50 - 7; ++i)
         //{
         //    GatherDatas.Add(new GatherData());
         //    StationCodes.Add(new StationCode());
         //    GatherErrors.Add(new GatherError());
         //}
         timerGetDataFormDb.Enabled = true;
     }
 }