Пример #1
0
        public virtual object AddNewTree(MetaPar _MP)
        {
            object o = AddNew();

            _MP.CreateEmpty(o);
            return(o);
        }
Пример #2
0
        private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
        {
            GridItem g = propertyGrid2.SelectedGridItem;

            if (g == null)
            {
                e.Cancel = true;
                return;
            }

            contextMenuStrip1.Items.Clear();
            contextMenuStrip1.Items.Add(MetaPar.ExecPath(g.Parent.Value) + "." + g.PropertyDescriptor.Name).Click += new System.EventHandler(MenuItem_Click);
            contextMenuStrip1.Items.Add(g.PropertyDescriptor.ComponentType.FullName).Click += new System.EventHandler(MenuItem_Click);

            Type         ptp = g.Parent.Value.GetType();
            PropertyInfo pi  = ptp.GetProperty(g.PropertyDescriptor.Name);

            de = FindDe(pi);

            DisplayNameAttribute dn = Attribute.GetCustomAttribute(pi, typeof(DisplayNameAttribute)) as DisplayNameAttribute;

            if (dn == null)
            {
                current_name = null;
            }
            else
            {
                current_name = dn.DisplayName;
            }

            current_key = ptp.Name + "." + g.PropertyDescriptor.Name;
            if (current_key != null)
            {
                contextMenuStrip1.Items.Add("Изменить доступ").Click += new System.EventHandler(ChangeDescription);
            }
            if (!(g.Value is IParentBase))
            {
                DefaultValueAttribute dva = Attribute.GetCustomAttribute(pi, typeof(DefaultValueAttribute)) as DefaultValueAttribute;
                if (dva != null)
                {
                    string dv = dva.Value.ToString();
                    if (dv.Length != 0)
                    {
                        contextMenuStrip1.Items.Add("По умолчанию: " + dv).Click += new System.EventHandler(DefaultValue);
                        current_default = dva.Value;
                    }
                }
                if (g.Parent.Value is IParent)
                {
                    if ((g.Parent.Value as IParent).PropertyIndex >= 0)
                    {
                        contextMenuStrip1.Items.Add("Установить для всех: " + g.Value.ToString()).Click += new System.EventHandler(ListValue);
                    }
                }
            }
        }
Пример #3
0
 protected ParMainLite(ESource _Source, string _path, string _file, string _schema, string _Unit, string _file_desc)
 {
     Source        = _Source;
     Parent        = null;
     PropertyIndex = -1;
     PropertyName  = _path;
     file_desc     = _file_desc;
     file          = _file;
     schema        = _schema;
     Unit          = _Unit;
     MP            = new MetaPar(_Source, this);
     MP.LoadTree(file, schema, Unit);
 }