private void NewAddress()
        {
            var frm = new FrmGroupAddress(DataStatus.Add)
            {
                Address = new EdGroupAddress()
            };
            var dlgResult = frm.ShowDialog(this);

            if (dlgResult == DialogResult.OK)
            {
                // 当前地址了列表是否为空
                if (MyCache.GroupAddressTable != null)
                {
                    // 判断地址是否冲突
                    if (CheckUnique(MyCache.GroupAddressTable, frm.Address) == true)
                    {
                        MyCache.GroupAddressTable.Add(frm.Address);
                        //dgvGroupAddress.DataSource = MyCache.GroupAddressTable;
                        LoadAllAddress();
                        //Changed = true;
                    }
                    else
                    {
                        MessageBox.Show(ResourceMng.GetString("Message19"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
        /// <summary>
        /// 修改组地址信息
        /// </summary>
        private void ModifyAddress()
        {
            if (this.dgvGroupAddress.SelectedRows.Count > 0)
            {
                int rowIndex = this.dgvGroupAddress.SelectedRows[0].Cells[0].RowIndex;
                var item     = this.dgvGroupAddress.SelectedRows[0].DataBoundItem as MgGroupAddress;
                if (null != item)
                {
                    FrmGroupAddress frm = new FrmGroupAddress(DataStatus.Modify);
                    frm.Address = item;
                    var dlgResult = frm.ShowDialog(this);

                    if (dlgResult == DialogResult.OK)
                    {
                        /* 刷新修改的行 */
                        DisplayAllAdress();

                        this.Changed = true;
                    }
                }
            }
        }
        /// <summary>
        /// 修改组地址信息
        /// </summary>
        private void ModifyAddress()
        {
            if (this.dgvGroupAddress.SelectedRows.Count > 0)
            {
                int            rowIndex = this.dgvGroupAddress.SelectedRows[0].Cells[0].RowIndex;
                var            item     = this.dgvGroupAddress.SelectedRows[0].DataBoundItem as MgGroupAddress;
                EdGroupAddress address  = MyCache.GetGroupAddress(item.Id);
                if (null != address)
                {
                    FrmGroupAddress frm = new FrmGroupAddress(DataStatus.Modify);
                    frm.Address = address;
                    var dlgResult = frm.ShowDialog(this);

                    if (dlgResult == DialogResult.OK)
                    {
                        /* 刷新修改的行 */
                        MgGroupAddress disAddress = new MgGroupAddress(frm.Address);
                        this.dgvGroupAddress.Rows[rowIndex].Cells[1].Value  = disAddress.Id;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[2].Value  = disAddress.Name;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[3].Value  = disAddress.KnxAddress;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[4].Value  = disAddress.DPTName;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[5].Value  = disAddress.IsCommunication;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[6].Value  = disAddress.IsRead;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[7].Value  = disAddress.IsWrite;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[8].Value  = disAddress.IsTransmit;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[9].Value  = disAddress.IsUpgrade;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[10].Value = disAddress.Priority;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[11].Value = disAddress.DefaultValue;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[12].Value = disAddress.ReadTimeSpan;

                        this.dgvGroupAddress.EndEdit();

                        //Changed = true;
                    }
                }
            }
        }
        private void NewAddress()
        {
            var frm = new FrmGroupAddress(DataStatus.Add)
            {
                Address = new EdGroupAddress()
            };
            var dlgResult = frm.ShowDialog(this);

            if (dlgResult == DialogResult.OK)
            {
                // 判断地址是否冲突
                if (CheckUnique(this.MgAddressList, frm.Address) == true)
                {
                    this.MgAddressList.Add(new MgGroupAddress(frm.Address));
                    DisplayAllAdress();

                    this.Changed = true;
                }
                else
                {
                    MessageBox.Show(UIResMang.GetString("Message19"), UIResMang.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 5
0
        private void NewAddress()
        {
            var frm = new FrmGroupAddress(DataStatus.Add) { Address = new EdGroupAddress() };
            var dlgResult = frm.ShowDialog(this);

            if (dlgResult == DialogResult.OK)
            {
                // 当前地址了列表是否为空
                if (MyCache.GroupAddressTable != null)
                {
                    // 判断地址是否冲突
                    if (CheckUnique(MyCache.GroupAddressTable, frm.Address) == true)
                    {
                        MyCache.GroupAddressTable.Add(frm.Address);
                        //dgvGroupAddress.DataSource = MyCache.GroupAddressTable;
                        LoadAllAddress();
                        //Changed = true;
                    }
                    else
                    {
                        MessageBox.Show(ResourceMng.GetString("Message19"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 修改组地址信息
        /// </summary>
        private void ModifyAddress()
        {
            if (this.dgvGroupAddress.SelectedRows.Count > 0)
            {
                int rowIndex = this.dgvGroupAddress.SelectedRows[0].Cells[0].RowIndex;
                var item = this.dgvGroupAddress.SelectedRows[0].DataBoundItem as MgGroupAddress;
                EdGroupAddress address = MyCache.GetGroupAddress(item.Id);
                if (null != address)
                {
                    FrmGroupAddress frm = new FrmGroupAddress(DataStatus.Modify);
                    frm.Address = address;
                    var dlgResult = frm.ShowDialog(this);

                    if (dlgResult == DialogResult.OK)
                    {
                        /* 刷新修改的行 */
                        MgGroupAddress disAddress = new MgGroupAddress(frm.Address);
                        this.dgvGroupAddress.Rows[rowIndex].Cells[1].Value = disAddress.Id;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[2].Value = disAddress.Name;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[3].Value = disAddress.KnxAddress;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[4].Value = disAddress.DPTName;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[5].Value = disAddress.IsCommunication;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[6].Value = disAddress.IsRead;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[7].Value = disAddress.IsWrite;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[8].Value = disAddress.IsTransmit;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[9].Value = disAddress.IsUpgrade;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[10].Value = disAddress.Priority;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[11].Value = disAddress.DefaultValue;
                        this.dgvGroupAddress.Rows[rowIndex].Cells[12].Value = disAddress.ReadTimeSpan;

                        this.dgvGroupAddress.EndEdit();

                        //Changed = true;
                    }
                }
            }
        }