public void deleteMysql(object state)
        {
            int    id  = int.Parse(state.ToString());
            string sql = "select * from mysql where id=" + id;

            if (!DbHelperSQLite.Exists(sql))
            {
                MessageBox.Show("查询此数据库失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            DataSet ds = DbHelperSQLite.Query(sql);

            int res = this.deleteMysqlDataFromMySqlCommand(id, ds.Tables[0].Rows[0]["dbname"].ToString(), ds.Tables[0].Rows[0]["dbuser"].ToString());

            if (res == 1)
            {
                string sql_insertmysql = "delete from mysql where id=" + id;


                DbHelperSQLite.ExecuteSql(sql_insertmysql);

                SetLoadingHide hideloding = new SetLoadingHide(Load_Mysql_List_Invoke);
                this.Invoke(hideloding);

                this.writeLog("删除数据库[" + ds.Tables[0].Rows[0]["dbname"].ToString() + "]");
                MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("删除失败,请自行删除,code:102", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #2
0
        private void service_Reload(object serviceName)
        {
            var serviceControllers = ServiceController.GetServices();
            var server             = serviceControllers.FirstOrDefault(service => service.ServiceName == serviceName.ToString());

            /* if (server != null && server.Status != ServiceControllerStatus.Running)
             * {
             *   server.Start();
             * }*/

            if (server == null)
            {
                this.writeLog("此服务未安装");
                MessageBox.Show("此服务未安装", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                SetLoadingHide hideloding = new SetLoadingHide(hideLoading);
                this.Invoke(hideloding);
                return;
            }

            SetLoadingHide showloding = new SetLoadingHide(showLoading);

            this.Invoke(showloding);
            try
            {
                if (server.Status == ServiceControllerStatus.Running)
                {
                    server.Stop();
                    server.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
                }
                this.writeLog("启动" + serviceName.ToString() + "服务中...");
                server.Start();

                server.WaitForStatus(ServiceControllerStatus.Running, timeout);

                SetLoadingHide hideloding = new SetLoadingHide(hideLoading);
                this.Invoke(hideloding);
                this.writeLog("启动" + serviceName.ToString() + "成功!");
            }
            catch (Exception e)
            {
                SetLoadingHide hideloding = new SetLoadingHide(hideLoading);
                this.Invoke(hideloding);
                this.writeLog("Warning:重启" + serviceName.ToString() + "异常!");
            }
        }
Exemple #3
0
        private void CmdProcess_Exited(object sender, EventArgs e)
        {
            SetLoadingHide hideloding = new SetLoadingHide(hideLoading);

            this.Invoke(hideloding);
        }