/// <summary> /// Starts each dependent service listed in the configuration file /// </summary> void CheckForDependentServices() { const string MemberName = "CheckForDependentServices"; try { List <string> dependentSevices = new List <string>(); DataSection ds = (DataSection)ConfigurationManager.GetSection("DependentServiceList"); if (ds.Items == null || ds.Items.Count == 0) { ConnectionMonitorException cme = new ConnectionMonitorException( "No Dependent services defined in the configuration file! " + MemberName); } for (int i = 0; i < ds.Items.Count; i++) { string name = ds.Items[i].Data; try { ServiceHelper.StartService(name, name); dependentSevices.Add(name); } catch (Exception ex) { ConnectionMonitorException cme = new ConnectionMonitorException( "Cannot start dependent service " + name, ex); Logger.Write(cme); throw cme; } } if (dependentSevices != null && dependentSevices.Count > 0) { this.EnsureWCFClient(); this.ConMonServiceEventsWCFServiceClient.DependentServicesChecked(dependentSevices.ToArray()); } } catch (ConnectionMonitorException cme) { Logger.Write(cme); throw cme; } catch (Exception ex) { Logger.Write(ex); throw; } }
private static void StartWlanService() { ServiceHelper.StartService("wlansvc", "WLAN AutoConfig"); }