Beispiel #1
0
        private void FillData(List <Fire_ForestRemoteMonitoring> monitorList)
        {
            this.pagerControl1.Bind();
            this.pagerControl1.bindingSource.DataSource       = monitorList;
            this.pagerControl1.bindingNavigator.BindingSource = this.pagerControl1.bindingSource;
            this.listView1.Items.Clear();

            if (monitorList != null)
            {
                for (int i = 0; i < monitorList.Count; i++)
                {
                    Fire_ForestRemoteMonitoring monitor = monitorList[i];

                    ListViewItem item = new ListViewItem();

                    item.SubItems.Add(monitor.name);
                    item.SubItems.Add((monitor.county == null) ? "" : monitor.county);
                    item.SubItems.Add(monitor.manager);
                    item.SubItems.Add(monitor.longitude.ToString());
                    item.SubItems.Add(monitor.latitude.ToString());

                    item.Tag = monitor;

                    this.listView1.Items.Add(item);
                }
            }
        }
Beispiel #2
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listView1.SelectedItems.Count > 0)
            {
                ListViewItem item = this.listView1.SelectedItems[0];

                if (item.Tag != null && item.Tag is Fire_ForestRemoteMonitoring)
                {
                    this.currentMonitor = item.Tag as Fire_ForestRemoteMonitoring;

                    this.navigationControl1.BtnEdit.Enabled   = true;
                    this.navigationControl1.BtnDelete.Enabled = true;
                }
                else
                {
                    this.currentMonitor = null;

                    this.navigationControl1.BtnDelete.Enabled = false;
                    this.navigationControl1.BtnEdit.Enabled   = false;
                }
            }
            else
            {
                this.currentMonitor = null;

                this.navigationControl1.BtnDelete.Enabled = false;
                this.navigationControl1.BtnEdit.Enabled   = false;
            }
        }
Beispiel #3
0
        public FormMonitor(OperationType type, Fire_ForestRemoteMonitoring monitor = null)
        {
            InitializeComponent();

            this.m_OperationType        = type;
            this.m_Monitor              = monitor;
            this.m_MonitoringController = new MonitoringController();

            this.m_MonitoringController.AddEvent  += m_MonitoringController_AddEvent;
            this.m_MonitoringController.EditEvent += m_MonitoringController_EditEvent;
        }
Beispiel #4
0
        public void EditTest()
        {
            MonitoringController monitoringController;

            // 测试用例1
            monitoringController = new MonitoringController();
            monitoringController.Edit((Fire_ForestRemoteMonitoring)null);
            Assert.IsNotNull((object)monitoringController);
            Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port);

            // 测试用例2
            monitoringController = new MonitoringController();
            Fire_ForestRemoteMonitoring s0 = new Fire_ForestRemoteMonitoring();

            s0.objectid      = 0;
            s0.name          = (string)null;
            s0.address       = (string)null;
            s0.manager       = (string)null;
            s0.phone         = (string)null;
            s0.longitude     = 0;
            s0.latitude      = 0;
            s0.county        = (string)null;
            s0.deviceid      = (string)null;
            s0.ip            = (string)null;
            s0.image         = (byte[])null;
            s0.height        = 0;
            s0.elevation     = 0;
            s0.h_offset      = 0;
            s0.v_offset      = 0;
            s0.cre_time      = (string)null;
            s0.cre_pers      = (string)null;
            s0.mod_time      = (string)null;
            s0.mod_pers      = (string)null;
            s0.shape         = (string)null;
            s0.user_         = (string)null;
            s0.password      = (string)null;
            s0.city          = (string)null;
            s0.channel       = 0;
            s0.Port          = 0;
            s0.picture1      = (string)null;
            s0.picture2      = (string)null;
            s0.video         = (string)null;
            s0.note          = (string)null;
            s0.username      = (string)null;
            s0.id            = (string)null;
            s0.pac           = (string)null;
            s0.mediaByteDict = (Dictionary <string, object>)null;
            s0.mediaFiles    = (List <MediaFile>)null;
            monitoringController.Edit(s0);
            Assert.IsNotNull((object)monitoringController);
            Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port);
        }
