Beispiel #1
0
 public void InitAllConfigsCLB(System.Windows.Forms.CheckedListBox _ListBox)
 {
     {
         _ListBox.Items.Clear();
         var orderedConfigValues = ConfigValues.OrderBy(ConfigValueSort);
         foreach (var configValue in orderedConfigValues)
         {
             _ListBox.Items.Add(configValue.Key + (configValue.Value.Item1 == "enabled(auto)" ? "(Auto Enabled)" : ""), (configValue.Value.Item1 != "disabled"));
         }
     }
     _ListBox.CheckOnClick = true;
     ConfigValuesChanged  += (string _ConfigName, string _ConfigValue) =>
     {
         _ListBox.BeginInvoke(new Action(() =>
         {
             if (_ConfigName != "ALL_CONFIG_VALUES_CHANGED_UPDATE_ALL")
             {
                 for (int i = 0; i < _ListBox.Items.Count; ++i)
                 {
                     string item = (string)_ListBox.Items[i];
                     if (item.StartsWith(_ConfigName) == true)
                     {
                         if (item == _ConfigName + "(Auto Enabled)" || item == _ConfigName)
                         {
                             if (_ListBox.CheckedIndices.Contains(i) != (_ConfigValue != "disabled"))
                             {
                                 _ListBox.SetItemCheckState(i, (_ConfigValue != "disabled" ? System.Windows.Forms.CheckState.Checked : System.Windows.Forms.CheckState.Unchecked));
                             }
                             _ListBox.Items[i] = _ConfigName;
                             return;
                         }
                     }
                 }
             }
             else
             {
                 _ListBox.Items.Clear();
                 var orderedConfigValues = ConfigValues.OrderBy(ConfigValueSort);
                 foreach (var configValue in orderedConfigValues)
                 {
                     _ListBox.Items.Add(configValue.Key + (configValue.Value.Item1 == "enabled(auto)" ? "(Auto Enabled)" : ""), (configValue.Value.Item1 != "disabled"));
                 }
                 _ListBox.Invalidate();
             }
         }));
     };
     _ListBox.ItemCheck += EventAllConfigsCLB_ItemCheck;
 }