public virtual void Mon(Observable el, string eventName, string fn, string scope, HandlerConfig options) { this.Call("mon", new JRawValue(el.ClientID), eventName, fn, new JRawValue(scope), new JRawValue(options.Serialize())); }
public virtual void AddManagedListener(string item, string eventName, string fn, string scope, HandlerConfig options) { fn = TokenUtils.ParseAndNormalize(fn, this).Trim('"'); this.Call("addManagedListener", new JRawValue(item), eventName, new JRawValue(fn), new JRawValue(scope), new JRawValue(options.Serialize())); }
public virtual void Mon(Element el, string eventName, string fn, string scope, HandlerConfig options) { this.Call("mon", new JRawValue(el.Descriptor), eventName, fn, new JRawValue(scope), new JRawValue(options.Serialize())); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="fn"></param> /// <param name="options"></param> public virtual void Subscribe(string name, JFunction fn, HandlerConfig options) { this.Call("subscribe", name, new JRawValue(fn.ToScript()), new JRawValue(options.Serialize())); }
public virtual void On(string eventName, JFunction fn, string scope, HandlerConfig options) { this.Call("on", eventName, JRawValue.From(fn.ToScript()), JRawValue.From(scope), JRawValue.From(options.Serialize())); }
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, JsonSerializer serializer) { if (value != null && value is ComponentDirectEvent) { ComponentDirectEvent directEvent = (ComponentDirectEvent)value; if (!directEvent.IsDefault) { Control owner = null; MessageBusDirectEvent busEvent = directEvent as MessageBusDirectEvent; if (this.Owner is BaseItem) { owner = ((BaseItem)this.Owner).Owner; } else if (this.Owner is Control) { owner = (Control)this.Owner; } directEvent.Owner = owner; directEvent.ExtraParams.Owner = owner; foreach (Parameter param in directEvent.ExtraParams) { param.Owner = owner; } string configObject = new ClientConfig().SerializeInternal(directEvent, directEvent.Owner); StringBuilder cfgObj = new StringBuilder(configObject.Length + 64); cfgObj.Append(configObject); cfgObj.Remove(cfgObj.Length - 1, 1); cfgObj.AppendFormat("{0}control:this", configObject.Length > 2 ? "," : ""); if (busEvent != null) { cfgObj.Append(",eventType:'bus'"); } if (this.PropertyName != "Click") { cfgObj.AppendFormat(",action:'{0}:'+name", busEvent != null ? busEvent.Name : this.PropertyName); } cfgObj.Append("}"); if (this.PropertyName.IsNotEmpty()) { directEvent.SetArgumentList(this.Owner.GetType().GetProperty(this.PropertyName)); } JFunction jFunction = new JFunction("Ext.net.directRequest(".ConcatWith(cfgObj.ToString(), ");"), directEvent.ArgumentList.ToArray()); HandlerConfig cfg = directEvent.GetListenerConfig(); string scope = directEvent.Scope.IsEmpty() || directEvent.Scope == "this" ? "" : directEvent.Scope; StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("fn:").Append(jFunction.ToScript()).Append(","); if (scope.Length > 0) { sb.Append("scope:").Append(scope).Append(","); } if (busEvent != null) { if (busEvent.Bus.IsNotEmpty()) { sb.Append("bus:'").Append(busEvent.Bus).Append("',"); } if (busEvent.Name.IsNotEmpty()) { sb.Append("name:'").Append(busEvent.Name).Append("',"); } } string cfgStr = cfg.Serialize(); if (cfgStr != "{}") { sb.Append(cfgStr.Chop()); } if (sb[sb.Length - 1] == ',') { sb.Remove(sb.Length - 1, 1); } sb.Append("}"); writer.WriteRawValue(sb.ToString()); return; } } writer.WriteRawValue("{}"); }
public virtual Element AddListener(string eventName, JFunction fn, string scope, HandlerConfig options) { this.Call("on", eventName, fn, new JRawValue(scope), new JRawValue(options.Serialize())); return this; }
public virtual Element AddListener(string eventName, string fn, string scope, HandlerConfig options) { this.Call("on", eventName, new JRawValue(TokenUtils.ParseAndNormalize(fn).Trim('"')), new JRawValue(scope), new JRawValue(options.Serialize())); return this; }
public virtual Element Hover(JFunction overFn, JFunction outFn, string scope, HandlerConfig options) { this.Call("hover", overFn, outFn, new JRawValue(scope), new JRawValue(options.Serialize())); return this; }