コード例 #1
0
ファイル: Topic.cs プロジェクト: enviriot/EnviriotSW
 private Topic(Topic parent, string name, bool fill)
 {
     _sync    = new object();
     _name    = name;
     _parent  = parent;
     _state   = JSValue.Undefined;
     disposed = false;
     if (parent == null)
     {
         _path = "/";
     }
     else if (parent == root)
     {
         _path = "/" + name;
     }
     else
     {
         _path = parent._path + "/" + name;
     }
     if (fill)
     {
         _manifest         = JSObject.CreateObject();
         _manifest["attr"] = new JST.Number((int)0);
     }
 }
コード例 #2
0
 public void SetField04()
 {
     JSC.JSValue o = JSC.JSObject.CreateObject(), o1 = new JSL.Boolean(false), r, v = new JSL.Boolean(true);
     o["a"] = new JSL.Number(3);
     o["b"] = o1;
     r      = JsLib.SetField(o, "a", v);
     Assert.AreNotEqual(o, r);
     Assert.AreEqual(JSC.JSValueType.Object, r.ValueType);
     Assert.AreEqual(v, r["a"]);
     Assert.AreEqual(o1, r["b"]);
 }
コード例 #3
0
ファイル: Topic.cs プロジェクト: enviriot/EnviriotSW
        public void ClearAttribute(Attribute value)
        {
            JSValue attr;

            if (_manifest == null || _manifest.ValueType != JSValueType.Object || _manifest.Value == null || !(attr = _manifest["attr"]).IsNumber)
            {
                attr = new JST.Number((int)value);
            }
            else
            {
                attr = new JST.Number((int)attr & ~(int)value);
            }
            var c = Perform.Create(this, "attr", attr, null);

            _repo.DoCmd(c, false);
        }
コード例 #4
0
ファイル: Topic.cs プロジェクト: enviriot/EnviriotSW
        public void SetAttribute(Attribute value)
        {
            JSValue attr;

            if (_manifest == null || _manifest.ValueType != JSValueType.Object || _manifest.Value == null || !(attr = _manifest["attr"]).IsNumber)
            {
                attr = new JST.Number((int)value);
            }
            else
            {
                int old = (int)attr;
                if (value == Attribute.DB || value == Attribute.Config)
                {
                    old &= ~((int)Attribute.Saved);
                }
                attr = new JST.Number((int)value | old);
            }
            var c = Perform.Create(this, "attr", attr, null);

            _repo.DoCmd(c, false);
        }
コード例 #5
0
 public void ValueChanged(JSC.JSValue value)
 {
     if (!base.Items.IsEmpty)
     {
         if (value.ValueType == JSC.JSValueType.Double)
         {
             value = new JSL.Number((int)value);
         }
         _oldValue = value;
         var it = base.Items.SourceCollection.OfType <TextBlock>().FirstOrDefault(z => value.Equals(z.Tag as JSC.JSValue));
         if (it == null)
         {
             base.SelectedIndex = 0;
         }
         else
         {
             base.SelectedItem = it;
         }
         if ((it = base.SelectedItem as TextBlock) != null)
         {
             base.Background = it.Background;
         }
     }
 }
コード例 #6
0
ファイル: EvalFunction.cs プロジェクト: modulexcite/NiL.JS
 public EvalFunction()
 {
     _length = new Number(1);
 }
コード例 #7
0
 public void SetField06()
 {
     JSC.JSValue o = JSC.JSObject.CreateObject(), o_a = JSC.JSObject.CreateObject(), o_b = new JSL.Number(3), o_ac = new JSL.Number(2), r, r_a, v = new JSL.Boolean(true);
     o_a["c"] = o_ac;
     o_a["d"] = new JSL.Boolean(false);
     o["a"]   = o_a;
     o["b"]   = o_b;
     r        = JsLib.SetField(o, "a.d", v);
     Assert.AreNotEqual(o, r);
     Assert.AreEqual(JSC.JSValueType.Object, r.ValueType);
     r_a = r["a"];
     Assert.AreNotEqual(o_a, r_a);
     Assert.AreEqual(JSC.JSValueType.Object, r_a.ValueType);
     Assert.AreEqual(o_ac, r_a["c"]);
     Assert.AreEqual(v, r_a["d"]);
     Assert.AreEqual(o_b, r["b"]);
 }
コード例 #8
0
ファイル: LogramView.cs プロジェクト: Wassili-Hense/Host.V04f
    protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) {
      if(_borderDragInProgress) {
        _borderDragInProgress = false;
        e.Handled = true;
        ReleaseMouseCapture();
        var p = e.GetPosition(this);
        double offset_x = p.X - _startOffset.X;
        double offset_y = p.Y - _startOffset.Y;

        double left = _offsetLeft;
        double top = _offsetTop;
        double right = left + 2 * Math.Round((this.Width - 10) / (CELL_SIZE * 2));
        double bottom = top + 2 * Math.Round((this.Height - 10) / (CELL_SIZE * 2));

        JSC.JSObject o = CloneJSO(_owner.value.ToObject());

        if((_mouseAction & BorderHitType.L) == BorderHitType.L) {
          left += 2 * Math.Round(offset_x / (CELL_SIZE * 2));
          o["L"] = new JSL.Number(left);
          o["W"] = new JSL.Number(right - left);
        } else if((_mouseAction & BorderHitType.R) == BorderHitType.R) {
          right += 2 * Math.Round(offset_x / (CELL_SIZE * 2));
          o["W"] = new JSL.Number(right - left);
        }
        if((_mouseAction & BorderHitType.T) == BorderHitType.T) {
          top += 2 * Math.Round(offset_y / (CELL_SIZE * 2));
          o["T"] = new JSL.Number(top);
          o["H"] = new JSL.Number(bottom - top);
        } else if((_mouseAction & BorderHitType.B) == BorderHitType.B) {
          bottom += 2 * Math.Round(offset_y  / (CELL_SIZE * 2));
          o["H"] = new JSL.Number(bottom - top);
        }
        if((right > left + 2) && (bottom > top + 2)) {
          _owner.SetValue(o);
        }
      } else {
        base.OnMouseLeftButtonUp(e);
      }
    }