public ServiceHost InitializeTags(bool Start = false) { ServiceHost host = null; try { new DriverService().GetStartService(); host = new DriverService().InitializeReadService(); host.Opened += host_Opened; host.Open(); foreach (var se in host.Description.Endpoints) { var SUGrid = new ServerUtilsGrid(); SUGrid.ColDateTime = Convert.ToString(DateTime.Now); SUGrid.ColBinding = se.Binding.Name.ToString(); SUGrid.ColAddress = se.Address.ToString(); _ServerUtilsGrid.Add(SUGrid); } GridControl1.DataSource = _ServerUtilsGrid; if (host.State == CommunicationState.Opened) { txtStatus.Caption = "The Server is running"; } } catch (Exception ex) { EventscadaException?.Invoke(this.GetType().Name, ex.Message); } this.Text = "ServerUtils : AdvancedScada"; return(host); }
private void FormServerUtils_Load(object sender, EventArgs e) { try { XCollection.EventChannelCount += ServiceBase_eventChannelCount; } catch (Exception ex) { EventscadaException?.Invoke(this.GetType().Name, ex.Message); } try { host = InitializeTags(true); } catch (Exception ex) { var SUGrid = new ServerUtilsGrid(); SUGrid.ColDateTime = Convert.ToString(DateTime.Now); SUGrid.ColAddress = ex.Message; _ServerUtilsGrid.Add(SUGrid); } }