C#??Windows??????????????
???????????? ???????[ 2014/6/17 13:53:03 ] ????????C# net
?????????????????????????????y?????????顣
????1 string path = Directory.GetCurrentDirectory() + "/config.ini";
????2 List<string> serviceGroups = INIHelper.GetAllSectionNames(path);
????3 cboServiceGroup.DataSource = serviceGroups;
???????е?INI???????ο??????http://www.cnblogs.com/mahongbiao/p/3751153.html
?????????????????????????System.ServiceProcess??????
????????????飺
1 if (string.IsNullOrEmpty(cboServiceGroup.Text))
2 {
3 MessageBox.Show("?????????????????");
4 return;
5 }
6 //
7 string path = Directory.GetCurrentDirectory() + "/config.ini";
8 string section = cboServiceGroup.Text;
9 string[] keys;
10 string[] values;
11 INIHelper.GetAllKeyValues(section?? out keys?? out values?? path);
12 //
13 foreach (string value in values)
14 {
15 ServiceController sc = new ServiceController(value);
16 //
17 try
18 {
19 ServiceControllerStatus scs = sc.Status;
20 if (scs != ServiceControllerStatus.Running)
21 {
22 try
23 {
24 sc.Start();
25 }
26 catch (Exception ex)
27 {
28 MessageBox.Show("??????????
" + ex.ToString());
29 }
30 }
31 }
32 catch (Exception ex)
33 {
34 MessageBox.Show("?????????" + value);
35 }
36 //
37 }
38 //
39 MessageBox.Show("??????????");
|
??????

???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44