public virtual void ClearCollection()
 {
     if (_jsonArr != null)
     {
         _jsonArr.Clear();
     }
     base.Clear();
 }
Exemplo n.º 2
0
        private static void ClearStrictCollectionAndDisposesItCommon(MockRepository mocks, CollectionBase collection)
        {
            collection.Clear();
            ((IDisposable)collection).Dispose();

            mocks.ReplayAll();
            CleanCollection(collection);
            mocks.VerifyAll();
        }
        private static void CleanCollection(CollectionBase collection)
        {
            collection.Clear();
            IDisposable disposable = collection as IDisposable;

            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
Exemplo n.º 4
0
        private void ResetItems()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }
            if (ListItems.Count > 0)
            {
                foreach (var item in ListItems)
                {
                    item.IsSelectedChanged -= item_IsSelectedChanged;
                }
                ListItems.Clear();
            }
            if (string.IsNullOrEmpty(SettingType))
            {
                return;
            }
            var setting = UISettings.Current.Items[SettingType];

            if (setting != null && (setting is UISelectSetting))
            {
                var selectSetting = setting as UISelectSetting;

                _CanEdit            = selectSetting.CanUserInput;
                _IsMutiSelect       = selectSetting.CanMutiSelect;
                comboBox.IsEditable = _CanEdit;

                var selects = GetTextItems();
                foreach (var setitem in selectSetting.Items)
                {
                    var item = new UISelectSettingItem
                    {
                        SettingItem = setitem,
                        IsSelected  = selects.FirstOrDefault(s => s.Equals(setitem.Name, StringComparison.OrdinalIgnoreCase)) != null
                    };
                    item.IsSelectedChanged += item_IsSelectedChanged;
                    ListItems.Add(item);
                }
            }
            else
            {
                var selectSetting = new UISelectSetting
                {
                    TargetType    = SettingType,
                    CanMutiSelect = true,
                    CanUserInput  = true,
                    Description   = "自动创建"
                };
                _CanEdit            = selectSetting.CanUserInput;
                _IsMutiSelect       = selectSetting.CanMutiSelect;
                comboBox.IsEditable = _CanEdit;
                UISettings.Current.AddSetting(selectSetting);
            }
        }
Exemplo n.º 5
0
 private void btnDeleteAll_Click(object sender, System.EventArgs e)
 {
     blockCollection.Clear();
     UpdateComboBox(-1);
 }