Beispiel #1
0
        /// <internalonly/>
        /// <devdoc>
        ///    <para>Gets a collection of standard values for the reference data type.</para>
        /// </devdoc>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            System.Collections.Generic.List <PropertyInfo> result = new Collections.Generic.List <PropertyInfo>();

            if (context.Instance is System.Windows.Forms.Control)
            {
                System.Windows.Forms.Control tmp = (System.Windows.Forms.Control)context.Instance;
                System.Windows.Forms.Form    frm = null;
                while (frm == null && tmp.Parent != null)
                {
                    if (tmp.Parent is System.Windows.Forms.Form)
                    {
                        frm = (System.Windows.Forms.Form)tmp.Parent;
                    }
                    else
                    {
                        tmp = tmp.Parent;
                    }
                }
                if (frm != null && frm is HKLabs.form3)
                {
                    HKLabs.form3 f3 = (HKLabs.form3)frm;
                    if (f3.AAA != null)
                    {
                        PropertyInfo[] p = f3.AAA.GetProperties();
                        foreach (PropertyInfo tmpP in p)
                        {
                            if (tmpP.CanWrite && tmpP.CanRead)
                            {
                                result.Add(tmpP);
                            }
                        }
                    }
                }
            }
            result.Sort((p1, p2) =>
            {
                return(String.Compare(p1.Name, p2.Name, false, CultureInfo.InvariantCulture));
            });
            return(new StandardValuesCollection(result.ToArray()));
        }
Beispiel #2
0
 /// <internalonly/>
 /// <devdoc>
 ///    <para>获取所有下拉列表项</para>
 /// </devdoc>
 public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
 {
     System.Collections.Generic.List <Type> result = new Collections.Generic.List <Type>();
     Type[] t = Assembly.GetExecutingAssembly().GetTypes();
     if (t != null)
     {
         for (int i = 0; i < t.Length; i++)
         {
             //if (t[i].BaseType.Name == typeof(HKLabs.Tabel).Name ||
             //    t[i].Name == typeof(HKLabs.Tabel).Name)
             //{
             result.Add(t[i]);
             //}
         }
     }
     result.Sort((itemName1, itemName2) =>
     {
         return(string.Compare(itemName1.Name, itemName2.Name, false, CultureInfo.InvariantCulture));
     });
     return(new StandardValuesCollection(result.ToArray()));
 }
Beispiel #3
0
        /// <summary>Canonicalizes the specified Access Control List.</summary>
        /// <param name="acl">The Access Control List.</param>
        public static void Canonicalize(this RawAcl acl)
        {
            if (acl == null)
            {
                throw new ArgumentNullException(nameof(acl));
            }

            // Extract aces to list
            var aces = new Collections.Generic.List <GenericAce>(acl.Cast <GenericAce>());

            // Sort aces based on canonical order
            aces.Sort((a, b) => Collections.Generic.Comparer <byte> .Default.Compare(GetComparisonValue(a), GetComparisonValue(b)));

            // Add sorted aces back to ACL
            while (acl.Count > 0)
            {
                acl.RemoveAce(0);
            }
            var aceIndex = 0;

            aces.ForEach(ace => acl.InsertAce(aceIndex++, ace));
        }