示例#1
0
 private void NodePropertyChangeNotify(object sender, UCPropertyChangedEventArgs e)
 {
     if (null != this.NodePropertyChange)
     {
         NodePropertyChange(sender, e);
     }
 }
示例#2
0
        private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            try
            {
                //var item = propertyGrid.SelectedObject;
                //var item = propertyGrid.SelectedGridItem.Parent.Value;
                var gi = propertyGrid.SelectedGridItem.Parent;
                while (null == gi.Value)
                {
                    gi = gi.Parent;
                }

                var item = gi.Value;

                var          propertyName = e.ChangedItem.PropertyDescriptor.Name;
                PropertyInfo pi           = item.GetType().GetProperty(propertyName);
                var          oldValue     = e.OldValue;
                var          newValue     = e.ChangedItem.Value;

                if ("Title" == pi.Name)
                {
                    this.CurNode.SetText(null);

                    PageNode pageNode = this.CurNode as PageNode;
                    if (null != pageNode)
                    {
                        pageNode.SetNewTitle(newValue as string);
                    }
                }

                if (null != this.cqp)
                {
                    this.cqp.AddCommand(new NodePropertyInfo(item, pi, oldValue, newValue));
                }

                SetPropertyGridTitle(this.CurNode);

                UCPropertyChangedEventArgs args = new UCPropertyChangedEventArgs();
                args.pi = pi;
                NodePropertyChangeNotify(this.CurNode, args);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }