Ejemplo n.º 1
0
        /// <summary>
        /// The LinkDevices method.
        /// </summary>
        private void LinkDevices()
        {
            var linkList   = new List <Device>();
            var unlinkList = new List <Device>();

            foreach (ListViewItem item in lvTagDevices.Items)
            {
                var device = (Device)item.Tag;

                if (item.Checked)
                {
                    if (!CurrentDeviceList.Any(s => device.Id.Contains(s)))
                    {
                        linkList.Add(device);
                    }
                }
                else
                {
                    if (CurrentDeviceList.Any(s => device.Id.Contains(s)))
                    {
                        unlinkList.Add(device);
                    }
                }
            }

            if (linkList.Count > 0)
            {
                SelectedTag.Link(linkList);
            }

            if (unlinkList.Count > 0)
            {
                SelectedTag.Unlink(unlinkList);
            }
        }
Ejemplo n.º 2
0
        public virtual void LoadData()
        {
            DeviceListItem item = new DeviceListItem()
            {
                DataContext = new DeviceListItemViewModel()
                {
                    DeviceItemModel = new ItemModel()
                    {
                        DAccount       = "CB23424323111",
                        DCacheDate     = "2017/08/18-2018/03/13",
                        DCacheDuration = "1天7时",
                        DName          = "张三",
                        DPhoneNumber   = "13888777788",
                        DGender        = "男",
                        DIsBinding     = false
                    }
                }
            };

            CurrentDeviceList.Add(item);

            DeviceListItem item1 = new DeviceListItem()
            {
                DataContext = new DeviceListItemViewModel()
                {
                    DeviceItemModel = new ItemModel()
                    {
                        DAccount       = "CB2342432234",
                        DCacheDate     = "2017/08/20-2018/03/13",
                        DCacheDuration = "10天7时",
                        DName          = "王五",
                        DPhoneNumber   = "13888888888",
                        DGender        = "女",
                        DIsBinding     = false
                    }
                }
            };

            CurrentDeviceList.Add(item1);

            Console.WriteLine("列表元素个数:" + CurrentDeviceList.Count);


            Console.WriteLine("LoadData 方法");
            RaisePropertyChanged("CurrentDeviceList");
        }