Exemplo n.º 1
0
        private void LoadAllAddress()
        {
            addressList.Clear();

            foreach (var it in MyCache.GroupAddressTable)
            {
                var temp = new MgGroupAddress(it);

                addressList.Add(temp);
            }

            refreshDataTable();
        }
Exemplo n.º 2
0
        private void SearchAddress()
        {
            //_search = true;

            string searchText = this.txtSearch.Text.Trim();

            if (!string.IsNullOrWhiteSpace(searchText))
            {
                addressList.Clear();

                var filterAddress = from i in MyCache.GroupAddressTable where i.Name.IndexOf(searchText, StringComparison.OrdinalIgnoreCase) != -1 select i;

                foreach (var it in filterAddress)
                {
                    var temp = new MgGroupAddress(it);

                    addressList.Add(temp);
                }

                refreshDataTable();
            }
        }
Exemplo n.º 3
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;
                    }
                }
            }
        }