public veSliderBool(InBase owner, JSC.JSValue schema) { _owner = owner; InitializeComponent(); ValueChanged(_owner.value); cbBool.Checked+=cbBool_Checked; cbBool.Unchecked+=cbBool_Unchecked; }
public void Publish(string path, JSC.JSValue value, INotMsg req) { var arr = new JSL.Array(3); arr[0] = 6; arr[1] = path; arr[2] = value; this.Send(new SioClient.Request(0, arr, req)); }
public void ValueChanged(JSC.JSValue value) { if(value.ValueType == JSC.JSValueType.String) { _oldValue = value.Value as string; } else { _oldValue = value.ToString(); } base.Text = _oldValue; }
public new void ValueChanged(JSC.JSValue value) { try { _oldValue = (long)value; base.Value = _oldValue; } catch(Exception) { base.Value = null; } }
public static IValueEditor GetEdititor(string view, InBase owner, JSC.JSValue schema) { IValueEditor rez; Func<InBase, JSC.JSValue, IValueEditor> ct; if(_editors.TryGetValue(view, out ct) && ct != null) { rez = ct(owner, schema); } else { rez = new veDefault(owner, schema); } return rez; }
internal void Create(string path, string schemaName, JSC.JSValue value, INotMsg req) { JSL.Array arr; arr = new JSL.Array(value == null?3:4); arr[0] = 8; arr[1] = path; arr[2] = schemaName; if(value != null) { arr[3] = value; } this.Send(new SioClient.Request(0, arr, req)); }
private InTopic(JSC.JSValue cStruct, InTopic parent, Action<InBase, bool> collFunc) { _parent = parent; _cStruct = cStruct; name = string.Empty; IsEdited = true; levelPadding = _parent == null ? 5 : _parent.levelPadding + 7; JSC.JSValue sn; if(_cStruct != null && (sn = _cStruct["schema"]).ValueType == JSC.JSValueType.String) { parent._owner.GetAsync("/etc/schema/" + (sn.Value as string)).ContinueWith(SchemaLoaded, TaskScheduler.FromCurrentSynchronizationContext()); } }
public veString(InBase owner, JSC.JSValue schema) { _owner = owner; base.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; base.Padding = new System.Windows.Thickness(10, 0, 10, 0); base.BorderThickness = new System.Windows.Thickness(0); base.Background = System.Windows.Media.Brushes.Azure; base.GotFocus += ve_GotFocus; base.LostFocus += ve_LostFocus; base.KeyUp += ve_KeyUp; ValueChanged(_owner.value); SchemaChanged(schema); }
private static JSC.JSValue ConvertDate(JSC.JSValue thisBind, JSC.Arguments args) { if(args.Length == 2 && args[1].ValueType == JSC.JSValueType.String) { // 2015-09-16T14:15:18.994Z var s = args[1].ToString(); if(s != null && s.Length == 24 && s[4] == '-' && s[7] == '-' && s[10] == 'T' && s[13] == ':' && s[16] == ':' && s[19] == '.') { var a = new JSC.Arguments(); a.Add(args[1]); var jdt = new JSL.Date(a); return JSC.JSValue.Wrap(jdt); } } return args[1]; }
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; }
protected override void UpdateSchema(JSC.JSValue schema) { base.UpdateSchema(schema); if(_schema != null) { var pr = _schema["Properties"] as JSC.JSValue; if(pr != null) { InValue vc; foreach(var kv in pr) { vc = _items.OfType<InValue>().FirstOrDefault(z => z.name == kv.Key); if(vc != null) { vc.UpdateSchema(kv.Value); } } } } bool gh = _parent == null && editor is veDefault; if(gh != IsGroupHeader) { IsGroupHeader = gh; PropertyChangedReise("IsGroupHeader"); } }
public void ValueChanged(JSC.JSValue value) { string rez=null; if(value == null) { rez = "null"; } else { if(value.ValueType == JSC.JSValueType.Object) { if(value.Value == null) { rez = "null"; } else { var sc = value["$schema"]; if((rez = sc.Value as string) == null) { rez = "Object"; } } } else { rez = value.ToString(); } } this.Text = rez; }
private void ChangeValue(string name, JSC.JSValue val) { if(_value.ValueType == JSC.JSValueType.Object) { var jo = JSC.JSObject.CreateObject(); foreach(var kv in _value.OrderBy(z => z.Key)) { if(kv.Key == name) { if(val != null) { jo[kv.Key] = val; } else { jo.DeleteProperty(kv.Key); } } else { jo[kv.Key] = kv.Value; } } if(val != null && !jo.GetProperty(name, JSC.PropertyScope.Own).Defined) { jo[name] = val; } if(_parent == null) { _data.SetValue(jo); } else { _parent.ChangeValue(this.name, jo); } } else { throw new NotImplementedException(); } }
protected void Register(JSC.JSValue name, Action<EventArguments> func) { lock(_events) { _events[JSL.JSON.stringify(name, null, null)]=func; } }
public void SchemaChanged(JSC.JSValue schema) { }
public veDefault(InBase owner, JSC.JSValue schema) { base.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; base.Padding = new System.Windows.Thickness(10, 2, 10, 0); ValueChanged(owner.value); }
public static IValueEditor Create(InBase owner, JSC.JSValue schema) { return new veSliderBool(owner, schema); }
private void ReportConnectState(bool st, JSC.JSValue value) { lock(_connEvnt) { foreach(var ce in _connEvnt) { ce.Response(null, st, value); DWorkspace.This.AddMsg(ce); } _connEvnt.Clear(); } }
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); } }
public void Response(DWorkspace ws, bool success, JSC.JSValue value) { _resp = value; _success = success; }
public static IValueEditor Create(InBase owner, JSC.JSValue schema) { return new veInteger(owner, schema); }
private JSC.JSObject CloneJSO(JSC.JSObject obj) { var o = JSC.JSObject.CreateObject(); foreach(var kv in obj.Where(z => obj.GetProperty(z.Key, JSC.PropertyScope.Own).Defined)) { o[kv.Key] = kv.Value; } return o; }