public ConfigQuery ( string dataPath, string xmlConfigPath ) : |
||
dataPath | string | 节点路径 |
xmlConfigPath | string | 查询的xml文件路径 |
리턴 |
/// <summary> /// 执行保存已修改数据的方法 /// </summary> private void InitUserConfig() { string dataPath = "config/preferences"; ConfigController configController = new ConfigController(); ConfigInfo configInfo = configController.ConfigQuery(dataPath, "../../../common/res/CIConfig.xml"); Svnpath.Text = configInfo.Svnpath; Updateinterval.Text = configInfo.Updateinterval; switch (configInfo.StandarOutput) { case "true": standaroutput.IsChecked = true; break; case "false": standaroutput.IsChecked = false; break; default: standaroutput.IsChecked = false; break; } switch (configInfo.ServiceSwitch) { case "window": windowprocess.IsChecked = true; break; case "service": serviceprocess.IsChecked = true; break; default: windowprocess.IsChecked = false; serviceprocess.IsChecked = false; break; } }
/// <summary> /// 初始化项目状态显示 /// </summary> public void InitServiceStatus() { var statusImg = ""; var dataPath = "config/preferences"; ConfigController configController = new ConfigController(); ConfigInfo configInfo = configController.ConfigQuery(dataPath, "../../../common/res/CIConfig.xml"); ServiceController[] service = ServiceController.GetServices(); for (int i = 0; i < service.Length; i++) { if (service[i].DisplayName.Equals("LuckyCIService")) { switch (service[i].Status) { case ServiceControllerStatus.Running: statusImg = "../images/dot_yellow.png"; ServiceStatus.Content = "Running"; break; case ServiceControllerStatus.Stopped: statusImg = "../images/dot_black.png"; ServiceStatus.Content = "Stopped"; break; } StatusFlag.Source = new BitmapImage(new Uri(statusImg, UriKind.Relative)); break; } else { statusImg = "../images/dot_black.png"; ServiceStatus.Content = "Not Install"; StatusFlag.Source = new BitmapImage(new Uri(statusImg, UriKind.Relative)); } } //serviceswitch为service,service按钮可用,否则不可用 if (configInfo.ServiceSwitch == "service") { butOn.IsEnabled = true; butOff.IsEnabled = true; butReset.IsEnabled = true; } else { butOn.IsEnabled = false; butOff.IsEnabled = false; butReset.IsEnabled = false; } }