本文整理汇总了C#中ScriptCoreLib类的典型用法代码示例。如果您正苦于以下问题:C# ScriptCoreLib类的具体用法?C# ScriptCoreLib怎么用?C# ScriptCoreLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScriptCoreLib类属于命名空间,在下文中一共展示了ScriptCoreLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: documentMouse1_onmousemove
private void documentMouse1_onmousemove(ScriptCoreLib.JavaScript.DOM.IEvent obj)
{
//if (!this.Enabled)
// return;
InterestIntent();
}
示例2: Invoke
async void Invoke()
{
// X:\jsc.svn\examples\rewrite\Test\TestSwitchRewriteAsEnumerable\TestSwitchRewriteAsEnumerable\Class1.cs
//f = new Array(1);
//b.__stack0018__001d__0025 = f;
//b.__stack0018__001d__0025[0] = { };
//g = _6QUABoocDD2jQ9Bz7rBALA(b.__stack0018__001d__0025);
IEnumerable<object> collection = new[] { new object() };
// this causes a problem. why?
// X:\jsc.svn\core\ScriptCoreLib\JavaScript\BCLImplementation\System\Threading\Tasks\Task\Task.Yield.cs
// x:\jsc.svn\examples\javascript\async\asyncworkersourcesha1\asyncworkersourcesha1\application.cs
await Task.Yield();
// f = new Array(1);
// b.__stack0019__001e__0026 = f;
// b.__stack0019__001e__0026[0] = { };
//ref$c[0]._collection_5__1 = _6QUABoocDD2jQ9Bz7rBALA(b.__stack0019__001e__0026);
//// d = c.bwQABoBf2jWIHILvaqtMig();
foreach (var item in collection)
{
Console.WriteLine(new { item });
// 0:25ms {{ item = [object Object] }}
}
}
示例3: Handler
public void Handler(ScriptCoreLib.Ultra.WebService.WebServiceHandler h)
{
Console.WriteLine("enter Handler");
if (h.IsDefaultPath)
{
//h.Context.Response.Redirect("/redirect" + DateTime.Now.Millisecond);
h.Context.Response.Redirect("/redirect" + DateTime.Now.Second);
h.CompleteRequest();
}
else
{
// { UserHostAddress = 127.0.0.1, Path = /redirect168, HttpMethod = GET }
h.Context.Response.AddHeader("hello", "world");
h.Context.Response.Write(
new XElement("pre",
new
{
h.Context.Request.UserHostAddress,
h.Context.Request.Path,
h.Context.Request.HttpMethod
}.ToString()
).ToString()
);
h.CompleteRequest();
}
}
示例4: Invoke
public static void Invoke()
{
// before delegate { { scopeField1 = field1 } }
//enter Inspection { { y = [object Object], Method = { InternalMethodToken = sAAABnvguzW_b3wQRWrbnyg }, Target = [object Object] } }
// { { xRowType = < Namespace >.__c__DisplayClass0 } }
// { { nRow = [object Object] } }
// { { yy = [object Object] } }
// inside the delegate { { scopeField1 = null } }
//{ { z = null } }
var scopeField1 = "field1";
var scopeField2 = 7;
var scopeField3 = new { foo = "bar" };
Console.WriteLine("before delegate " + new { scopeField1, scopeField2, scopeField3 });
Inspection(
delegate
{
Console.WriteLine("inside the delegate " + new { scopeField1, scopeField2, scopeField3 });
return scopeField1;
}
);
}
示例5: MakeCyan
public Task<int[]> WebMethod2(int e, Action<string> y)
{
MakeCyan();
// Send it back to the caller.
y(new { e }.ToString());
var value = new[] {
(int)foo.b,
(int)foo.c
};
//var value = new[] {
// "a",
// "b"
// };
foreach (var item in value)
{
Console.WriteLine(new { item });
}
return Task.FromResult(value);
}
示例6: MakeYellow
public Task<data1[]> WebMethod4(int e, Action<string> y)
{
MakeYellow();
// Send it back to the caller.
y(new { e }.ToString());
var value = new[] {
// jsc why cant we return .this?
new data1 { e = "hello1!", CallbackCopy = new ApplicationWebService() },
new data1 { e = "hello2!", CallbackCopy = new ApplicationWebService() }
};
//var value = new[] {
// "a",
// "b"
// };
foreach (var item in value)
{
Console.WriteLine(new { item });
}
return Task.FromResult(value);
}
示例7: Application
/// <summary>
/// This is a javascript application.
/// </summary>
/// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
public Application(IApp page)
{
new IHTMLPre { new { Native.document.location.protocol, Native.document.location.host } }.AttachToDocument();
// NFC ?
new IHTMLPre { new { Native.window.navigator.userAgent } }.AttachToDocument();
new { }.With(
async delegate
{
new IHTMLButton { "ReadAll" }.AttachToDocument().onclick += async delegate
{
new IHTMLHorizontalRule { }.AttachToDocument();
foreach (var row in await base.ReadAll())
{
new IHTMLPre { new { row.Key, row.z } }.AttachToDocument();
}
};
new IHTMLButton { "TakeLastOne" }.AttachToDocument().onclick += async delegate
{
new IHTMLHorizontalRule { }.AttachToDocument();
var row = await base.TakeLastOne();
new IHTMLPre { new { row.Key, row.z } }.AttachToDocument();
};
new IHTMLButton { "TakeOne" }.AttachToDocument().onclick += async delegate
{
new IHTMLHorizontalRule { }.AttachToDocument();
var row = await base.TakeOne();
new IHTMLPre { new { row.Key, row.z } }.AttachToDocument();
};
var AddAndCount = new IHTMLButton { "AddAndCount" }.AttachToDocument();
var content = new { Native.document.location.protocol, Native.document.location.host, Native.window.navigator.userAgent }.ToString();
// show it
new IHTMLPre { () => new { content } }.AttachToDocument();
while (await AddAndCount.async.onclick)
{
var count = await base.AddAndCount(
new XElement("hello", content)
);
// keep our data
content = "the one after " + new { count, Native.document.location.protocol, Native.document.location.host, Native.window.navigator.userAgent };
new IHTMLPre { new { count } }.AttachToDocument();
}
}
);
}
示例8: Handler
public void Handler(WebServiceHandler h)
{
// { TypeFullName = FindWebApplicationIcon.Application }
if (ApplicationWebService.Preview == null)
{
ApplicationWebService.Preview = "";
var app = h.Applications.First();
var a = new { app.TypeFullName, app.TypeName, Namespace = app.TypeFullName.TakeUntilLastOrEmpty("." + app.TypeName) };
// file: assets/FindWebApplicationIcon/Preview.png size: 7806
var Preview = "assets/" + a.Namespace + "/Preview.png";
if (File.Exists(Preview))
{
ApplicationWebService.Preview = Preview;
ApplicationWebService.PreviewBase64String =
"data:image/png;base64," +
Convert.ToBase64String(
File.ReadAllBytes(Preview)
);
}
Console.WriteLine(new { a, Preview });
}
}
示例9: Application
/// <summary>
/// This is a javascript application.
/// </summary>
/// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
public Application(IApp page)
{
SpecialDelegate y = delegate
{
var err = new Exception(message: "message: \{nameof(page)}");
new IHTMLPre { "err \{err.Message} \{err.StackTrace}" }.AttachToDocument();
示例10: InvokeTest
public static void InvokeTest(Action<string> WriteLine)
{
var Enumerable_Range_1_2 = new[] { 1, 2 }.AsEnumerable();
var Enumerable_Range_3_2 = new[] { 3, 4 }.AsEnumerable();
foreach (var item in
Enumerable_Range_1_2
.SelectMany(
x =>
{
WriteLine("SelectMany " + new { x });
return Enumerable_Range_3_2.Select(
y =>
{
WriteLine("Select " + new { x, y });
return new { x, y };
}
);
}
)
// jsc should call it automatically to allow arrays
.AsEnumerable()
)
{
WriteLine(item.ToString());
}
}
示例11: Application
/// <summary>
/// This is a javascript application.
/// </summary>
/// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
public Application(IDefaultPage page)
{
var data = new[]
{
new { Text = "foo", i = "a", j = 71},
new { Text = "goo", i = "d", j = 7},
new { Text = "boo", i = "b", j = 87},
new { Text = "noo", i = "c", j = 2}
};
data.OrderBy(k => k.i).WithEach(
k =>
{
new IHTMLPre { innerText = k.ToString() }.AttachToDocument();
}
);
data.OrderBy(k => k.j).WithEach(
k =>
{
new IHTMLPre { innerText = k.ToString() }.AttachToDocument();
}
);
@"Hello world".ToDocumentTitle();
// Send data from JavaScript to the server tier
service.WebMethod2(
@"A string from JavaScript.",
value => value.ToDocumentTitle()
);
}
示例12: WebMethod2
/// <summary>
/// This Method is a javascript callable method.
/// </summary>
/// <param name="e">A parameter from javascript.</param>
/// <param name="y">A callback to javascript.</param>
public void WebMethod2(string e, Action<string> y)
{
var x = new NameValueCollection();
var w = new StringBuilder();
w.AppendLine("adding foo");
//x.Add("foo", e);
x["foo"] = e;
w.AppendLine("reading foo");
var foo = x["foo"];
var message = new
{
//w = w.ToString(),
foo
};
y(message.ToString());
}
示例13: WebMethod2
/// <summary>
/// This Method is a javascript callable method.
/// </summary>
/// <param name="e">A parameter from javascript.</param>
/// <param name="y">A callback to javascript.</param>
public void WebMethod2(string e, Action<string> y)
{
string sql = "foo @x @x bar";
int Count = 1;
if (Count > 0)
{
//Console.WriteLine("we have InternalParameters for " + sql);
var parameters = new[]
{
new { ParameterName = "@x", Value = "u" },
};
var index =
from p in parameters
from i in sql.GetIndecies(p.ParameterName)
orderby i
select new { p, i };
foreach (var p in parameters)
{
// java seems to like indexed parameters instead
sql = sql.Replace(p.ParameterName, "?");
}
y(sql);
// add values
}
}
示例14: Handler
// https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20151231/tdjdosboxe
public void Handler(WebServiceHandler h)
{
var HostUri = new
{
Host = h.Context.Request.Headers["Host"].TakeUntilIfAny(":"),
Port = h.Context.Request.Headers["Host"].SkipUntilOrEmpty(":")
};
if (HostUri.Port == "")
HostUri = new { HostUri.Host, Port = "80" };
Console.WriteLine(
new { h.Context.Request.Path }
);
// http://isorecorder.alexfeinman.com/W7.htm
// http://kbarr.net/bochs
// http://www.imgburn.com/index.php?act=download
if (h.Context.Request.Path == "/war1.img")
{
h.Context.Response.Redirect("/assets/jDOSBoxAppletWithWarcraft/war1.img");
h.CompleteRequest();
return;
}
if (h.Context.Request.Path == "/jDOSBoxAppletWithWarcraft.jnlp")
{
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201402/20140222
h.Context.Response.ContentType = "application/x-java-jnlp-file";
// X:\jsc.smokescreen.svn\core\javascript\com.abstractatech.analytics\com.abstractatech.analytics\ApplicationWebService.cs
//#### Java Web Start Error:
//#### Unable to load resource: file:/assets/jDOSBoxAppletWithWarcraft.Application/jDOSBoxAppletWithWarcraft.jnlp
// http://en.wikipedia.org/wiki/Java_Web_Start
h.Context.Response.Write(@"
<jnlp spec='1.4+' codebase='http://" + HostUri.Host + ":" + HostUri.Port + @"/' href='jDOSBoxAppletWithWarcraft.jnlp'
><information><title>jDOSBoxAppletWithWarcraft</title>
<vendor>Example vendor</vendor><description>Example long description</description>
<description kind='short'>Example short description</description></information>
<resources><j2se href='http://java.sun.com/products/autodl/j2se' version='1.4+' />
<jar href='assets/jDOSBoxAppletWithWarcraft.Application/jDOSBoxAppletWithWarcraft.ApplicationApplet.jar'/>
</resources>
<application-desc main-class='jDOSBoxAppletWithWarcraft.ApplicationApplet' />
<j2se version='1.4+' ava-vm-args='' /></jnlp>
");
h.CompleteRequest();
return;
}
}
示例15: Application
// http://msdn.microsoft.com/en-us/library/ie/dn265037(v=vs.85).aspx
/// <summary>
/// This is a javascript application.
/// </summary>
/// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
public Application(IApp page)
{
// inspired by
// http://www.amplifon.co.uk/sounds-of-street-view/how-and-create/index.html
new CanvasRenderingContext2D(500, 400).With(
async ctx =>
{
// "X:\jsc.svn\examples\javascript\WebGL\WebGLDashedLines\WebGLDashedLines.sln"
// using?
ctx.canvas.AttachToDocument();
// Marching Ant code
var antOffset = 0; // Starting offset value
var dashList = new[] { 12.0, 3, 3, 3 }; // Create a dot/dash sequence
//while (AttachToDocument)
while (true)
{
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
// Assign the dashList for the dash sequence
ctx.setLineDash(dashList);
// Get the current offset
ctx.lineDashOffset = antOffset; // Animate the lines
ctx.lineJoin = "round";
ctx.lineWidth = 3;
ctx.strokeStyle = "blue";
ctx.strokeRect(5, 5, 300, 250);
ctx.strokeStyle = "red";
ctx.strokeRect(150, 200, 300, 150);
ctx.lineDashOffset = -antOffset; // Reverse animation
ctx.lineWidth = 7;
ctx.strokeStyle = "green";
ctx.strokeRect(250, 50, 150, 250);
antOffset++;
if (antOffset >= dashList.Sum()) // Reset offset after total of dash List values
{
antOffset = 0;
}
Native.document.title = new { antOffset }.ToString();
// can we see anything?
await Task.Delay(15);
}
}
);
}