本文整理汇总了C#中Magix.Core.ActiveEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ActiveEventArgs类的具体用法?C# ActiveEventArgs怎么用?C# ActiveEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActiveEventArgs类属于Magix.Core命名空间,在下文中一共展示了ActiveEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: magix_file_file_exist
public static void magix_file_file_exist(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.file",
"Magix.file.hyperlisp.inspect.hl",
"[magix.file.file-exist-dox].value");
AppendCodeFromResource(
ip,
"Magix.file",
"Magix.file.hyperlisp.inspect.hl",
"[magix.file.file-exist-sample]");
return;
}
Node dp = Dp(e.Params);
if (!ip.ContainsValue("file"))
throw new ArgumentException("you didn't supply a [file] for [file-exist]");
string file = Expressions.GetFormattedExpression("file", e.Params, "");
if (!file.Contains(":"))
file = _basePath + file;
ip["value"].Value = File.Exists(file);
}
示例2: magix_viewport_page_load
public void magix_viewport_page_load(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.web",
"Magix.web.hyperlisp.inspect.hl",
"[magix.viewport.page-load-dox].value");
return;
}
if (Page.Session["magix.web.postpone-execution"] != null)
{
Node code = Page.Session["magix.web.postpone-execution"] as Node;
Page.Session.Remove("magix.web.postpone-execution");
foreach (Node idxNode in code)
{
RaiseActiveEvent(
"magix.execute",
idxNode);
}
}
}
示例3: magix_execute_sandbox
public static void magix_execute_sandbox(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params, true);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.execute",
"Magix.execute.hyperlisp.inspect.hl",
"[magix.execute.sandbox-dox].value");
AppendCodeFromResource(
ip,
"Magix.execute",
"Magix.execute.hyperlisp.inspect.hl",
"[magix.execute.sandbox-sample]");
return;
}
// verifying sandbox has a [code] block
if (!ip.Contains("code"))
throw new ArgumentException("you need to supply a [code] block to [sandbox] active event");
// verifying sandbox has a [whitelist]
if (!ip.Contains("whitelist"))
throw new ArgumentException("you need to supply a [whitelist] block to [sandbox] active event");
// executing sandboxed code
SandboxCode(e.Params, ip);
}
示例4: magix_forms_controls_check_box
private void magix_forms_controls_check_box(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
Inspect(ip);
return;
}
CheckBox ret = new CheckBox();
FillOutParameters(e.Params, ret);
Node node = ip["_code"].Get<Node>();
if (node.ContainsValue("checked"))
ret.Checked = node["checked"].Get<bool>();
if (ShouldHandleEvent("oncheckedchanged", node))
{
Node codeNode = node["oncheckedchanged"].Clone();
ret.CheckedChanged += delegate(object sender2, EventArgs e2)
{
FillOutEventInputParameters(codeNode, sender2);
RaiseActiveEvent(
"magix.execute",
codeNode);
};
}
ip["_ctrl"].Value = ret;
}
示例5: magix_browser_redirect
public void magix_browser_redirect(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.web",
"Magix.web.hyperlisp.inspect.hl",
"[magix.browser.redirect-dox].value");
AppendCodeFromResource(
ip,
"Magix.web",
"Magix.web.hyperlisp.inspect.hl",
"[magix.browser.redirect-sample]");
return;
}
string url = ip.Get<string>();
if (string.IsNullOrEmpty(url))
throw new ArgumentException("need url as value for [magix.browser.redirect] to function");
if (url.Contains("~"))
url = url.Replace("~", GetApplicationBaseUrl());
Magix.UX.Manager.Instance.Redirect(url);
}
示例6: magix_forms_controls_timer
private void magix_forms_controls_timer(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
Inspect(ip);
return;
}
Timer ret = new Timer();
FillOutParameters(e.Params, ret);
Node node = ip["_code"].Get<Node>();
if (node.ContainsValue("interval"))
ret.Interval = node["interval"].Get<int>();
if (ShouldHandleEvent("ontick", node))
{
Node codeNode = node["ontick"].Clone();
ret.Tick += delegate(object sender2, EventArgs e2)
{
FillOutEventInputParameters(codeNode, sender2);
RaiseActiveEvent(
"magix.execute",
codeNode);
};
}
ip["_ctrl"].Value = ret;
}
示例7: magix_execute_while
public static void magix_execute_while(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params, true);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.execute",
"Magix.execute.hyperlisp.inspect.hl",
"[magix.execute.while-dox].value");
AppendCodeFromResource(
ip,
"Magix.execute",
"Magix.execute.hyperlisp.inspect.hl",
"[magix.execute.while-sample]");
return;
}
Node dp = Dp(e.Params);
// verifying syntax is correct
if (!ip.Contains("code"))
throw new HyperlispSyntaxErrorException("you need to supply a [code] block to the [while] keyword");
// executing [while]
WhileChecked(e.Params, ip, dp);
}
示例8: magix_forms_controls_hyperlink
private void magix_forms_controls_hyperlink(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
Inspect(ip);
return;
}
HyperLink ret = new HyperLink();
FillOutParameters(e.Params, ret);
Node node = ip["_code"].Get<Node>();
if (node.ContainsValue("value"))
ret.Value = node["value"].Get<string>();
if (node.ContainsValue("href"))
ret.Href = node["href"].Get<string>().Replace("~", GetApplicationBaseUrl());
if (node.ContainsValue("target"))
ret.Target = node["target"].Get<string>();
ip["_ctrl"].Value = ret;
}
示例9: magix_execute
public static void magix_execute(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.execute",
"Magix.execute.hyperlisp.inspect.hl",
"[magix.execute.execute-dox].value");
AppendCodeFromResource(
ip,
"Magix.execute",
"Magix.execute.hyperlisp.inspect.hl",
"[magix.execute.execute-sample]");
return;
}
if (!e.Params.Contains("_ip"))
ExecuteOutermostBlock(e.Params);
else
{
if (ip.Name == "execute" && ip.Value != null && ip.Get<string>().StartsWith("["))
{
ip = Expressions.GetExpressionValue<Node>(ip.Get<string>(), Dp(e.Params), ip, false); // lambda execute expression
if (ip == null)
throw new ArgumentException("[execute] value did not return a node list, expression was; '" + ip.Get<string>() + "'");
}
Execute(ip, e.Params);
}
}
示例10: magix_forms_controls_select
private void magix_forms_controls_select(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
Inspect(ip);
return;
}
Select ret = new Select();
FillOutParameters(e.Params, ret);
Node node = ip["_code"].Get<Node>();
if (node.ContainsValue("size"))
ret.Size = node["size"].Get<int>();
if (ShouldHandleEvent("onselectedindexchanged", node))
{
Node codeNode = node["onselectedindexchanged"].Clone();
ret.SelectedIndexChanged += delegate(object sender2, EventArgs e2)
{
FillOutEventInputParameters(codeNode, sender2);
RaiseActiveEvent(
"magix.execute",
codeNode);
};
}
ip["_ctrl"].Value = ret;
}
示例11: magix_forms_set_values
private void magix_forms_set_values(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.forms",
"Magix.forms.hyperlisp.inspect.hl",
"[magix.forms.set-values-dox].value");
AppendCodeFromResource(
ip,
"Magix.forms",
"Magix.forms.hyperlisp.inspect.hl",
"[magix.forms.set-values-sample]");
return;
}
Select lst = FindControl<Select>(e.Params);
lst.Items.Clear();
if (ip.Contains("values"))
{
foreach (Node idx in ip["values"])
{
ListItem it = new ListItem(idx.Get<string>(), idx.Name);
if (!idx.GetValue("enabled", true))
it.Enabled = false;
lst.Items.Add(it);
}
}
lst.ReRender();
}
示例12: magix_forms_add_attribute
private static void magix_forms_add_attribute(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.forms",
"Magix.forms.hyperlisp.inspect.hl",
"[magix.forms.add-attribute-dox].value");
AppendCodeFromResource(
ip,
"Magix.forms",
"Magix.forms.hyperlisp.inspect.hl",
"[magix.forms.add-attribute-sample]");
return;
}
Node dp = Dp(e.Params);
string name = Expressions.GetExpressionValue<string>(ip["name"].Get<string>(), dp, ip, false);
string value = Expressions.GetExpressionValue<string>(ip["value"].Get<string>(), dp, ip, false);
AttributeControl ctrl = FindControl<AttributeControl>(e.Params);
ctrl.Attributes.Add(new AttributeControl.Attribute(name, value));
}
示例13: magix_forms_controls_label
private void magix_forms_controls_label(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
Inspect(ip);
return;
}
Label ret = new Label();
FillOutParameters(e.Params, ret);
Node node = ip["_code"].Get<Node>();
if (node.ContainsValue("value"))
ret.Value = node["value"].Get<string>();
if (node.ContainsValue("tag"))
ret.Tag = node["tag"].Get<string>();
if (node.ContainsValue("for"))
ret.For = node["for"].Get<string>();
ip["_ctrl"].Value = ret;
}
示例14: magix_forms_controls_panel
private void magix_forms_controls_panel(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
Inspect(ip);
return;
}
LiteralControl ctrl = new LiteralControl();
Node node = ip["_code"].Get<Node>();
string idPrefix = "";
if (ip.ContainsValue("id-prefix"))
idPrefix = ip["id-prefix"].Get<string>();
if (node.ContainsValue("id"))
ctrl.ID = idPrefix + node["id"].Get<string>();
else if (node.Value != null)
ctrl.ID = idPrefix + node.Get<string>();
if (node.ContainsValue("text"))
ctrl.Text = node["text"].Get<string>();
ip["_ctrl"].Value = ctrl;
}
示例15: magix_execute_else
public static void magix_execute_else(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params, true);
if (ShouldInspect(ip))
{
AppendInspectFromResource(
ip["inspect"],
"Magix.execute",
"Magix.execute.hyperlisp.inspect.hl",
"[magix.execute.else-dox].value");
AppendCodeFromResource(
ip,
"Magix.execute",
"Magix.execute.hyperlisp.inspect.hl",
"[magix.execute.else-sample]");
return;
}
// verifying an [else] is only followed by an [if] or an [else-if]
VerifySyntaxElse(ip);
// saving state before we pop it to see if we should execute [else] body
bool state = CheckState(e.Params);
// removing signaling state ("_state_if") from state
PopState(e.Params, ip);
// checking to see if previous [if] or [else-if] executed, before we execute [else]
if (!state)
RaiseActiveEvent(
"magix.execute",
e.Params);
}