Пример #1
0
 protected override void OnItemCheck(System.Windows.Forms.ItemCheckEventArgs e)
 {
     if (!mCreating && mReadOnly)
     {
         e.NewValue = e.CurrentValue;
     }
     base.OnItemCheck(e);
 }
 //加入事件
 void checkedListBox1_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
 {
     if (e.Index == 0 & e.CurrentValue == 0)
     {
         e.NewValue = 0;
     }
     //throw new System.NotImplementedException();
 }
Пример #3
0
        void checkedListBox_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
        {
            if (inEventProcess)
            {
                return;
            }

            inEventProcess = true;

            // 'Select All'
            if (e.Index == 0)
            {
                if (CheckedListBox.GetItemCheckState(0) != e.NewValue)
                {
                    for (int i = 1; i < CheckedListBox.Items.Count; i++)
                    {
                        CheckedListBox.SetItemChecked(i, e.NewValue == System.Windows.Forms.CheckState.Checked);
                        SelectedCount = CheckedListBox.Items.Count - 1;
                    }

                    if (e.NewValue == System.Windows.Forms.CheckState.Checked)
                    {
                        SelectedCount = CheckedListBox.Items.Count - 1;
                    }
                    else
                    {
                        SelectedCount = 0;
                    }
                }
            }
            // others else 'Select All'
            else if (e.NewValue != CheckedListBox.GetItemCheckState(0))
            {
                CheckedListBox.SetItemCheckState(0, System.Windows.Forms.CheckState.Indeterminate);

                if (e.NewValue != System.Windows.Forms.CheckState.Checked)
                {
                    SelectedCount--;

                    if (SelectedCount <= 0)
                    {
                        CheckedListBox.SetItemChecked(0, false);
                        SelectedCount = 0;
                    }
                }
                else
                {
                    SelectedCount++;

                    if (SelectedCount >= CheckedListBox.Items.Count - 1)
                    {
                        CheckedListBox.SetItemChecked(0, true);
                    }
                }
            }

            inEventProcess = false;
        }
        public void StoreAttriubteIfKeyExistsInputEntityAttributesDoesNotContainEntityLogicalName()
        {
            var entityLogicalName    = "contact";
            var attributeLogicalName = "contactid";
            var itemCheckEventArgs   = new System.Windows.Forms.ItemCheckEventArgs(0, System.Windows.Forms.CheckState.Unchecked, System.Windows.Forms.CheckState.Checked);

            FluentActions.Invoking(() => systemUnderTest.StoreAttriubteIfKeyExists(attributeLogicalName, itemCheckEventArgs, inputEntityAttributes, entityLogicalName))
            .Should()
            .Throw <KeyNotFoundException>();
        }
Пример #5
0
        public void StoreRelationshipIfKeyExistsInputEntityRelationshipsDoesNotContainEntityLogicalName()
        {
            var relationshipLogicalName = "contact_account";
            var inputEntityLogicalName  = "contact";

            var itemCheckEventArgs = new System.Windows.Forms.ItemCheckEventArgs(0, System.Windows.Forms.CheckState.Unchecked, System.Windows.Forms.CheckState.Checked);

            FluentActions.Invoking(() => systemUnderTest.StoreRelationshipIfKeyExists(relationshipLogicalName, itemCheckEventArgs, inputEntityLogicalName, inputEntityRelationships))
            .Should()
            .Throw <KeyNotFoundException>();
        }
        public void StoreAttributeIfRequiresKeyCurrentValueIsChecked()
        {
            var entityLogicalName    = "contact";
            var attributeLogicalName = "contactid";
            var itemCheckEventArgs   = new System.Windows.Forms.ItemCheckEventArgs(0, System.Windows.Forms.CheckState.Unchecked, System.Windows.Forms.CheckState.Checked);

            FluentActions.Invoking(() => systemUnderTest.StoreAttributeIfRequiresKey(attributeLogicalName, itemCheckEventArgs, inputEntityAttributes, entityLogicalName))
            .Should()
            .NotThrow();

            inputEntityAttributes.Count.Should().Be(1);
            inputEntityAttributes[entityLogicalName].Count.Should().Be(0);
        }
