コード例 #1
0
 private InValue(JSC.JSValue manifest, InValue parent)
 {
     this._parent      = parent;
     base._compactView = false;
     base._manifest    = manifest;
     base._collFunc    = parent._collFunc;
     base.name         = string.Empty;
     this._path        = _parent._path + ".";
     base.levelPadding = _parent.levelPadding + 8;
     base._items       = new List <InBase>();
     base.IsEdited     = true;
 }
コード例 #2
0
ファイル: InValue.cs プロジェクト: Wassili-Hense/Host.V04f
 private InValue(DTopic data, InValue parent, string name, JSC.JSValue value, JSC.JSValue schema, Action<InBase, bool> collFunc) {
   _data = data;
   _parent = parent;
   _collFunc = collFunc;
   _path = _parent._path + "." + name;
   base.name = name;
   _items = new List<InBase>();
   _isVisible = true;
   _isExpanded = true; // fill _valueVC
   levelPadding = _parent.levelPadding + 7;
   _value = value;
   UpdateSchema(schema);
   UpdateData(value);
   _isExpanded = this.HasChildren;
 }
コード例 #3
0
ファイル: InValue.cs プロジェクト: Wassili-Hense/Host.V04f
 public InValue(DTopic data, Action<InBase, bool> collFunc) {
   _data = data;
   _parent = null;
   _collFunc = collFunc;
   name = "value";
   _path = string.Empty;
   _isVisible = true;
   _isExpanded = true; // fill _valueVC
   levelPadding = 5;
   _items = new List<InBase>();
   _value = _data.value;
   UpdateSchema(_data.schema);
   UpdateData(_data.value);
   _isExpanded = this.HasChildren;
   _data.changed += _data_PropertyChanged;
 }
コード例 #4
0
 private InValue(DTopic data, InValue parent, string name, JSC.JSValue value, JSC.JSValue type, Action <InBase, bool> collFunc)
 {
     _data              = data;
     _parent            = parent;
     base._compactView  = false;
     _collFunc          = collFunc;
     _path              = _parent._path + "." + name;
     base.name          = name;
     _items             = new List <InBase>();
     _isVisible         = true;
     _isExpanded        = true; // fill _valueVC
     base.IsGroupHeader = false;
     levelPadding       = _parent.levelPadding + 8;
     _value             = value;
     UpdateType(type);
     UpdateData(value);
     _isExpanded = this.HasChildren;
 }
コード例 #5
0
 public InValue(DTopic data, Action <InBase, bool> collFunc)
 {
     _data             = data;
     _parent           = null;
     base._compactView = false;
     _collFunc         = collFunc;
     name               = "state";
     _path              = string.Empty;
     _isVisible         = true;
     _isExpanded        = true; // fill _valueVC
     base.IsGroupHeader = true;
     levelPadding       = 1;
     _items             = new List <InBase>();
     _value             = _data.State;
     UpdateType(_data.Manifest);
     UpdateData(_data.State);
     _isExpanded    = this.HasChildren;
     _data.changed += _data_PropertyChanged;
 }
コード例 #6
0
        private void miAdd_Click(object sender, RoutedEventArgs e)
        {
            var mi = sender as MenuItem;

            JSC.JSValue decl;
            if (!IsReadonly && mi != null && (decl = mi.Tag as JSC.JSValue) != null)
            {
                if (!IsExpanded)
                {
                    IsExpanded = true;
                    base.PropertyChangedReise("IsExpanded");
                }
                bool pc_items = false;
                if ((bool)decl["willful"])
                {
                    if (_items == null)
                    {
                        lock (this._sync) {
                            if (_items == null)
                            {
                                _items   = new List <InBase>();
                                pc_items = true;
                            }
                        }
                    }
                    var ni = new InValue(decl, this);
                    _items.Insert(0, ni);
                    _collFunc(ni, true);
                }
                else
                {
                    var def = decl["default"];
                    this.ChangeValue(mi.Header as string, def.Defined ? def : JSC.JSValue.Null);
                }
                if (pc_items)
                {
                    PropertyChangedReise("items");
                }
            }
        }
