private void ModelChanged(DTopic.Art a, DTopic t) { if (t == _model) { if (a == DTopic.Art.type) { this.Width = JsLib.OfInt(JsLib.GetField(_model.Manifest, "Logram.width"), 32 * CELL_SIZE); this.Height = JsLib.OfInt(JsLib.GetField(_model.Manifest, "Logram.height"), 18 * CELL_SIZE); } } else if (t.parent == _model) { if (a == DTopic.Art.addChild) { t.GetAsync(null).ContinueWith(MChildrenLoad, TaskScheduler.FromCurrentSynchronizationContext()); } else if (a == DTopic.Art.RemoveChild) { foreach (var it in _visuals.OfType <loElement>().Where(z => z.GetModel() == t).ToArray()) { it.Dispose(); } } } }
private void Manifest_changed(DTopic.Art art, DTopic src) { if (art == DTopic.Art.value) { UpdateType(_tManifest != null ? _tManifest.State : null, _value); } }
private void ChildChanged(DTopic.Art a, DTopic t) { if (t.parent == _model) { if (JsLib.OfString(JsLib.GetField(t.Manifest, "cctor.LoBlock"), null) != null) { if (a == DTopic.Art.addChild) { var b = _visuals.OfType <loBlock>().FirstOrDefault(z => z.GetModel() == t); if (b == null) { loBlock.Create(t, this); } } } else { if (a == DTopic.Art.addChild) { var p = _visuals.OfType <loVariable>().FirstOrDefault(z => z.GetModel() == t); if (p == null) { loVariable.Create(t, this); TopicLoaded(t); } } } } }
private void model_changed(DTopic.Art a, DTopic t) { if (t == model) { if (a == DTopic.Art.type || a == DTopic.Art.addChild) { Render(3); } } else if (t.parent == model) { loPin p; p = _pins.FirstOrDefault(z => z.GetModel() == t); if (p == null) { if (a == DTopic.Art.addChild) { t.GetAsync(null).ContinueWith(PinLoaded, TaskScheduler.FromCurrentSynchronizationContext()); } return; } if (a == DTopic.Art.RemoveChild) { lv.DeleteVisual(p); _pins.Remove(p); t.changed -= pin_changed; } this.Render(3); } }
private void ModelChanged(DTopic.Art a, DTopic t) { if (t == model) { switch (a) { case DTopic.Art.addChild: this.Render(2); break; case DTopic.Art.RemoveChild: this.Dispose(); break; case DTopic.Art.value: Input.Render(1); Output.Render(1); break; case DTopic.Art.type: this.Render(3); break; } } }
private void _data_PropertyChanged(DTopic.Art art, DTopic child) { if (art == DTopic.Art.type) { _value = _data.Manifest; UpdateType(_tManifest != null ? _tManifest.State : null, _data.Manifest); } }
private void _typeTopic_changed(DTopic.Art art, DTopic t) { if (art == Art.value) { ProtoDeep(_manifest, (_typeTopic == null || _typeTopic.State.ValueType != JSC.JSValueType.Object) ? null : _typeTopic.State.ToObject()); ChangedReise(Art.type, this); } }
private void pin_changed(DTopic.Art a, DTopic t) { loPin p; p = _pins.FirstOrDefault(z => z.GetModel() == t); if (p == null) { return; } p.Render(a == DTopic.Art.value ? 1 : 3); }
private void _data_PropertyChanged(DTopic.Art art, DTopic child) { if (art == DTopic.Art.type) { UpdateType(_data.Manifest); } else if (art == DTopic.Art.value) { _value = _data.State; UpdateData(_data.State); } }
private void _enumT_changed(DTopic.Art a, DTopic t) { this.Items.Clear(); string text; Brush bg_b; Brush fg_b; if (_enumT != null && _enumT.State.ValueType == JSC.JSValueType.Object) { bool isArr = (bool)JSL.Array.isArray(new JSC.Arguments { _enumT.State }); foreach (var kv in _enumT.State) { text = string.Empty; bg_b = null; fg_b = Brushes.Black; if (kv.Value.ValueType == JSC.JSValueType.String) { text = kv.Value.Value as string; } else if (kv.Value.ValueType == JSC.JSValueType.Object) { text = kv.Value["text"].Value as string; var bg = kv.Value["BG"]; if (bg.ValueType == JSC.JSValueType.String) { try { var c = (Color)ColorConverter.ConvertFromString(bg.Value as string); bg_b = new SolidColorBrush(c); if (Math.Max(c.B, Math.Max(c.G, c.R)) < 64) { fg_b = Brushes.White; } } catch (Exception) { } } } this.Items.Add(new TextBlock { Tag = isArr ? ((JSC.JSValue) new JSL.Number(int.Parse(kv.Key))) : ((JSC.JSValue) new JSL.String(kv.Key)), Text = text, Background = bg_b, Foreground = fg_b }); } ValueChanged(_owner.value); } }
private void LBDescrChanged(DTopic.Art a, DTopic t) { if (t.Manifest == null || t.Manifest.ValueType != JSC.JSValueType.Object || t.Manifest.Value == null || (t.Manifest["type"].Value as string) != "Ext/LBDescr") { return; } LBDesc bl; lock (_blocks) { bl = _blocks.FirstOrDefault(z => z.owner == t); } if (a == DTopic.Art.RemoveChild) { if (bl != null) { lock (_blocks) { _blocks.Remove(bl); } } } else { if (bl == null) { bl = new LBDesc(t); lock (_blocks) { int i = 0; while (_blocks.Count > i && _blocks[i].owner.path.CompareTo(t.path) <= 0) { i++; } _blocks.Insert(i, bl); } } else { bl.Update(); } } }
private void _owner_PropertyChanged(DTopic.Art art, DTopic child) { bool o_hc = _items != null && _items.Any(); { var pr = this; while (pr._parent != null) { pr = pr._parent; } //Log.Debug("$ " + pr._owner.path + "(" + art.ToString() + ", " + (child != null ? child.path : "null") + ")"); } if (art == DTopic.Art.Refresh) { if (_items != null) { if (_isExpanded) { foreach (var ch in _items) { _collFunc(ch, false); } _isExpanded = false; } _populated = false; _items.Clear(); } } if (IsGroupHeader) { if (art == DTopic.Art.type) { _manifest = _owner.Manifest; } else if (art == DTopic.Art.addChild && !_populated) { _populated = true; } } else { if (art == DTopic.Art.type) { this.UpdateType(_owner.Manifest); } else if (art == DTopic.Art.value) { this.UpdateType(_owner.Manifest); this.editor.ValueChanged(_owner.State); } } if (_populated) { if (art == DTopic.Art.addChild) { if (_items == null) { var tsk = InsertItems(_owner.children); } else { var td = AddTopic(child); } } else if (art == DTopic.Art.RemoveChild) { if (_items != null) { var it = _items.FirstOrDefault(z => z.name == child.name); if (it != null) { it.Deleted(); _items.Remove(it); if (!_items.Any()) { _items = null; IsExpanded = false; } } } } } if (o_hc != this.HasChildren) { PropertyChangedReise("items"); PropertyChangedReise("HasChildren"); PropertyChangedReise("IsExpanded"); } }
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); } }