public void frmCNDServiceApplication_Load(System.Object sender, System.EventArgs e) { try { this._stxeventLog = CustomEventLog.GetInstance(); this._stxeventLog.LogEntryReceived += this._stxeventLog_LogEntryReceived; } catch (Exception) { } frmServiceIndex frm = new frmServiceIndex(); try { this._CNDService = CNDService.GetInstance(); this._CNDService.CNDTableStatusChanged += this.CNDTableStatusChanged; this.dgrdServiceParameters.DataSource = this._CNDService.ServiceParametersTable; this.dgrdCNDTable.DataSource = this._CNDService.ComponentNetworkDirectoryTable; this.dgrdCNDTable.Columns[0].Width = (int)((double)dgrdCNDTable.Width / 2); this.dgrdCNDTable.Columns[1].Width = (int)((double)dgrdCNDTable.Width / 2); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { frm.Dispose(); } }
protected override void OnStart(string[] args) { // Add code here to start your service. This method should set things // in motion so your service can do its work. try { this._CNDService = CNDService.GetInstance(); } catch (Exception ex) { CustomEventLog.WriteEntry(EventLogEntryType.Error, ex.ToString()); } }