Beispiel #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string name      = this.tbxName.Text;
            string address   = this.tbxAddress.Text;
            string manager   = this.tbxManager.Text;
            string phone     = this.tbxPhone.Text;
            double longitude = Convert.ToDouble(this.tbxLongitude.Text);
            double latitude  = Convert.ToDouble(this.tbxLatitude.Text);

            double height    = Convert.ToDouble(this.tbxHeight.Text);
            double elevation = Convert.ToDouble(this.tbxElevation.Text);
            double h_offset  = Convert.ToDouble(this.tbx_h_offset.Text);
            double v_offset  = Convert.ToDouble(this.tbx_v_offset.Text);
            string deviceid  = this.tbx_deviceid.Text.Trim();

            if (this.pacControl1.LocalPac == null || this.pacControl1.LocalPac == "" || this.pacControl1.LocalPac.EndsWith("00"))
            {
                MessageBox.Show(this, "请选择正确的行政区名称", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.tabControl1.SelectedTab = this.tabPage2;
                this.pacControl1.CbxCounty.Focus();
                return;
            }
            if (height == 0)
            {
                MessageBox.Show(this, "请选择正确的云台高度", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.tabControl1.SelectedTab = this.tabPage3;
                this.tbxHeight.Focus();
                this.tbxHeight.SelectAll();
                return;
            }

            #region 可见光


            string ip1       = "";
            int    port1     = 0;
            int    channel1  = 0;
            string user1     = "";
            string password1 = "";

            ip1 = this.tbxIp1.Value;
            if (string.IsNullOrEmpty(ip1))
            {
                MessageBox.Show(this, "请输入可见光IP地址", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tabControl1.SelectedTab = this.tabPage4;
                this.tbxIp1.Focus();
                return;
            }

            try
            {
                if (string.IsNullOrEmpty(this.tbxPort1.Text))
                {
                    MessageBox.Show(this, "请输入可见光连接端口", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    tabControl1.SelectedTab = this.tabPage4;

                    this.tbxPort1.SelectAll();
                    this.tbxPort1.Focus();

                    return;
                }

                port1 = Convert.ToInt32(this.tbxPort1.Text.Trim());
            }
            catch
            {
            }

            channel1 = Convert.ToInt32(this.cbxChannel1.SelectedValue);

            user1 = this.tbxUser1.Text.Trim();
            if (string.IsNullOrEmpty(user1))
            {
                MessageBox.Show(this, "请输入可见光连接用户名", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                tabControl1.SelectedTab = this.tabPage4;

                this.tbxUser1.SelectAll();
                this.tbxUser1.Focus();
                return;
            }

            password1 = this.tbxPassword1.Text.Trim();
            if (string.IsNullOrEmpty(password1))
            {
                MessageBox.Show(this, "请输入可见光连接密码", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                tabControl1.SelectedTab = this.tabPage4;

                this.tbxPassword1.SelectAll();
                this.tbxPassword1.Focus();
                return;
            }

            #endregion

            #region 近红外



            string ip2       = " ";
            int    port2     = 0;
            int    channel2  = 1;
            string user2     = " ";
            string password2 = " ";



            if (this.checkBox1.Checked)
            {
                ip2 = this.tbxIp2.Value;
                if (string.IsNullOrEmpty(ip2))
                {
                    MessageBox.Show(this, "请输入近红外IP地址", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    tabControl1.SelectedTab = this.tabPage5;
                    this.tbxIp2.Focus();
                    return;
                }

                try
                {
                    if (string.IsNullOrEmpty(this.tbxPort2.Text))
                    {
                        MessageBox.Show(this, "请输入可见光连接端口", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                        tabControl1.SelectedTab = this.tabPage5;

                        this.tbxPort2.SelectAll();
                        this.tbxPort2.Focus();

                        return;
                    }

                    port2 = Convert.ToInt32(this.tbxPort2.Text.Trim());
                }
                catch
                {
                }

                channel2 = Convert.ToInt32(this.cbxChannel2.SelectedValue);

                user2 = this.tbxUser2.Text.Trim();
                if (string.IsNullOrEmpty(user2))
                {
                    MessageBox.Show(this, "请输入可见光连接用户名", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    tabControl1.SelectedTab = this.tabPage5;

                    this.tbxUser2.SelectAll();
                    this.tbxUser2.Focus();
                    return;
                }

                password2 = this.tbxPassword2.Text.Trim();
                if (string.IsNullOrEmpty(password2))
                {
                    MessageBox.Show(this, "请输入可见光连接密码", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    tabControl1.SelectedTab = this.tabPage5;

                    this.tbxPassword2.SelectAll();
                    this.tbxPassword2.Focus();
                    return;
                }
            }

            #endregion

            if (m_OperationType == OperationType.Add)
            {
                this.m_Monitor = new Fire_ForestRemoteMonitoring();
            }

            m_Monitor.name      = name;
            m_Monitor.address   = address;
            m_Monitor.manager   = manager;
            m_Monitor.phone     = phone;
            m_Monitor.pac       = this.pacControl1.LocalPac;
            m_Monitor.longitude = longitude;
            m_Monitor.latitude  = latitude;
            m_Monitor.shape     = GDALHelper.LngLatToWktPoint(this.m_Monitor.longitude, this.m_Monitor.latitude);
            m_Monitor.county    = this.pacControl1.CbxCounty.Text;
            m_Monitor.deviceid  = this.tbx_deviceid.Text;

            m_Monitor.height    = height;
            m_Monitor.elevation = elevation;
            m_Monitor.h_offset  = h_offset;
            m_Monitor.v_offset  = v_offset;
            m_Monitor.deviceid  = deviceid;


            m_Monitor.ip       = ip1;
            m_Monitor.Port     = port1;
            m_Monitor.channel  = channel1;
            m_Monitor.user_    = user1;
            m_Monitor.username = user1;
            m_Monitor.password = password1;

            if (this.m_OperationType == OperationType.Add)
            {
                //m_Monitor.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                m_Monitor.cre_pers = GlobeHelper.Instance.User.name;

                this.m_MonitoringController.Add(m_Monitor);
            }
            else
            {
                //m_Monitor.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                m_Monitor.mod_pers = GlobeHelper.Instance.User.name;

                this.m_MonitoringController.Edit(m_Monitor);
            }
        }