예제 #1
0
        private void checkedListBoxRegion_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            RegionCheckedList.Clear();

            foreach (var item in checkedListBoxRegion.CheckedItems)
            {
                RegionCheckedList.Add(item as Region);
            }

            if (e.NewValue == CheckState.Unchecked)
            {
                RegionCheckedList.Remove(checkedListBoxRegion.Items[e.Index] as Region);
            }
            else
            {
                RegionCheckedList.Add(checkedListBoxRegion.Items[e.Index] as Region);
            }

            if (isNotUpdateRegionAll)
            {
                return;
            }

            RefreshOperatorCheckedBox();



            bool isAllChecked = checkedListBoxRegion.Items.Count == RegionCheckedList.Count();


            textBoxRegion.Text = isAllChecked ? "Все" : String.Join(";", RegionCheckedList.Select(x => x.Title));
        }
예제 #2
0
        private void RefreshRegionCheckedBox()
        {
            checkedListBoxRegion.Items.Clear();
            RegionCheckedList.Clear();

            var regionList = new List <Region>();

            foreach (var district in DistrictCheckedList)
            {
                regionList.AddRange(district.Regions);
            }

            checkedListBoxRegion.Items.AddRange(regionList.Distinct().OrderBy(x => x.Title).ToArray());
        }
예제 #3
0
        private void checkBoxRegionAll_CheckedChanged(object sender, EventArgs e)
        {
            isNotUpdateRegionAll = true;

            RegionCheckedList.Clear();

            if (checkBoxRegionAll.Checked)
            {
                foreach (var item in checkedListBoxRegion.Items)
                {
                    RegionCheckedList.Add(item as Region);
                }
            }
            SetItemChecked(this.checkedListBoxRegion, this.checkBoxRegionAll.Checked, ref this.isNotUpdateRegionAll);
            this.textBoxRegion.Text = "Все";
        }