Example #1
0
 public override object EditValue(
     ITypeDescriptorContext context,
     System.IServiceProvider provider,
     object value)
 {
     if (provider != null)
     {
         IWindowsFormsEditorService service1 = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         ITypeDiscoveryService      service2 = (ITypeDiscoveryService)provider.GetService(typeof(ITypeDiscoveryService));
         IDesignerHost           service3    = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
         IComponentChangeService service4    = (IComponentChangeService)provider.GetService(typeof(IComponentChangeService));
         ISelectionService       service5    = (ISelectionService)provider.GetService(typeof(ISelectionService));
         if (service1 == null)
         {
             return(value);
         }
         RadItemOwnerCollection collection = value as RadItemOwnerCollection;
         RadGalleryGroupFilter  instance   = context.Instance as RadGalleryGroupFilter;
         if (collection == null || instance == null)
         {
             return(value);
         }
         if (instance.Owner == null && service5 != null && service5.PrimarySelection != null)
         {
             instance.Owner = (RadGalleryElement)service5.PrimarySelection;
         }
         RadGalleryElement owner = instance.Owner;
         if (owner == null)
         {
             return(value);
         }
         if (this.filteredItemsUI == null)
         {
             this.filteredItemsUI = new FilteredItemsEditorUI();
         }
         service4.OnComponentChanging(context.Instance, (MemberDescriptor)TypeDescriptor.GetProperties(context.Instance)["Items"]);
         this.filteredItemsUI.Start(service1, service2, service3, collection, instance, owner);
         if (service1.ShowDialog((Form)this.filteredItemsUI) == DialogResult.OK)
         {
             this.filteredItemsUI.End();
             value = (object)this.filteredItemsUI.Value;
             service4.OnComponentChanged(context.Instance, (MemberDescriptor)TypeDescriptor.GetProperties(context.Instance)["Items"], (object)null, (object)null);
             return(value);
         }
     }
     return(value);
 }
Example #2
0
        private void PopulateAvailableItems()
        {
            ArrayList list1 = new ArrayList();

            //load unassingned items
            foreach (RadGalleryGroupItem item1 in defaultElement.Groups)
            {
                list1.Add(item1);
            }
            foreach (RadGalleryGroupFilter filter1 in defaultElement.Filters)
            {
                FilteredItemsEditorUI.RemoveItemsContainedInFilter(list1, filter1.Items);
            }
            for (int i = 0; i < list1.Count; i++)
            {
                list1[i] = new InstanceItem((list1[i] as RadGalleryGroupItem), null, defaultElement);
            }

            //load assingned to other groups items
            ArrayList list2 = new ArrayList();

            foreach (RadGalleryGroupFilter filter1 in defaultElement.Filters)
            {
                if (filter1 != defaultFilter)
                {
                    foreach (RadGalleryGroupItem item1 in filter1.Items)
                    {
                        list2.Add(new InstanceItem(item1, filter1, defaultElement));
                    }
                }
            }

            // set the unassigned items box
            this.AvailableItemsBox.BeginUpdate();
            this.AvailableItemsBox.Items.Clear();
            this.AvailableItemsBox.Items.AddRange(list1.ToArray());
            this.AvailableItemsBox.EndUpdate();

            // set the assigned to other groups items box
            this.AvailableItemsBox2.BeginUpdate();
            this.AvailableItemsBox2.Items.Clear();
            this.AvailableItemsBox2.Items.AddRange(list2.ToArray());
            this.AvailableItemsBox2.EndUpdate();

            this.SetButtonsEnabledState();
        }
        private void PopulateAvailableItems()
        {
            ArrayList items = new ArrayList();

            foreach (RadGalleryGroupItem group in (RadItemCollection)this.defaultElement.Groups)
            {
                items.Add((object)group);
            }
            foreach (RadGalleryGroupFilter filter in (RadItemCollection)this.defaultElement.Filters)
            {
                FilteredItemsEditorUI.RemoveItemsContainedInFilter(items, filter.Items);
            }
            for (int index = 0; index < items.Count; ++index)
            {
                items[index] = (object)new FilteredItemsEditorUI.InstanceItem(items[index] as RadGalleryGroupItem, (RadGalleryGroupFilter)null, this.defaultElement);
            }
            ArrayList arrayList = new ArrayList();

            foreach (RadGalleryGroupFilter filter in (RadItemCollection)this.defaultElement.Filters)
            {
                if (filter != this.defaultFilter)
                {
                    foreach (RadGalleryGroupItem instance in (RadItemCollection)filter.Items)
                    {
                        arrayList.Add((object)new FilteredItemsEditorUI.InstanceItem(instance, filter, this.defaultElement));
                    }
                }
            }
            this.AvailableItemsBox.BeginUpdate();
            this.AvailableItemsBox.Items.Clear();
            this.AvailableItemsBox.Items.AddRange(items.ToArray());
            this.AvailableItemsBox.EndUpdate();
            this.AvailableItemsBox2.BeginUpdate();
            this.AvailableItemsBox2.Items.Clear();
            this.AvailableItemsBox2.Items.AddRange(arrayList.ToArray());
            this.AvailableItemsBox2.EndUpdate();
            this.SetButtonsEnabledState();
        }