string serviceFilePath = "WeChatExtServer.exe"; //服务程序 private void button1_Click(object sender, EventArgs e) { if (LibServer.Run(new string[] { }) == false) { MessageBox.Show("运行失败,可能已有启动的服务,具体原因请查看日志"); } else { MessageBox.Show("运行成功"); } }
void UpdateServiceStatus() { string version = LibServer.GetVersion(); if (ServiceManager.IsServiceRunning(serviceName)) { Txt_Status.Text = $"运行中({version})"; } else { Txt_Status.Text = $"已停止({version})"; } }