コード例 #1
0
        private void SearchAddress()
        {
            _search = true;

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

            if (!string.IsNullOrWhiteSpace(searchText))
            {
                var data = new List<PcGroupAddress>();

                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 PcGroupAddress(it);

                    if (SelectedAddress != null && SelectedAddress.ContainsKey(temp.Id))
                    {
                        temp.Selected = true;
                    }

                    data.Add(temp);
                }

                RefreashTable(data);
            }
        }
コード例 #2
0
        private void LoadAllAddress()
        {
            _search = false;

            var data = new List<PcGroupAddress>();

            foreach (var it in MyCache.GroupAddressTable)
            {
                //if (((AddressType.Read == this.PickType) && (it.IsCommunication && it.IsRead)) ||
                //    ((AddressType.Write == this.PickType) && (it.IsCommunication && it.IsWrite)))
                //{
                    if (this.NeedActions && ((null == it.Actions) || (it.Actions.Count <= 0)))
                    {
                        continue;
                    }

                    var temp = new PcGroupAddress(it);

                    if (SelectedAddress != null && SelectedAddress.ContainsKey(temp.Id))
                    {
                        temp.Selected = true;
                        temp.DefaultValue = SelectedAddress[temp.Id].DefaultValue;
                    }

                    data.Add(temp);
                //}
            }

            RefreashTable(data);
        }