コード例 #7
0
ファイル: InValue.cs プロジェクト: Wassili-Hense/Host.V04f
 private void UpdateData(JSC.JSValue val) {
   _value = val;
   if(_value.ValueType == JSC.JSValueType.Object) {
     InValue vc;
     int i;
     foreach(var kv in _value.OrderBy(z => z.Key)) {
       vc = _items.OfType<InValue>().FirstOrDefault(z => z.name == kv.Key);
       if(vc != null) {
         vc.UpdateData(kv.Value);
       } else {
         for(i = _items.Count - 1; i >= 0; i--) {
           if(string.Compare(_items[i].name, kv.Key) < 0) {
             break;
           }
         }
         JSC.JSValue cs;
         {
           JSC.JSValue pr;
           if(_schema == null || (pr = _schema["Properties"] as JSC.JSValue).ValueType != JSC.JSValueType.Object || (cs = pr[kv.Key]).ValueType != JSC.JSValueType.Object) {
             cs = null;
           }
         }
         var ni= new InValue(_data, this, kv.Key, kv.Value, cs, _collFunc);
         _items.Insert(i + 1, ni);
         if(_isVisible && _isExpanded) {
           _collFunc(ni, true);
         }
       }
     }
     var keys = _value.Select(z => z.Key).ToArray();
     for(i = _items.Count - 1; i >= 0; i--) {
       if(!keys.Contains(_items[i].name)) {
         if(_isVisible && _isExpanded) {
           _items[i].Deleted();
         }
         _items.RemoveAt(i);
       }
     }
   }
   if(editor == null) {
     editor = InspectorForm.GetEdititor(_view, this, _schema);
     PropertyChangedReise("editor");
   } else {
     editor.ValueChanged(_value);
   }
 }
コード例 #8
0
        private void UpdateData(JSC.JSValue val)
        {
            bool o_hc = HasChildren;

            _value = val;
            if (_value.ValueType == JSC.JSValueType.Object)
            {
                InValue vc;
                int     i;
                foreach (var kv in _value.OrderBy(z => z.Key))
                {
                    vc = _items.OfType <InValue>().FirstOrDefault(z => z.name == kv.Key);
                    if (vc != null)
                    {
                        vc.UpdateData(kv.Value);
                    }
                    else
                    {
                        for (i = _items.Count - 1; i >= 0; i--)
                        {
                            if (string.Compare(_items[i].name, kv.Key) < 0)
                            {
                                break;
                            }
                        }
                        JSC.JSValue cs;
                        {
                            JSC.JSValue pr;
                            if (_manifest == null || (pr = _manifest["Fields"]).ValueType != JSC.JSValueType.Object || (cs = pr[kv.Key]).ValueType != JSC.JSValueType.Object)
                            {
                                cs = null;
                            }
                        }
                        var ni = new InValue(_data, this, kv.Key, kv.Value, cs, _collFunc);
                        _items.Insert(i + 1, ni);
                        if (_isVisible && _isExpanded)
                        {
                            _collFunc(ni, true);
                        }
                    }
                }
                var keys = _value.Select(z => z.Key).ToArray();
                for (i = _items.Count - 1; i >= 0; i--)
                {
                    if (!keys.Contains(_items[i].name))
                    {
                        if (_isVisible && _isExpanded)
                        {
                            _items[i].Deleted();
                        }
                        _items.RemoveAt(i);
                    }
                }
            }
            if (editor == null)
            {
                editor = InspectorForm.GetEditor(_editorName, this, _manifest);
                PropertyChangedReise("editor");
            }
            else
            {
                editor.ValueChanged(_value);
            }
            if (o_hc != this.HasChildren)
            {
                PropertyChangedReise("HasChildren");
            }
        }