script#

Is it possible to write code in C# and use Script# to share it between .NET assemblies and JavaScript?

旧巷老猫 提交于 2019-12-11 11:58:44
问题 I'm investigating using Script# to share some of our C# business logic with the client-side by compiling it to JavaScript. Question is, is it possible to reference a Script# class library from another .NET assembly? I've tried doing it in a quick test and failed miserably. Looking through the Script# source code leads me to believe this won't be possible because no implementation code has been provided for Script#'s mscorlib classes. See the String class as an example. If someone can provide

A question about remove the get and set value in data of ajax, using Script#

让人想犯罪 __ 提交于 2019-12-11 08:57:52
问题 As now I have started to use Script#, I tried to send a data package to server via ajax: jQuery.AjaxRequest<RespondPackage>(url, new jQueryAjaxOptions("type", "POST", "dataType", "json", "data", dataSendToServer)); with dataSendToServer is in form of object Type "SendPackage" using get and set accessor, like this: public class SendPackage { private string reportID; public string ReportID { get { return reportID; } set { reportID = value; } } public SendPackage(string reportID) { this.reportID

Script# 0.8 changes in generated code

你离开我真会死。 提交于 2019-12-11 05:57:14
问题 I've built the latest script# source from Github and started using it in a project. It looks like the way code is generated has changed. How do I make the compiler go back to the old way of generating code? (the 0.7.x way) 回答1: There isn't a flag to go back to the old output. The new output brings the AMD pattern for creating script modules to script# generated output, and takes advantage of it to streamline things and make generated script more consistent with accepted patterns. First is use

How to dynamically generate javascript using ScriptSharp?

瘦欲@ 提交于 2019-12-11 03:08:32
问题 I'm looking for a way to dynamically generate javascript. I didn't find any information on this by browsing through Script#'s documentation, so here are my questions: 1) Is it possible to generate javascript code during runtime? 2) Is it possible to dynamically set a file name to which generated code would be saved to? Or can I get the generated code as a string? A scenario would be: A user goes to a web site, enters a name in a text box, hits a button and a javascript is generated that would

Share code between website/web application project and Script#/ScriptSharp

大兔子大兔子 提交于 2019-12-10 18:58:19
问题 I added a Script# project to my website project and created a small sample library with two classes. Now I want to use these classes from the website code. In this case, I created a simple object tree and serialized it to JSON (which would then get fetched by the client-side code). I tried adding a reference to the Script# project. It compiles fine but then gives me an error when launching about: Assembly not found Runtime version differing Is it even possible to share code between Script#

How to import properties of an external API into Script#

余生颓废 提交于 2019-12-10 10:40:07
问题 I'm using Script# inside Visual Studio 2010 to import the API for the HTML5 Canvas element. Its working great for things like FillRect(), MoveTo(), LineTo() and so on. I've declared the following interface and then I can code against it in C#. Then, Script# converts it to JavaScript nicely. public interface ICanvasContext { void FillRect(int x, int y, int width, int height); void BeginPath(); void MoveTo(int x, int y); void LineTo(int x, int y); void Stroke(); void FillText(string text, int x

Javascript countdown and timezone and daylight saving time issues

我只是一个虾纸丫 提交于 2019-12-08 06:31:55
问题 Our team are having big issues with the JQuery countdown and we really need some help. Initially, we had some ScriptSharp code that does this JQueryCountdownOptions opts = new JQueryCountdownOptions(); opts.Layout = "<ul class=\"group\"> <li>{dn} <span>{dl}</span></li> <li>{hn} <span>{hl}</span></li> <li>{mn} <span>{ml}</span></li> <li>{sn} <span>{sl}</span></li> </ul>"; opts.Until = Number.ParseInt(timeLeft); jQuery.Select("#countdownclock").Plugin<JQueryCountdown>().Countdown(opts); jQuery

Javascript countdown and timezone and daylight saving time issues

我是研究僧i 提交于 2019-12-07 09:47:30
Our team are having big issues with the JQuery countdown and we really need some help. Initially, we had some ScriptSharp code that does this JQueryCountdownOptions opts = new JQueryCountdownOptions(); opts.Layout = "<ul class=\"group\"> <li>{dn} <span>{dl}</span></li> <li>{hn} <span>{hl}</span></li> <li>{mn} <span>{ml}</span></li> <li>{sn} <span>{sl}</span></li> </ul>"; opts.Until = Number.ParseInt(timeLeft); jQuery.Select("#countdownclock").Plugin<JQueryCountdown>().Countdown(opts); jQuery.Select("#countdownclock").Show(); jQuery.Select("#bidBox").RemoveAttr("disabled"); What we noticed is

Script# and compiler problems

﹥>﹥吖頭↗ 提交于 2019-12-07 05:38:41
问题 I've just come across a pretty strange problem with VS2010 and Script#, which most of the time I am able to re-create. In my simple scenario I have 2 projects in my solution; a standard Asp.Net MVC2 Web Application, and a Script# jQuery Class Library. I created a static class (attributed with [Imported]) with a static method on it, the intention being that I can map this class in code to an external Javascript library, as described in the documentation. However, it seems that whenever I

Use Script# to compile code (stand-alone)

可紊 提交于 2019-12-06 06:03:30
I'm trying to compile small fragments of C# into JavaScript using the Script# compiler. But I don't get anything in return, GetStream() in my MemoryStreamSource is not even being called, so I must be doing something wrong. Here's my code: CodeScriptCompiler csc = new CodeScriptCompiler(); return csc.CompileCSharp("String.IsNullOrWhiteSpace(Model.MobilePhoneNumber)"); CodeScriptCompiler.cs using System; using System.Collections.Generic; using ScriptSharp; namespace CodeToScriptCompiler { public class CodeScriptCompiler { ScriptCompiler sc = new ScriptCompiler(); public string CompileCSharp