コード例 #1
0
        new protected virtual void GetSelectedItems(Item[] sources, out ArrayList selected,
                                                    out OrderedDictionary unselected)
        {
            Assert.ArgumentNotNull(sources, "sources");
            var listString = new ListString(Value);

            unselected = new OrderedDictionary();
            selected   = new ArrayList(listString.Count);
            for (int index = 0; index < listString.Count; ++index)
            {
                selected.Add(listString[index]);
            }
            foreach (Item obj in sources)
            {
                string str   = obj.ID.ToString();
                int    index = listString.IndexOf(str);
                if (index >= 0)
                {
                    selected[index] = obj;
                }
                else
                {
                    unselected.Add(MainUtil.GetSortKey(obj.Name), obj);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the selected items.
        /// </summary>
        /// <param name="sources">The sources.</param><param name="selected">The selected.</param><param name="unselected">The unselected.</param><contract><requires name="sources" condition="not null"/></contract>
        private void GetSelectedItems(IEnumerable <Item> sources, out ArrayList selected, out IDictionary unselected)
        {
            Assert.ArgumentNotNull(sources, "sources");
            var listString = new ListString(this.Value);

            unselected = new SortedList(StringComparer.Ordinal);
            selected   = new ArrayList(listString.Count);
            foreach (string t in listString)
            {
                selected.Add(t);
            }

            foreach (Item obj in sources)
            {
                string str   = obj.ID.ToString();
                int    index = listString.IndexOf(str);
                if (index >= 0)
                {
                    selected[index] = obj;
                }
                else
                {
                    unselected.Add(MainUtil.GetSortKey(obj.Name), obj);
                }
            }
        }
コード例 #3
0
        /// <summary>Gets the selected items.</summary>
        /// <param name="sources">The sources. Never used</param>
        /// <param name="selected">The selected.</param>
        /// <param name="unselected">The unselected.</param>
        /// <contract>
        ///   <requires name="sources" condition="not null" />
        /// </contract>
        protected override void GetSelectedItems(Item[] sources, out ArrayList selected, out IDictionary unselected)
        {
            //Assert.ArgumentNotNull((object)sources, "sources");

            var roles = Roles.GetAllRoles();

            ListString listString = new ListString(this.Value);

            unselected = (IDictionary) new SortedList((IComparer)StringComparer.Ordinal);
            selected   = new ArrayList(listString.Count);

            for (int index = 0; index < listString.Count; ++index)
            {
                selected.Add((object)listString[index]);
            }

            foreach (var role in roles)
            {
                int index = listString.IndexOf(role);
                if (index >= 0)
                {
                    selected[index] = (object)role;
                }
                else
                {
                    unselected.Add((object)MainUtil.GetSortKey(role), (object)role);
                }
            }

            //----------------------------------------------------------------------
            //ListString listString = new ListString(this.Value);
            //unselected = (IDictionary)new SortedList((IComparer)StringComparer.Ordinal);
            //selected = new ArrayList(listString.Count);
            //for (int index = 0; index < listString.Count; ++index)
            //    selected.Add((object)listString[index]);
            //foreach (Item source in sources)
            //{
            //    string @string = source.ID.ToString();
            //    int index = listString.IndexOf(@string);
            //    if (index >= 0)
            //        selected[index] = (object)source;
            //    else
            //        unselected.Add((object)MainUtil.GetSortKey(source.Name), (object)source);
            //}
        }