Exemple #1
0
 private bool StartAll()
 {
     if (!SerivceHelper.ExistService(Config.SqlServer))
     {
         this.Error("SQLServer没有安装");
         return(false);
     }
     if (!SerivceHelper.IsRunningService(Config.SqlServer))
     {
         if (!SerivceHelper.StartService(Config.SqlServer))
         {
             this.Error("无法启动数据库:" + Config.SqlServer);
             return(false);
         }
     }
     if (ProcessPanels != null)
     {
         new Thread(() =>
         {
             foreach (ProcessPanel p in ProcessPanels)
             {
                 if (!p.IsRunning())
                 {
                     p.StartProcess();
                 }
             }
             //	Invoke(new UpdateUI(updateStatu), new object[]{false});
         }).Start();
     }
     if (HttpServer != null)
     {
         HttpServer.Start();
     }
     return(true);
 }
Exemple #2
0
 private void StopAll()
 {
     if (ProcessPanels != null)
     {
         new Thread(() =>
         {
             foreach (ProcessPanel p in ProcessPanels)
             {
                 if (p.IsRunning())
                 {
                     p.StopProcess();
                 }
             }
             //	Invoke(new UpdateUI(updateStatu), new object[]{false});
         }).Start();
     }
     if (SerivceHelper.IsRunningService(Config.SqlServer))
     {
         if (this.Question("是否停止数据库?"))
         {
             SerivceHelper.StopService(Config.SqlServer);
         }
     }
     if (HttpServer != null)
     {
         HttpServer.Stop();
     }
 }
Exemple #3
0
 private void btnSqlserver_Click(object sender, EventArgs e)
 {
     if (!SerivceHelper.ExistService(Config.SqlServer))
     {
         this.Error("SQLServer没有安装");
         return;
     }
     if (SerivceHelper.IsRunningService(Config.SqlServer))
     {
         SerivceHelper.StopService(Config.SqlServer);
     }
     else
     {
         SerivceHelper.StartService(Config.SqlServer);
     }
     updateStatu();
 }
Exemple #4
0
        private void updateStatu()
        {
            if (HttpServer != null)
            {
                if (HttpServer.isListening)
                {
                    this.btnStop.Text      = "停止Web";
                    this.btnStop.BackColor = Color.DarkRed;
                }
                else
                {
                    this.btnStop.Text      = "启动Web";
                    this.btnStop.BackColor = Color.ForestGreen;
                }
            }
            if (!isStart)
            {
                this.btnStart.Text      = "全部启动";
                this.btnStart.BackColor = Color.ForestGreen;
            }
            else
            {
                this.btnStart.Text      = "全部停止";
                this.btnStart.BackColor = Color.DarkRed;
            }
            if (!SerivceHelper.IsRunningService(Config.SqlServer))
            {
                this.btnSqlserver.Text      = "启动数据库";
                this.btnSqlserver.BackColor = Color.ForestGreen;
            }
            else
            {
                this.btnSqlserver.Text      = "停止数据库";
                this.btnSqlserver.BackColor = Color.DarkRed;
            }
//			if(ignore){
//				if(isStart){
//					this.btnSqlserver.Text = "停止数据库";
//					this.btnSqlserver.BackColor = Color.DarkRed;
//				}else{
//					this.btnSqlserver.Text = "启动数据库";
//					this.btnSqlserver.BackColor = Color.ForestGreen;
//				}
//			}
        }
Exemple #5
0
 private bool StartAll()
 {
     if (!SerivceHelper.ExistService(Config.SqlServer))
     {
         this.Error(R.ErrorSqlServerNotInstall);
         return(false);
     }
     if (!SerivceHelper.IsRunningService(Config.SqlServer))
     {
         if (!SerivceHelper.StartService(Config.SqlServer))
         {
             this.Error(string.Format(R.ErrorSqlServerNotStart, Config.SqlServer));
             return(false);
         }
     }
     using (MSSqlHelper db = new MSSqlHelper(Config.ConnectionString)){
         if (!db.Open())
         {
             this.Error(R.ErrorSqlServerNotConnect);
             return(false);
         }
     }
     if (ProcessPanels != null)
     {
         new Thread(() =>
         {
             foreach (ProcessPanel p in ProcessPanels)
             {
                 if (!p.IsRunning())
                 {
                     p.StartProcess();
                 }
             }
             //	Invoke(new UpdateUI(updateStatu), new object[]{false});
         }).Start();
     }
     if (HttpServer != null)
     {
         HttpServer.Start();
     }
     return(true);
 }
Exemple #6
0
 private void updateStatu()
 {
     if (HttpServer != null)
     {
         if (HttpServer.isListening)
         {
             this.btnStop.Text      = R.StopWeb;
             this.btnStop.BackColor = Color.DarkRed;
         }
         else
         {
             this.btnStop.Text      = R.StartWeb;
             this.btnStop.BackColor = Color.ForestGreen;
         }
     }
     if (!isStart)
     {
         this.btnStart.Text      = R.StartAll;
         this.btnStart.BackColor = Color.ForestGreen;
     }
     else
     {
         this.btnStart.Text      = R.StopAll;
         this.btnStart.BackColor = Color.DarkRed;
     }
     if (!SerivceHelper.IsRunningService(Config.SqlServer))
     {
         this.btnSqlserver.Text      = R.StartSql;
         this.btnSqlserver.BackColor = Color.ForestGreen;
     }
     else
     {
         this.btnSqlserver.Text      = R.StopSql;
         this.btnSqlserver.BackColor = Color.DarkRed;
     }
 }