Beispiel #1
0
        private void checkedListBoxDistrict_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            DistrictCheckedList.Clear();

            foreach (var item in checkedListBoxDistrict.CheckedItems)
            {
                DistrictCheckedList.Add(item as District);
            }

            if (e.NewValue == CheckState.Unchecked)
            {
                DistrictCheckedList.Remove(checkedListBoxDistrict.Items[e.Index] as District);
            }
            else
            {
                DistrictCheckedList.Add(checkedListBoxDistrict.Items[e.Index] as District);
            }

            if (isNotUpdateDistrictAll)
            {
                return;
            }

            bool isAllChecked = checkedListBoxDistrict.Items.Count == DistrictCheckedList.Count();

            RefreshRegionCheckedBox();

            textBoxDistrict.Text = isAllChecked ? "Все" : String.Join(";", DistrictCheckedList.Select(x => x.Title));
        }
Beispiel #2
0
        private void checkBoxDistrictAll_CheckedChanged(object sender, EventArgs e)
        {
            isNotUpdateDistrictAll = true;
            SetItemChecked(this.checkedListBoxDistrict, this.checkBoxDistrictAll.Checked, ref this.isNotUpdateDistrictAll);

            DistrictCheckedList.Clear();

            if (checkBoxDistrictAll.Checked)
            {
                foreach (var item in checkedListBoxDistrict.Items)
                {
                    DistrictCheckedList.Add(item as District);
                }
            }

            this.textBoxOperator.Text = "Все";
        }