/// <summary> /// Initializes the device data refresh process. /// </summary> private void InitRefresh() { dataBox.AgentClient = environment.AgentClient; if (dataBox.AgentClient == null) { dataBox.SetFirstLine(CommShellPhrases.ConnectionUndefined); tmrRefresh.Interval = ScadaUiUtils.LogRemoteRefreshInterval; btnSendCommand.Enabled = false; lblCommandInfo.Visible = false; } else { dataBox.SetFirstLine(CommShellPhrases.Loading); string dataFileName = CommUtils.GetDeviceDataFileName(kp.Number); if (dataBox.AgentClient.IsLocal) { tmrRefresh.Interval = ScadaUiUtils.LogLocalRefreshInterval; dataBox.LogFileName = Path.Combine(environment.AppDirs.LogDir, dataFileName); btnSendCommand.Enabled = true; lblCommandInfo.Visible = false; } else { tmrRefresh.Interval = ScadaUiUtils.LogRemoteRefreshInterval; dataBox.LogPath = new RelPath(ConfigParts.Comm, AppFolder.Log, dataFileName); btnSendCommand.Enabled = false; lblCommandInfo.Visible = true; } } }
/// <summary> /// Initializes the log refresh process. /// </summary> private void InitRefresh() { IAgentClient agentClient = environment.AgentClient; stateBox.AgentClient = agentClient; logBox.AgentClient = agentClient; if (agentClient == null) { stateBox.SetFirstLine(CommShellPhrases.ConnectionUndefined); logBox.SetFirstLine(CommShellPhrases.ConnectionUndefined); tmrRefresh.Interval = ScadaUiUtils.LogRemoteRefreshInterval; } else { stateBox.SetFirstLine(CommShellPhrases.Loading); logBox.SetFirstLine(CommShellPhrases.Loading); if (agentClient.IsLocal) { tmrRefresh.Interval = ScadaUiUtils.LogLocalRefreshInterval; stateBox.LogFileName = Path.Combine(environment.AppDirs.LogDir, CommUtils.AppStateFileName); logBox.LogFileName = Path.Combine(environment.AppDirs.LogDir, CommUtils.AppLogFileName); } else { tmrRefresh.Interval = ScadaUiUtils.LogRemoteRefreshInterval; stateBox.LogPath = new RelPath(ConfigParts.Comm, AppFolder.Log, CommUtils.AppStateFileName); logBox.LogPath = new RelPath(ConfigParts.Comm, AppFolder.Log, CommUtils.AppLogFileName); } } }
/// <summary> /// Initializes the log refresh process. /// </summary> private void InitRefresh() { IAgentClient agentClient = environment.AgentClient; stateBox.AgentClient = agentClient; logBox.AgentClient = agentClient; if (agentClient == null) { stateBox.SetFirstLine(CommShellPhrases.SetProfile); logBox.SetFirstLine(CommShellPhrases.SetProfile); tmrRefresh.Interval = ScadaUiUtils.LogRemoteRefreshInterval; } else { stateBox.SetFirstLine(CommShellPhrases.Loading); logBox.SetFirstLine(CommShellPhrases.Loading); string stateFileName = CommUtils.GetLineStateFileName(commLine.Number); string logFileName = CommUtils.GetLineLogFileName(commLine.Number); if (agentClient.IsLocal) { tmrRefresh.Interval = ScadaUiUtils.LogLocalRefreshInterval; stateBox.LogFileName = Path.Combine(environment.AppDirs.LogDir, stateFileName); logBox.LogFileName = Path.Combine(environment.AppDirs.LogDir, logFileName); } else { tmrRefresh.Interval = ScadaUiUtils.LogRemoteRefreshInterval; stateBox.LogPath = new RelPath(ConfigParts.Comm, AppFolder.Log, stateFileName); logBox.LogPath = new RelPath(ConfigParts.Comm, AppFolder.Log, logFileName); } } }
/// <summary> /// Updates the Agent client of the log box. /// </summary> private void UpdateAgentClient() { IAgentClient agentClient = adminContext.MainForm.GetAgentClient(ChildFormTag?.TreeNode, false); dataBox.AgentClient = agentClient; if (agentClient == null) { dataBox.SetFirstLine(AdminPhrases.AgentNotEnabled); btnSendCommand.Enabled = false; } else { dataBox.SetFirstLine(AdminPhrases.FileLoading); btnSendCommand.Enabled = true; } }
/// <summary> /// Updates the Agent clients of the log boxes. /// </summary> private void UpdateAgentClients() { IAgentClient agentClient = adminContext.MainForm.GetAgentClient(ChildFormTag?.TreeNode, false); stateBox.AgentClient = agentClient; logBox.AgentClient = agentClient; if (agentClient == null) { stateBox.SetFirstLine(AdminPhrases.AgentNotEnabled); logBox.SetFirstLine(AdminPhrases.AgentNotEnabled); } else { stateBox.SetFirstLine(AdminPhrases.FileLoading); logBox.SetFirstLine(AdminPhrases.FileLoading); } }