Example #1
0
        private void FLBaseT_Load(object sender, EventArgs e)
        {
            PropertyInfo         pii = (L as IParentBase).Parent.GetType().GetProperty((L as IParentBase).PropertyName);
            DisplayNameAttribute dn  = Attribute.GetCustomAttribute(pii, typeof(DisplayNameAttribute)) as DisplayNameAttribute;

            if (dn != null)
            {
                Text = dn.DisplayName;
            }
            else
            {
                DisplayNameAttribute dn1 = Attribute.GetCustomAttribute(L.GetType(), typeof(DisplayNameAttribute)) as DisplayNameAttribute;
                if (dn1 != null)
                {
                    Text = dn1.DisplayName;
                }
            }
            LB.AllowDrop = Attribute.GetCustomAttribute(L.GetType(), typeof(SortableAttribute)) as SortableAttribute != null;
            lbLine       = new LBLine(LB);
            int splitterDistance = splitContainer1.SplitterDistance;
            int splitter1        = pdView1.Splitter1;
            int splitter2        = pdView1.Splitter2;

            parMainLite.Wins.LoadFormRect(this, ref splitter1, ref splitter2, ref splitterDistance);
            FLBaseT_Resize(null, null);
            splitContainer1.SplitterDistance = splitterDistance;
            pdView1.Splitter1 = splitter1;
            pdView1.Splitter2 = splitter2;
            //if (!MetaDesc.ST.GetAccess(MetaPar.ExecPath(L) + ".FAccess").CheckUser(User.current))
            //{
            //    BAdd.Visible = false;
            //    BDelete.Visible = false;
            //    BCopy.Visible = false;
            //}

            foreach (object p in L)
            {
                AdjustName(p);
                LB.Items.Add(p);
            }
            Type         tp = L.GetType();
            PropertyInfo pi = tp.GetProperty("Current");

            if (pi != null)
            {
                LB.SelectedItem = pi.GetValue(L, null);
            }
            else
            {
                IEnumerator ee = L.GetEnumerator();
                ee.Reset();
                if (ee.MoveNext())
                {
                    LB.SelectedItem = ee.Current;
                }
            }
            pdView1.OnValueChanged = OnValueChanged;
            pdView1.OnRefresh      = OnRefresh;
        }
Example #2
0
        protected void SaveCurrent(IParentList _o, string _path)
        {
            PropertyInfo pi = _o.GetType().GetProperty("Current");

            if (pi == null)
            {
                return;
            }
            IParent o_current = pi.GetValue(_o, null) as IParent;

            if (o_current != null)
            {
                L.Add(_path + ".Current", o_current.PropertyIndex.ToString());
            }
        }