private void RefreshDataTable(List <ImGroupAddr> data) { var sortData = (from i in data orderby KNXAddressHelper.StringToAddress(i.KnxAddress) ascending, i.KnxAddress select i).ToList(); this.dataGridView.DataSource = new BindingList <ImGroupAddr>(sortData); FormatGrid(this.dataGridView); }
/// <summary> /// 刷新组地址表 dgvGroupAddress /// </summary> private void refreshDataTable(List <MgGroupAddress> data) { // 排序 var sortData = (from i in data orderby KNXAddressHelper.StringToAddress(i.KnxAddress) ascending, i.KnxAddress select i).ToList(); this.dgvGroupAddress.DataSource = new BindingList <MgGroupAddress>(sortData); FormatGrid(dgvGroupAddress); }
private void RefreashTable(List <PcGroupAddress> data) { var sort1 = (from i in data orderby KNXAddressHelper.StringToAddress(i.KnxAddress) ascending, i.KnxAddress select i).ToList(); // 排序 var sort2 = (from i in sort1 orderby i.Selected descending, i.KnxAddress select i).ToList(); this.dgvData.DataSource = new BindingList <PcGroupAddress>(sort2); FormatGrid(dgvData); }
private void RefreashTable(List <MgGroupAddress> data, List <MgGroupAddress> Selected) { data = (from i in data orderby KNXAddressHelper.StringToAddress(i.KnxAddress) ascending, i.KnxAddress select i).ToList(); Selected = (from i in Selected orderby KNXAddressHelper.StringToAddress(i.KnxAddress) ascending, i.KnxAddress select i).ToList(); data.InsertRange(0, Selected); this.dgvData.DataSource = new BindingList <MgGroupAddress>(data); FormatGrid(dgvData); }
private void LoadAllAddress() { var data = listAddress.ToList(); // 排序 var sortData = (from i in data orderby KNXAddressHelper.StringToAddress(i.KnxAddress) ascending, i.KnxAddress select i).ToList(); this.dataGridView.DataSource = new BindingList <ImGroupAddr>(sortData); FormatGrid(this.dataGridView); }
private void btnOK_Click(object sender, EventArgs e) { Address.Name = this.txtName.Text.Trim(); try { KNXAddressHelper.StringToAddress(this.txtWriteAddress.Text.Trim()); } catch (Exception ex) { MessageBox.Show(ex.Message, UIResMang.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); this.txtWriteAddress.Focus(); return; } Address.KnxAddress = this.txtWriteAddress.Text.Trim(); // 数据类型 if (string.IsNullOrWhiteSpace(this.btnDPTName.Text)) { MessageBox.Show(UIResMang.GetString("Message46"), UIResMang.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); this.btnDPTName.Focus(); return; } DatapointType dpt = DPTHelper.GetTypeNode(this.btnDPTName.Text); //this.tvDPTName.SelectedNode as DatapointType; if (null != dpt) { Address.KnxMainNumber = dpt.KNXMainNumber; Address.KnxSubNumber = dpt.KNXSubNumber; Address.DPTName = dpt.Text; Address.Type = dpt.Type; } // 优先级 var selectedTextPriority = this.cmbPriority.SelectedItem; if (selectedTextPriority != null) { KNXPriority priority = KNXPriority.Low; Enum.TryParse(selectedTextPriority.ToString(), out priority); Address.Priority = priority; } Address.IsCommunication = this.cbxCommunication.Checked; Address.IsRead = this.cbxRead.Checked; Address.IsWrite = this.cbxWrite.Checked; Address.IsTransmit = this.cbxTransmit.Checked; Address.IsUpgrade = this.cbxUpgrade.Checked; this.DialogResult = DialogResult.OK; }
public KNXGroupAddress ToKnx() { var address = new KNXGroupAddress(); address.Id = this.Id; address.Name = this.Name; address.KnxAddress = KNXAddressHelper.StringToAddress(this.KnxAddress); address.Type = (int)this.Type; address.KnxMainNumber = this.KnxMainNumber; address.KnxSubNumber = this.KnxSubNumber; //address.KnxSize = this.KnxSize; //address.KnxDPTName = this.KnxDPTName; //address.Type = (int)this.Type; address.DPTName = this.DPTName; //address.DPTText = this.DPTText; address.DefaultValue = this.DefaultValue; address.Priority = (int)this.Priority; //address.WireNumber = this.WireNumber; address.IsCommunication = this.IsCommunication; address.IsRead = this.IsRead; address.IsWrite = this.IsWrite; address.IsTransmit = this.IsTransmit; address.IsUpgrade = this.IsUpgrade; //address.ReadTimeSpan = this.ReadTimeSpan; //address.Tip = this.Tip; address.Actions = this.Actions.ToKnx(); //address.Actions = new List<DatapointAction>(); //if (null != address.Actions) //{ // foreach (DatapointActionNode node in this.Actions) // { // address.Actions.Add(node.ToKnx()); // } //} return(address); }