public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_control == null)
            {
                _control = e.GetService <SvnInfoGridControl>();

                if (_control == null)
                {
                    e.Enabled = false;
                    return;
                }
            }

            PropertySort sort = _control.Grid.PropertySort;

            bool categorized = (PropertySort.NoSort != (sort & PropertySort.Categorized));

            if (e.Command == AnkhCommand.SvnInfoAlphabetical)
            {
                e.Checked = !categorized;
            }
            else
            {
                e.Checked = categorized;
            }
        }
Beispiel #2
0
 public SingleObjectEditor(T obj, PropertySort sort)
 {
     InitializeComponent();
     DialogResult           = DialogResult.Cancel;
     PG_Item.PropertySort   = sort;
     PG_Item.SelectedObject = obj;
 }
        private void SetupSortButton(ref ToolStripButton button, ToolStrip owner, int index, PropertySort sort)
        {
            button = owner.Items[index] as ToolStripButton;
            if (button != null)
            {
                var events  = button.GetType().GetProperty(nameof(Events), BindingFlags.NonPublic | BindingFlags.Instance).GetValue(button) as EventHandlerList;
                var head    = events.GetType().GetField("head", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(events);
                var key     = head.GetType().GetField("key", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(head);
                var handler = head.GetType().GetField("handler", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(head) as Delegate;
                events.RemoveHandler(key, handler);

                button.Tag    = sort;
                button.Click += (s_, e_) =>
                {
                    var b = s_ as ToolStripButton;
                    if (b.Tag is PropertySort s)
                    {
                        b.Checked = !b.Checked;
                        if (b.Checked)
                        {
                            PropertySort |= s;
                        }
                        else
                        {
                            PropertySort &= ~s;
                        }
                        RefreshDatasouce();
                    }
                    SetSortButtonsState();
                };
            }
        }
Beispiel #4
0
        private static void PropertySortPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            WpfPropertyGrid pg = source as WpfPropertyGrid;
            PropertySort sort = (PropertySort)e.NewValue;

            bool isAlpha = (sort == PropertySort.Alphabetical || sort == PropertySort.NoSort);
            pg.IsInAlphaViewMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { isAlpha });
        }
Beispiel #5
0
 public SingleObjectEditor(T obj, PropertySort sort)
 {
     InitializeComponent();
     this.TranslateInterface(GameInfo.CurrentLanguage);
     DialogResult           = DialogResult.Cancel;
     PG_Item.PropertySort   = sort;
     PG_Item.SelectedObject = obj;
 }
 internal SingleSelectRootGridEntry(
     PropertyGridView view,
     object value,
     IServiceProvider baseProvider,
     IDesignerHost host,
     PropertyTab tab,
     PropertySort sortType) : this(view, value, null, baseProvider, host, tab, sortType)
 {
 }
        private void propertyGrid1_PropertySortChanged(object sender, EventArgs e)
        {
            PropertySort currentOrder = propertyGrid1.PropertySort;

            if (!inSortUpdate && currentOrder == PropertySort.CategorizedAlphabetical)
            {
                inSortUpdate = true;
                propertyGrid1.PropertySort = PropertySort.Categorized;
                inSortUpdate = false;
            }
        }
 internal SingleSelectRootGridEntry(PropertyGridView gridEntryHost, object value, GridEntry parent, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : base(gridEntryHost.OwnerGrid, parent)
 {
     this.host = host;
     this.gridEntryHost = gridEntryHost;
     this.baseProvider = baseProvider;
     this.tab = tab;
     this.objValue = value;
     this.objValueClassName = TypeDescriptor.GetClassName(this.objValue);
     this.IsExpandable = true;
     base.PropertySort = sortType;
     this.InternalExpanded = true;
 }
        internal SingleSelectRootGridEntry(PropertyGridView gridEntryHost, object value, GridEntry parent, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType)
        : base(gridEntryHost.OwnerGrid, parent) {
            Debug.Assert(value != null,"Can't browse a null object!");
            this.host = host;
            this.gridEntryHost = gridEntryHost;
            this.baseProvider = baseProvider;
            this.tab = tab;
            this.objValue = value;
            this.objValueClassName = TypeDescriptor.GetClassName(this.objValue);

            this.IsExpandable = true;
            // default to categories
            this.PropertySort = sortType;
            this.InternalExpanded = true;
        }
        internal SingleSelectRootGridEntry(PropertyGridView gridEntryHost, object value, GridEntry parent, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType)
            : base(gridEntryHost.OwnerGrid, parent)
        {
            Debug.Assert(value != null, "Can't browse a null object!");
            this.host          = host;
            this.gridEntryHost = gridEntryHost;
            this.baseProvider  = baseProvider;
            this.tab           = tab;
            objValue           = value;
            objValueClassName  = TypeDescriptor.GetClassName(objValue);

            IsExpandable = true;
            // default to categories
            PropertySort     = sortType;
            InternalExpanded = true;
        }
        public virtual void SyncronizeToggleButtons()
        {
            if (this.PropertyGridElement == null)
            {
                return;
            }
            PropertySort propertySort = this.PropertyGridElement.PropertyTableElement.PropertySort;

            this.UnwireEvents();
            switch (propertySort)
            {
            case PropertySort.NoSort:
                this.alphabeticalToggleButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
                this.categorizedToggleButton.ToggleState  = Telerik.WinControls.Enumerations.ToggleState.Off;
                break;

            case PropertySort.Alphabetical:
                this.alphabeticalToggleButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
                this.categorizedToggleButton.ToggleState  = Telerik.WinControls.Enumerations.ToggleState.Off;
                break;

            case PropertySort.Categorized:
                this.alphabeticalToggleButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
                this.categorizedToggleButton.ToggleState  = Telerik.WinControls.Enumerations.ToggleState.On;
                break;

            case PropertySort.CategorizedAlphabetical:
                this.alphabeticalToggleButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
                this.categorizedToggleButton.ToggleState  = Telerik.WinControls.Enumerations.ToggleState.On;
                break;
            }
            if (this.PropertyGridElement.PropertyTableElement.GroupDescriptors.Count > 0)
            {
                this.categorizedToggleButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
            }
            else
            {
                this.categorizedToggleButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
            }
            this.WireEvents();
        }
Beispiel #12
0
        private void propertyPaneToolStripButton_Click(object sender, EventArgs e)
        {
            ToolStripButton button = sender as ToolStripButton;

            if (button != null)
            {
                PropertySort propertySort = (PropertySort)button.Tag;

                PropertySort newValue = _automationElementPropertyGrid.PropertySort;

                if (button.Checked)
                {
                    newValue |= propertySort;
                }
                else
                {
                    newValue &= ~propertySort;
                }

                _automationElementPropertyGrid.PropertySort = newValue;
            }
        }
Beispiel #13
0
        internal SingleSelectRootGridEntry(
            PropertyGridView ownerGridView,
            object target,
            IServiceProvider baseProvider,
            IDesignerHost host,
            PropertyTab ownerTab,
            PropertySort sortType)
            : base(ownerGridView.OwnerGrid, parent: null)
        {
            Debug.Assert(target is not null, "Can't browse a null object!");
            _host           = host;
            _ownerGridView  = ownerGridView;
            _baseProvider   = baseProvider;
            _ownerTab       = ownerTab;
            Target          = target;
            _valueClassName = TypeDescriptor.GetClassName(Target);

            IsExpandable = true;

            // Default to categories.
            _propertySort    = sortType;
            InternalExpanded = true;
        }
Beispiel #14
0
        /// <summary>
        /// Syncronizes the default toggle buttons in the <see cref="PropertyGridToolbarElement"/>
        /// with the PropertySort property of the <see cref="PropertyGridElement"/>.
        /// </summary>
        public virtual void SyncronizeToggleButtons()
        {
            PropertyGridElement propertyGridElement = this.PropertyGridElement;

            if (propertyGridElement != null)
            {
                PropertySort initialPropertySort = propertyGridElement.PropertyTableElement.PropertySort;

                this.UnwireEvents();

                switch (initialPropertySort)
                {
                case PropertySort.Alphabetical:
                    this.alphabeticalPropertySort.ToggleState            = ToggleState.On;
                    this.categorizedAlphabeticalPropertySort.ToggleState = ToggleState.Off;
                    break;

                case PropertySort.Categorized:
                    this.alphabeticalPropertySort.ToggleState            = ToggleState.Off;
                    this.categorizedAlphabeticalPropertySort.ToggleState = ToggleState.Off;
                    break;

                case PropertySort.CategorizedAlphabetical:
                    this.alphabeticalPropertySort.ToggleState            = ToggleState.Off;
                    this.categorizedAlphabeticalPropertySort.ToggleState = ToggleState.On;
                    break;

                case PropertySort.NoSort:
                    this.alphabeticalPropertySort.ToggleState            = ToggleState.Off;
                    this.categorizedAlphabeticalPropertySort.ToggleState = ToggleState.Off;
                    break;
                }

                this.WireEvents();
            }
        }
 internal SingleSelectRootGridEntry(PropertyGridView view, object value, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : this(view, value,null, baseProvider, host, tab, sortType) {
 }   
 internal SingleSelectRootGridEntry(PropertyGridView gridEntryHost, object value, GridEntry parent, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : base(gridEntryHost.OwnerGrid, parent)
 {
     this.host              = host;
     this.gridEntryHost     = gridEntryHost;
     this.baseProvider      = baseProvider;
     this.tab               = tab;
     this.objValue          = value;
     this.objValueClassName = TypeDescriptor.GetClassName(this.objValue);
     this.IsExpandable      = true;
     base.PropertySort      = sortType;
     this.InternalExpanded  = true;
 }
Beispiel #17
0
        public IActionResult Sale(int id)
        {
            PropertySort propertySort = _context.PropertySorts.Where(ps => ps.PropertySortId == id).FirstOrDefault();

            if (propertySort != null)
            {
                AddViewModel data = new AddViewModel
                {
                    FilterPanel = new FilterPanelViewModel
                    {
                        AddTypes      = _context.AddTypes.ToList(),
                        Cities        = _context.Cities.ToList(),
                        PropertySorts = _context.PropertySorts.ToList(),
                    },
                    AddsPanel = new AddsPanelViewModel
                    {
                        Type    = ViewType.small,
                        AddList = _context.Addvertisiments.Include("AddType").
                                  Include("Property").
                                  Include("Property.City").
                                  Include("Property.District").
                                  Include("Property.Flat").
                                  Include("Property.Floor").
                                  Include("Property.PropDoc").
                                  Include("Property.PropertySort").
                                  Include("Property.Project").
                                  Where(a => a.AddTypeID > 2 && a.User.Status == UserStatus.Active && a.AddStatus == AddStatus.Active && a.Property.PropertySortId == id).OrderByDescending(a => a.CreatedAt).ToList(),
                    },
                    Breadcumb = new BreadcumbViewModel
                    {
                        Title = "Satış elanları",
                        Path  = new List <BreadcumbItemViewModel>()
                    },
                };
                BreadcumbItemViewModel home = new BreadcumbItemViewModel
                {
                    Name       = "Ana səhifə",
                    Controller = "Home",
                    Action     = "index"
                };

                BreadcumbItemViewModel adds = new BreadcumbItemViewModel
                {
                    Name       = "Bütün elanlar",
                    Controller = "Add",
                    Action     = "index"
                };
                BreadcumbItemViewModel finded = new BreadcumbItemViewModel
                {
                    Name = propertySort.PropertySortName,
                };

                data.Breadcumb.Path.Add(home);
                data.Breadcumb.Path.Add(adds);
                data.Breadcumb.Path.Add(finded);
                ViewBag.Partial   = data.Breadcumb;
                ViewBag.Filters   = data.FilterPanel;
                ViewBag.Adds      = data.AddsPanel;
                ViewBag.AddsCount = data.AddsPanel.AddList.Count();
                return(View(data));
            }
            else
            {
                return(BadRequest());
            }
        }
        private void OnViewSortButtonClick(Object sender, EventArgs e) {
            try {
            
               this.FreezePainting = true;
        
               // is this tab selected? If so, do nothing.
               if (sender == viewSortButtons[selectedViewSort]) {
                   viewSortButtons[selectedViewSort].Checked = true;
                   return;
               }
   
               // check new button and uncheck old button.
               viewSortButtons[selectedViewSort].Checked = false;
   
               // find the new button in the list
               int index = 0;
               for (index = 0; index < viewSortButtons.Length; index++) {
                   if (viewSortButtons[index] == sender) {
                       break;
                   }
               }
               
               selectedViewSort = index;
               viewSortButtons[selectedViewSort].Checked = true;
               
               switch (selectedViewSort) {
                  case ALPHA:
                     propertySortValue = PropertySort.Alphabetical;
                     break;
                  case CATEGORIES:
                     propertySortValue = PropertySort.Alphabetical | PropertySort.Categorized;
                     break;
                  case NO_SORT:
                     propertySortValue = PropertySort.NoSort;
                     break;
               }

               OnPropertySortChanged(EventArgs.Empty);
               
               Refresh(false);
               OnLayoutInternal(false);
            }
            finally {
               this.FreezePainting = false;
            }
            OnButtonClick(sender, e);
            
        }
Beispiel #19
0
		public PropertyGrid ()
		{
			selected_objects = new object[0];
			property_tabs = new PropertyTabCollection(this);

			line_color = SystemColors.ScrollBar;
			category_fore_color = line_color;
			commands_visible = false;
			commands_visible_if_available = false;
			property_sort = PropertySort.CategorizedAlphabetical;
			property_grid_view = new PropertyGridView(this);

			splitter = new Splitter();
			splitter.Dock = DockStyle.Bottom;

			help_panel = new Panel();
			help_panel.Dock = DockStyle.Bottom;
			//help_panel.DockPadding.All = 3;
			help_panel.Height = 50;
			help_panel.BackColor = SystemColors.Control;


			help_title_label = new Label();
			help_title_label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
			help_title_label.Name = "help_title_label";
			help_title_label.Font = new Font(this.Font,FontStyle.Bold);
			help_title_label.Location = new Point(2,2);
			help_title_label.Height = 17;
			help_title_label.Width = help_panel.Width - 4;

			
			help_description_label = new Label();
			help_description_label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
			help_description_label.AutoEllipsis = true;
			help_description_label.AutoSize = false;
			help_description_label.Font = this.Font;
			help_description_label.Location = new Point(2,help_title_label.Top+help_title_label.Height);
			help_description_label.Width = help_panel.Width - 4;
			help_description_label.Height = help_panel.Height - help_description_label.Top - 2;

			help_panel.Controls.Add(help_description_label);
			help_panel.Controls.Add(help_title_label);
			help_panel.Paint+=new PaintEventHandler(help_panel_Paint);

			toolbar = new PropertyToolBar();
			toolbar.Dock = DockStyle.Top;
			categorized_toolbarbutton = new PropertyToolBarButton ();
			categorized_toolbarbutton.Pushed = true;
			alphabetic_toolbarbutton = new PropertyToolBarButton ();
			propertypages_toolbarbutton = new PropertyToolBarButton ();
			separator_toolbarbutton = new PropertyToolBarSeparator ();
			ContextMenu context_menu = new ContextMenu();
			context_menu_default_location = Point.Empty;

			categorized_image = new Bitmap (typeof (PropertyGrid), "propertygrid-categorized.png");
			alphabetical_image = new Bitmap (typeof (PropertyGrid), "propertygrid-alphabetical.png");
			propertypages_image = new Bitmap (typeof (PropertyGrid), "propertygrid-propertypages.png");

			toolbar_imagelist = new ImageList();
			toolbar_imagelist.ColorDepth = ColorDepth.Depth32Bit;
			toolbar_imagelist.ImageSize = new System.Drawing.Size(16, 16);
			toolbar_imagelist.TransparentColor = System.Drawing.Color.Transparent;

			toolbar.Appearance = ToolBarAppearance.Flat;
			toolbar.AutoSize = false;
			
			toolbar.ImageList = toolbar_imagelist;
			toolbar.Location = new System.Drawing.Point(0, 0);
			toolbar.ShowToolTips = true;
			toolbar.Size = new System.Drawing.Size(256, 27);
			toolbar.TabIndex = 0;

			toolbar.Items.AddRange (new ToolStripItem [] {categorized_toolbarbutton,
								      alphabetic_toolbarbutton,
								      new PropertyToolBarSeparator (),
								      propertypages_toolbarbutton});
			//toolbar.ButtonSize = new System.Drawing.Size (20, 20);
			categorized_toolbarbutton.Click += new EventHandler (toolbarbutton_clicked);
			alphabetic_toolbarbutton.Click += new EventHandler (toolbarbutton_clicked);
			propertypages_toolbarbutton.Click += new EventHandler (toolbarbutton_clicked);

			categorized_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
			categorized_toolbarbutton.ToolTipText = Locale.GetText ("Categorized");

			alphabetic_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
			alphabetic_toolbarbutton.ToolTipText = Locale.GetText ("Alphabetic");

			propertypages_toolbarbutton.Enabled = false;
			propertypages_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
			propertypages_toolbarbutton.ToolTipText = "Property Pages";

			properties_tab = CreatePropertyTab (this.DefaultTabType);
			selected_tab = properties_tab;
			RefreshToolbar (property_tabs);
			
			reset_menuitem = context_menu.MenuItems.Add("Reset");
			reset_menuitem.Click +=new EventHandler(OnResetPropertyClick);
			context_menu.MenuItems.Add("-");
			description_menuitem = context_menu.MenuItems.Add("Description");
			description_menuitem.Click += new EventHandler(OnDescriptionClick);
			description_menuitem.Checked = this.HelpVisible;
			this.ContextMenu = context_menu;
			toolbar.ContextMenu = context_menu;
			
			BorderHelperControl helper = new BorderHelperControl ();
			helper.Dock = DockStyle.Fill;
			helper.Controls.Add (property_grid_view);
			
			this.Controls.Add(helper);
			this.Controls.Add(toolbar);
			this.Controls.Add(splitter);
			this.Controls.Add(help_panel);
			this.Name = "PropertyGrid";
			this.Size = new System.Drawing.Size(256, 400);
		}
            public static MultiPropertyDescriptorGridEntry[] GetMergedProperties(
                object[] objects,
                GridEntry parentEntry,
                PropertySort sort,
                PropertyTab tab)
            {
                MultiPropertyDescriptorGridEntry[] result = null;
                try
                {
                    int length = objects.Length;

                    if ((sort & PropertySort.Alphabetical) != 0)
                    {
                        ArrayList commonProperties = GetCommonProperties(objects, presort: true, tab, parentEntry);

                        var entries = new MultiPropertyDescriptorGridEntry[commonProperties.Count];
                        for (int i = 0; i < entries.Length; i++)
                        {
                            entries[i] = new MultiPropertyDescriptorGridEntry(
                                parentEntry.OwnerGrid,
                                parentEntry,
                                objects,
                                (PropertyDescriptor[])commonProperties[i],
                                hide: false);
                        }

                        result = SortParenEntries(entries);
                    }
                    else
                    {
                        object[] sortObjects = new object[length - 1];
                        Array.Copy(objects, 1, sortObjects, 0, length - 1);

                        ArrayList properties = GetCommonProperties(sortObjects, presort: true, tab, parentEntry);

                        // This will work for just one as well.
                        ArrayList firstProperties = GetCommonProperties(new object[] { objects[0] }, presort: false, tab, parentEntry);

                        var firstPropertyDescriptors = new PropertyDescriptor[firstProperties.Count];
                        for (int i = 0; i < firstProperties.Count; i++)
                        {
                            firstPropertyDescriptors[i] = ((PropertyDescriptor[])firstProperties[i])[0];
                        }

                        properties = UnsortedMerge(firstPropertyDescriptors, properties);

                        var entries = new MultiPropertyDescriptorGridEntry[properties.Count];

                        for (int i = 0; i < entries.Length; i++)
                        {
                            entries[i] = new MultiPropertyDescriptorGridEntry(
                                parentEntry.OwnerGrid,
                                parentEntry,
                                objects,
                                (PropertyDescriptor[])properties[i],
                                hide: false);
                        }

                        result = SortParenEntries(entries);
                    }
                }
                catch
                {
                }

                return(result);
            }
Beispiel #21
0
        protected GridEntry(PropertyGrid owner, GridEntry peParent) {
            parentPE = peParent;
            ownerGrid = owner;

            Debug.Assert( this.ownerGrid != null, "GridEntry w/o PropertyGrid owner, text rendering will fail." );

            if (peParent != null) {
                propertyDepth = peParent.PropertyDepth + 1;
                this.PropertySort = peParent.PropertySort;

                if (peParent.ForceReadOnly) {
                    flags |= FLAG_FORCE_READONLY;
                }

            }
            else {
                propertyDepth = -1;
            }
        }
Beispiel #22
0
        /// <include file='doc\GridEntry.uex' path='docs/doc[@for="GridEntry.Create"]/*' />
        /// <devdoc>
        /// Create the base prop entries given an object or set of objects
        /// </devdoc>
        internal static IRootGridEntry Create(PropertyGridView view, object[] rgobjs, IServiceProvider baseProvider, IDesignerHost currentHost, PropertyTab tab, PropertySort initialSortType) {
            IRootGridEntry pe = null;

            if (rgobjs == null || rgobjs.Length == 0) {
                return null;
            }

            try
            {
                if (rgobjs.Length == 1)
                {
                    pe = new SingleSelectRootGridEntry(view, rgobjs[0], baseProvider, currentHost, tab, initialSortType);
                }
                else
                {
                    pe = new MultiSelectRootGridEntry(view, rgobjs, baseProvider, currentHost, tab, initialSortType);
                }
            }
            catch (Exception e)
            {
                //Debug.fail("Couldn't create a top-level GridEntry");
                Debug.Fail(e.ToString());
                throw;
            }
            return pe;
        }
Beispiel #23
0
 /// <summary>
 /// 把IOrderedQueryable[T]集合继续指定属性排序方式进行排序
 /// </summary>
 /// <typeparam name="T">动态类型</typeparam>
 /// <param name="source">要排序的数据集</param>
 /// <param name="propertySort">列表属性排序条件</param>
 /// <returns></returns>
 public static IOrderedQueryable <T> ThenBy <T>(this IOrderedQueryable <T> source, PropertySort propertySort)
 {
     PublicHelper.CheckArgument(propertySort, "propertySort");
     return(source.ThenBy(propertySort.PropertyName, propertySort.SortDirection));
 }
 public static MultiPropertyDescriptorGridEntry[] GetMergedProperties(object[] rgobjs, GridEntry parentEntry, PropertySort sort, PropertyTab tab)
 {
     MultiPropertyDescriptorGridEntry[] entryArray = null;
     try
     {
         int length = rgobjs.Length;
         if ((sort & PropertySort.Alphabetical) != PropertySort.NoSort)
         {
             ArrayList list = GetCommonProperties(rgobjs, true, tab, parentEntry);
             MultiPropertyDescriptorGridEntry[] entryArray2 = new MultiPropertyDescriptorGridEntry[list.Count];
             for (int k = 0; k < entryArray2.Length; k++)
             {
                 entryArray2[k] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])list[k], false);
             }
             return(SortParenEntries(entryArray2));
         }
         object[] destinationArray = new object[length - 1];
         Array.Copy(rgobjs, 1, destinationArray, 0, length - 1);
         ArrayList            sortedMergedEntries = GetCommonProperties(destinationArray, true, tab, parentEntry);
         ArrayList            list3       = GetCommonProperties(new object[] { rgobjs[0] }, false, tab, parentEntry);
         PropertyDescriptor[] baseEntries = new PropertyDescriptor[list3.Count];
         for (int i = 0; i < list3.Count; i++)
         {
             baseEntries[i] = ((PropertyDescriptor[])list3[i])[0];
         }
         sortedMergedEntries = UnsortedMerge(baseEntries, sortedMergedEntries);
         MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[sortedMergedEntries.Count];
         for (int j = 0; j < entries.Length; j++)
         {
             entries[j] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])sortedMergedEntries[j], false);
         }
         entryArray = SortParenEntries(entries);
     }
     catch
     {
     }
     return(entryArray);
 }