Пример #7
0
        public void StoreRelationshipIfRequiresKeyCurrentValueChecked()
        {
            var relationshipLogicalName = "contact_account";
            var inputEntityLogicalName  = "contact";

            var itemCheckEventArgs = new System.Windows.Forms.ItemCheckEventArgs(0, System.Windows.Forms.CheckState.Unchecked, System.Windows.Forms.CheckState.Checked);

            FluentActions.Invoking(() => systemUnderTest.StoreRelationshipIfRequiresKey(relationshipLogicalName, itemCheckEventArgs, inputEntityLogicalName, inputEntityRelationships))
            .Should()
            .NotThrow();

            inputEntityRelationships[inputEntityLogicalName].Contains(relationshipLogicalName).Should().BeFalse();
        }
Пример #8
0
 /// <summary>
 ///
 /// </summary>
 void _listView_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
 {
     System.Windows.Forms.ListViewItem item          = _listView.Items[e.Index];
     CadKit.Interfaces.IImageLayer     addImageLayer = CadKit.Documents.Manager.Instance.ActiveDocument as CadKit.Interfaces.IImageLayer;
     if (addImageLayer != null)
     {
         if (e.NewValue == System.Windows.Forms.CheckState.Checked)
         {
             addImageLayer.showImageLayer(item.Text);
         }
         else if (e.NewValue == System.Windows.Forms.CheckState.Unchecked)
         {
             addImageLayer.hideImageLayer(item.Text);
         }
     }
 }
        public void StoreAttriubteIfKeyExistsCurrentValueIsChecked()
        {
            var entityLogicalName    = "contact";
            var attributeLogicalName = "contactid";
            var attributeSet         = new HashSet <string>();

            inputEntityAttributes.Add(entityLogicalName, attributeSet);

            var itemCheckEventArgs = new System.Windows.Forms.ItemCheckEventArgs(0, System.Windows.Forms.CheckState.Unchecked, System.Windows.Forms.CheckState.Checked);

            FluentActions.Invoking(() => systemUnderTest.StoreAttriubteIfKeyExists(attributeLogicalName, itemCheckEventArgs, inputEntityAttributes, entityLogicalName))
            .Should()
            .NotThrow();

            inputEntityAttributes.Count.Should().Be(1);
            inputEntityAttributes[entityLogicalName].Contains(attributeLogicalName).Should().BeFalse();
        }
Пример #10
0
        public void StoreRelationshipIfKeyExistsCurrentValueIsUnchecked()
        {
            var relationshipLogicalName = "contact_account";
            var inputEntityLogicalName  = "contact";

            var relationshipSet = new HashSet <string>();

            inputEntityRelationships.Add(inputEntityLogicalName, relationshipSet);

            var itemCheckEventArgs = new System.Windows.Forms.ItemCheckEventArgs(0, System.Windows.Forms.CheckState.Checked, System.Windows.Forms.CheckState.Unchecked);

            FluentActions.Invoking(() => systemUnderTest.StoreRelationshipIfKeyExists(relationshipLogicalName, itemCheckEventArgs, inputEntityLogicalName, inputEntityRelationships))
            .Should()
            .NotThrow();

            inputEntityRelationships[inputEntityLogicalName].Contains(relationshipLogicalName).Should().BeTrue();
        }
Пример #11
0
        void EventAllConfigsCLB_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
        {
            System.Windows.Forms.CheckedListBox _ListBox = (System.Windows.Forms.CheckedListBox)sender;
            string configSetting = _ListBox.Items[e.Index].ToString();

            if (configSetting.EndsWith("(Auto Enabled)"))
            {
                configSetting = configSetting.SplitVF("(Auto Enabled)").First();
            }
            if (e.NewValue == System.Windows.Forms.CheckState.Checked)
            {
                _SetConfigString(configSetting, "enabled");
            }
            else if (e.NewValue == System.Windows.Forms.CheckState.Unchecked)
            {
                _SetConfigString(configSetting, "disabled");
            }
            else
            {
                _SetConfigString(configSetting, "enabled(auto)");
            }
        }
Пример #12
0
 void listview_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
 {
 }
Пример #13
0
 private void obj_ItemCheck(System.Object sender, System.Windows.Forms.ItemCheckEventArgs e)
 {
     this.OnChanged(sender);
 }