private void buttonSvcGetStatus_Click(object sender, EventArgs e) { MessageBox.Show( ServiceMgt.GetServiceStatus( this.textBoxNTServiceName.Text.Trim(), Program.Log).ToString() ); }
private void LoadSettings() { // load solution dir file _solutionDirPath = ConfigHelper.DismissDotDotInThePath(ConfigHelper.GetFullPath(Program.ConfigMgr.Config.IntegrationSolutionPath)); string solutionDirFile = Path.Combine(_solutionDirPath, SolutionConfig.SolutionDirFileName); _solutionConfigMgr = new ConfigManager <SolutionConfig>(solutionDirFile); if (!_solutionConfigMgr.Load()) { Program.Log.Write(_solutionConfigMgr.LastError); MessageBox.Show(this, string.Format("Cannot load configuration file of the integration solution from: \r\n{0}", solutionDirFile), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); return; } // get NT Service status if (_solutionConfigMgr.Config.Hosts.Count < 1) { MessageBox.Show(this, string.Format("Cannot find any NT Service Host in the integation solution: \r\n{0}", solutionDirFile), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); return; } _hostInfo = _solutionConfigMgr.Config.Hosts[0]; ServiceStatus status = ServiceMgt.GetServiceStatus(_hostInfo.ServiceName, Program.Log); RefreshServiceStatus(status); // get Adpater status _serviceConfigPath = Path.Combine(_solutionDirPath, _hostInfo.ServicePath); string serviceConfigFile = Path.Combine(_serviceConfigPath, NTServiceHostConfig.NTServiceHostConfigFileName); _serviceConfigMgr = new ConfigManager <NTServiceHostConfig>(serviceConfigFile); if (!_serviceConfigMgr.Load()) { Program.Log.Write(_serviceConfigMgr.LastError); MessageBox.Show(this, string.Format("Cannot load configuration file of the NT Serivce Host from: \r\n{0}", serviceConfigFile), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); return; } RefreshDiagram(); RefreshAdapterList(); RefreshAdapterButtons(); }