Beispiel #25
0
 internal MultiSelectRootGridEntry(PropertyGridView view, object obj, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType)
     : base(view, obj, baseProvider, host, tab, sortType)
 {
 }
             public static MultiPropertyDescriptorGridEntry[] GetMergedProperties(object[] rgobjs, GridEntry parentEntry, PropertySort sort, PropertyTab tab) {

                MultiPropertyDescriptorGridEntry[] result = null;
                try {
                    int cLength = rgobjs.Length;
                    object[] rgobjArgs = new object[1];
                    
                    if((sort & PropertySort.Alphabetical) != 0) {
                        ArrayList props = GetCommonProperties(rgobjs, true, tab, parentEntry);
                        
                        MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[props.Count];
                        for (int i=0; i < entries.Length; i++) {
                            entries[i] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])props[i], false);
                        }
    
                        result = SortParenEntries(entries);
                    }
                    else {
                        object[] sortObjs = new object[cLength - 1];
                        Array.Copy(rgobjs, 1, sortObjs, 0, cLength - 1);
    
                        ArrayList props = GetCommonProperties(sortObjs, true, tab, parentEntry);
    
                        // this'll work for just one as well
                        ArrayList firstProps = GetCommonProperties(new object[]{rgobjs[0]}, false, tab, parentEntry);
    
                        PropertyDescriptor[] firstPds = new PropertyDescriptor[firstProps.Count];
                        for (int i = 0; i < firstProps.Count; i++) {
                            firstPds[i] = ((PropertyDescriptor[])firstProps[i])[0];
                        }
                        
                        props = UnsortedMerge(firstPds, props);
                        
                        MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[props.Count];
                        
                        for (int i=0; i < entries.Length; i++) {
                            entries[i] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])props[i], false);
                        }
    
                        result = SortParenEntries(entries);
                    }
                }
                catch {
                }
    
                return result;
    
            }
 internal MultiSelectRootGridEntry(PropertyGridView view, object obj, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : base(view, obj, baseProvider, host, tab, sortType)
 {
 }
Beispiel #28
0
 /// <summary>
 /// 设置datagridview 自动排序功能使能
 /// </summary>
 /// <param name="enable"></param>
 /// <summary>
 /// 设置property
 /// </summary>
 /// <param name="ps"></param>
 public void SetPropertyGridSort(PropertySort ps)
 {
     this.propertyGrid1.PropertySort = ps;
 }
Beispiel #29
0
            public static MultiPropertyDescriptorGridEntry[] GetMergedProperties(object[] rgobjs, GridEntry parentEntry, PropertySort sort, PropertyTab tab)
            {
                MultiPropertyDescriptorGridEntry[] result = null;
                try {
                    int      cLength   = rgobjs.Length;
                    object[] rgobjArgs = new object[1];

                    if ((sort & PropertySort.Alphabetical) != 0)
                    {
                        ArrayList props = GetCommonProperties(rgobjs, true, tab, parentEntry);

                        MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[props.Count];
                        for (int i = 0; i < entries.Length; i++)
                        {
                            entries[i] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])props[i], false);
                        }

                        result = SortParenEntries(entries);
                    }
                    else
                    {
                        object[] sortObjs = new object[cLength - 1];
                        Array.Copy(rgobjs, 1, sortObjs, 0, cLength - 1);

                        ArrayList props = GetCommonProperties(sortObjs, true, tab, parentEntry);

                        // this'll work for just one as well
                        ArrayList firstProps = GetCommonProperties(new object[] { rgobjs[0] }, false, tab, parentEntry);

                        PropertyDescriptor[] firstPds = new PropertyDescriptor[firstProps.Count];
                        for (int i = 0; i < firstProps.Count; i++)
                        {
                            firstPds[i] = ((PropertyDescriptor[])firstProps[i])[0];
                        }

                        props = UnsortedMerge(firstPds, props);

                        MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[props.Count];

                        for (int i = 0; i < entries.Length; i++)
                        {
                            entries[i] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])props[i], false);
                        }

                        result = SortParenEntries(entries);
                    }
                }
                catch {
                }

                return(result);
            }
 public static MultiPropertyDescriptorGridEntry[] GetMergedProperties(object[] rgobjs, GridEntry parentEntry, PropertySort sort, PropertyTab tab)
 {
     MultiPropertyDescriptorGridEntry[] entryArray = null;
     try
     {
         int length = rgobjs.Length;
         if ((sort & PropertySort.Alphabetical) != PropertySort.NoSort)
         {
             ArrayList list = GetCommonProperties(rgobjs, true, tab, parentEntry);
             MultiPropertyDescriptorGridEntry[] entryArray2 = new MultiPropertyDescriptorGridEntry[list.Count];
             for (int k = 0; k < entryArray2.Length; k++)
             {
                 entryArray2[k] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[]) list[k], false);
             }
             return SortParenEntries(entryArray2);
         }
         object[] destinationArray = new object[length - 1];
         Array.Copy(rgobjs, 1, destinationArray, 0, length - 1);
         ArrayList sortedMergedEntries = GetCommonProperties(destinationArray, true, tab, parentEntry);
         ArrayList list3 = GetCommonProperties(new object[] { rgobjs[0] }, false, tab, parentEntry);
         PropertyDescriptor[] baseEntries = new PropertyDescriptor[list3.Count];
         for (int i = 0; i < list3.Count; i++)
         {
             baseEntries[i] = ((PropertyDescriptor[]) list3[i])[0];
         }
         sortedMergedEntries = UnsortedMerge(baseEntries, sortedMergedEntries);
         MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[sortedMergedEntries.Count];
         for (int j = 0; j < entries.Length; j++)
         {
             entries[j] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[]) sortedMergedEntries[j], false);
         }
         entryArray = SortParenEntries(entries);
     }
     catch
     {
     }
     return entryArray;
 }