示例#1
0
        private bool InitializeAgent()
        {
            Settings.AgentXml = this.IsSecond ? Settings.AgentXml + ".2" : Settings.AgentXml;
            Settings.Instance.LoadSettings();
            Settings s = Settings.Instance;

            if (s.DataCenters.Count() == 0)
            {
                MessageBox.Show("配置错误");
                this.pingLabel.Text = "配置错误";
                return(false);
            }

            Settings.DataCenter2 dc = s.DataCenters[0];
            this.agent              = new DataAgent(dc);
            this.agent.NotifyEvent += this.OnNotify;
            this.agent.DoAuth();

            this.IsDBEnable                = true;
            this.statusLabel.Text          = string.Format("开始:[{0}]", DateTime.Now);
            this.DBTestStripButton.Enabled = false;

            this.addressLabel.Text = string.Format("已连接{0}", dc.BaseUrl);
            this.counterLabel.Text = string.Format("已发送: 0");
            this.uploadLabel.Text  = string.Format("实时数据最后上传时间: {0}", FormatTime(DateTime.Now));

            return(true);
        }
示例#2
0
文件: AgentWindow.cs 项目: oisy/scada
        private bool InitializeAgent()
        {
            Settings.Instance.LoadSettings();
            Settings s = Settings.Instance;

            if (s.DataCenters.Count() == 0)
            {
                this.pingLabel.Text = "配置错误";
                return(false);
            }

            Settings.DataCenter2 dc = s.DataCenters[0];
            this.agent              = new DataAgent(dc);
            this.agent.NotifyEvent += this.OnNotify;
            this.agent.DoAuth();

            this.statusLabel.Text  = string.Format("开始:[{0}]", DateTime.Now);
            this.addressLabel.Text = string.Format("已连接{0}", dc.BaseUrl);
            this.counterLabel.Text = string.Format("已发送: 0");
            this.uploadLabel.Text  = string.Format("实时数据最后上传时间: {0}", FormatTime(DateTime.Now));
            return(true);
        }
示例#3
0
 public DataAgent(Settings.DataCenter2 dataCenter)
 {
     this.DataCenter = dataCenter;
 }