示例#1
0
        protected virtual void UpdateType(JSC.JSValue manifest)
        {
            this._manifest = manifest;

            string       nv   = null;
            int          attr = 0;
            BitmapSource ni   = null;

            if (_manifest != null && _manifest.ValueType == JSC.JSValueType.Object && _manifest.Value != null)
            {
                var    vv = _manifest["editor"];
                string tmp_s;
                if (vv.ValueType == JSC.JSValueType.String && !string.IsNullOrEmpty(tmp_s = vv.Value as string))
                {
                    nv = tmp_s;
                }
                var iv = _manifest["icon"];
                if (iv.ValueType == JSC.JSValueType.String && !string.IsNullOrEmpty(tmp_s = iv.Value as string))
                {
                    ni = App.GetIcon(tmp_s);
                }
                JSC.JSValue js_attr;
                if ((js_attr = _manifest["attr"]).IsNumber)
                {
                    attr = (int)js_attr;
                }
            }
            IsReadonly = (attr & 2) != 0;
            IsRequired = (attr & 1) != 0;
            if (nv == null)
            {
                nv = DTopic.JSV2Type(value);
            }
            if (ni == null)
            {
                if (value.ValueType == JSC.JSValueType.Object && value.Value == null)
                {
                    ni = App.GetIcon((this is InTopic) ? string.Empty : "Null"); // Folder or Null
                }
            }
            if (ni == null)
            {
                ni = App.GetIcon(nv);
            }

            if (ni != icon)
            {
                icon = ni;
                PropertyChangedReise("icon");
            }
            if (nv != _editorName)
            {
                _editorName = nv;
                editor      = InspectorForm.GetEditor(_editorName, this, _manifest);
                PropertyChangedReise("editor");
            }
            this.editor.TypeChanged(_manifest);
        }
示例#2
0
        private void DataChanged(DTopic.Art a, DTopic t)
        {
            if (a == DTopic.Art.type)
            {
                System.Windows.Media.Imaging.BitmapSource ni = null;
                string ne = null, nv = _altView;

                if (t.Manifest != null && t.Manifest.ValueType == JSC.JSValueType.Object && t.Manifest.Value != null)
                {
                    var    vv = t.Manifest["editor"];
                    string tmp_s;
                    if (vv.ValueType == JSC.JSValueType.String && !string.IsNullOrEmpty(tmp_s = vv.Value as string))
                    {
                        ne = tmp_s;
                    }
                    var iv = t.Manifest["icon"];
                    if (iv.ValueType == JSC.JSValueType.String && !string.IsNullOrEmpty(tmp_s = iv.Value as string))
                    {
                        ni = App.GetIcon(tmp_s);
                    }
                    string typeStr;
                    if (_data == null || _data.Manifest == null || _data.Manifest.ValueType != JSC.JSValueType.Object ||
                        _data.Manifest.Value == null || string.IsNullOrEmpty(typeStr = _data.Manifest["type"].Value as string))
                    {
                        typeStr = null;
                    }
                    if (typeStr == "Core/Logram")
                    {
                        nv = "LO";
                    }
                    if (nv != _altView)
                    {
                        _altView = nv;
                        PropertyChangedReise("ChangeViewEn");
                    }
                }
                if (ne == null)
                {
                    ne = DTopic.JSV2Type(t.State);
                }
                if (ni == null)
                {
                    if (t.State.ValueType == JSC.JSValueType.Object && t.State.Value == null)
                    {
                        ni = App.GetIcon(string.Empty); // Folder icon
                    }
                }
                if (ni == null)
                {
                    ni = App.GetIcon(ne);
                }
                if (Icon != ni)
                {
                    Icon = ni;
                }
            }
            else if (a == DTopic.Art.RemoveChild && t == _data)
            {
                App.Workspace.Close(this);
            }
        }