本文整理汇总了C#中JsString类的典型用法代码示例。如果您正苦于以下问题:C# JsString类的具体用法?C# JsString怎么用?C# JsString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsString类属于命名空间,在下文中一共展示了JsString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SendInternal
private void SendInternal(string httpMethod, string type, JsString url, object data,
JsAction<object, JsString, jqXHR> success,
JsAction<JsError, JsString, jqXHR> failed)
{
url = addTimeToUrl(url);
JsObject headers = new JsObject();
AjaxSettings ajaxSettings = new AjaxSettings
{
type = httpMethod,
dataType = type,
data = data,
url = jsUtils.inst.getLocation() + "/" + url,
headers = headers,
success = delegate(object o, JsString s, jqXHR arg3) { success(o, s, arg3); },
error = delegate(jqXHR xhr, JsString s, JsError arg3) { failed(arg3, s, xhr); }
};
bool isString = data.As<JsObject>()["toLowerCase"] != null;
if (isString)
{
ajaxSettings.processData = true;
ajaxSettings.contentType = (type.As<JsString>().toLowerCase() == "xml")
? "application/xml"
: "application/json";
}
jQuery.ajax(
ajaxSettings);
}
开发者ID:mgerasika,项目名称:gam-gam,代码行数:29,代码来源:ajaxHlp.cs
示例2: addView
public void addView(JsString url, object viewData)
{
if (!hasView(url)) {
//this is one point that I conced we should consider making async
var content = contentParser.parse( contentLoader.synchronousFragmentLoad( url ) );
var div = new HtmlDivElement();
var fragment = jQueryContext.J( div );
fragment.hide();
fragment.html( content );
fragment.css( "width", "100%" );
fragment.css( "height", "100%" );
fragment.css( "position", "absolute" );
fragment.css( "top", "0" );
fragment.css( "left", "0" );
var mediatorCapturer = new MediatorCapturer();
domWalker.walkDomFragment( div, mediatorCapturer );
rootElement.append( div );
views[ url ] = fragment;
mediators[ url ] = mediatorCapturer.mediator;
}
selectView( url, viewData );
}
开发者ID:griffith-computing,项目名称:Randori,代码行数:25,代码来源:ViewStack.cs
示例3: resolveClassName
public TypeDefinition resolveClassName(JsString qualifiedClassName)
{
dynamic type = findDefinition(qualifiedClassName);
if (type == null) {
JsString classDefinition = loader.loadClass(qualifiedClassName);
//Before we load it into memory, check on the super class and see if we need to load *that*
//into memory. We may *NOT* have an inherit if we dont inherit from anything, that is just fine
resolveParentClassFromDefinition(qualifiedClassName,classDefinition);
//Load the newly found class memory
addDefinition(classDefinition);
//Get a reference to the newly added type
type = findDefinition(qualifiedClassName);
if (type == null) {
//This alert shouldnt be here, we should figure out a way to get it to the UI level
HtmlContext.alert(qualifiedClassName + " does not contain required injection information ");
throw new JsError(qualifiedClassName + " does not contain required injection information ");
}
var td = new TypeDefinition(type);
if (!td.builtIn) {
//Finally, resolve any classes it references in its own code execution
resolveClassDependencies(td);
}
}
return new TypeDefinition(type);
}
开发者ID:griffith-computing,项目名称:RandoriGuiceJS,代码行数:32,代码来源:ClassResolver.cs
示例4: parse
public JsString parse( JsString content )
{
//We need to get rid of the body element and maybe choose to do away with other things like script
var bodyRegex = new JsRegExp(@"(</?)body", "gi");
var sanitizedContent = content.replace(bodyRegex,"$1div");
return sanitizedContent;
}
开发者ID:griffith-computing,项目名称:Randori,代码行数:7,代码来源:ContentParser.cs
示例5: synchronousTranslate
public override JsArray<Translation> synchronousTranslate(JsString domain, JsArray<JsString> keys)
{
if (HtmlContext.window.console != null) {
HtmlContext.console.log("Requested to translate: " + domain + " " + keys);
}
return new JsArray<Translation>();
}
开发者ID:griffith-computing,项目名称:Randori,代码行数:7,代码来源:NoOpTranslator.cs
示例6: Querystring
public void Querystring(JsString qs = null)
{ // optionally pass a querystring to parse
this.parameters = new JsObject<JsString>();
JsCode("this.get = Querystring_get");
if (qs == null)
qs = location.search.Substring(1, location.search.length);
if (qs.length == 0) return;
// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
qs = qs.Replace(new JsRegExp("\\+", "g"), " ");
JsArray<JsString> args = qs.Split('&'); // parse out name/value pairs separated via &
// split out each name=value pair
for (int i = 0; i < args.length; i++)
{
JsString value;
JsArray<JsString> pair = args[i].Split('=');
JsString name = Unescape(pair[0]);
if (pair.length == 2)
value = Unescape(pair[1]);
else
value = name;
this.parameters[name] = value;
}
}
开发者ID:fjgandrade,项目名称:sharpkit,代码行数:28,代码来源:QueryString.cs
示例7: synchronousTranslate
public override JsArray<Translation> synchronousTranslate(JsString domain, JsArray<JsString> keys)
{
if (!fileLoaded) {
makeSynchronousRequest( url );
}
return provideTranslations(domain, keys);
}
开发者ID:griffith-computing,项目名称:Randori,代码行数:8,代码来源:PropertyFileTranslator.cs
示例8: getCachedHtmlForUri
public JsString getCachedHtmlForUri(JsString key)
{
if (ContentCache.htmlMergedFiles[key] != null)
{
return ContentCache.htmlMergedFiles[key];
}
return null;
}
开发者ID:griffith-computing,项目名称:Randori,代码行数:8,代码来源:ContentCache.cs
示例9: injectPotentialNode
public override void injectPotentialNode(JsString id, object node)
{
//Ugly hack for the moment, figure out a better way to handle by checking the identity... somehow... of this class
dynamic behavior = node;
if (_mediator == null && behavior.setViewData != null) {
_mediator = behavior;
}
}
开发者ID:griffith-computing,项目名称:Randori,代码行数:8,代码来源:MediatorCapturer.cs
示例10: buildChildClassBuilder
public InjectionClassBuilder buildChildClassBuilder(InjectionClassBuilder classBuilder, HtmlElement element, JsString contextClassName)
{
var module = (GuiceModule)classBuilder.buildClass(contextClassName);
var injector = (ChildInjector)classBuilder.buildClass("guice.ChildInjector");
var guiceJs = new GuiceJs();
guiceJs.configureInjector(injector, module);
//Setup a new InjectionClassBuilder
return (InjectionClassBuilder)injector.getInstance(typeof(InjectionClassBuilder));
}
开发者ID:labriola,项目名称:Randori,代码行数:10,代码来源:DomExtensionFactory.cs
示例11: AddAnalyticsDataPoint
/* statMobi Analytics */
/// <summary>
/// This sample function records an event ID, as well as an optional
/// set of name/value pairs as a query string to the statMobi Analytics
/// logs.
/// </summary>
/// <param name="eventID"></param>
/// <param name="queryString"></param>
public static void AddAnalyticsDataPoint(JsString eventID, JsString queryString)
{
try
{
if (queryString == null) { queryString = ""; }
Xdk.analytics.LogPageEvent("/application/" + eventID +
".event", queryString, "", GetPost.GET, 0, "index.html");
}
catch (JsError e) { }
}
开发者ID:hultqvist,项目名称:SharpKit-SDK,代码行数:19,代码来源:Analytics.cs
示例12: Querystring_get
JsString Querystring_get(JsString key, JsString default_)
{
// This silly looking line changes UNDEFINED to NULL
if (default_ == null) default_ = null;
JsString value = this.parameters[key];
if (value == null) value = default_;
return value;
}
开发者ID:fjgandrade,项目名称:sharpkit,代码行数:10,代码来源:QueryString.cs
示例13: injectPotentialNode
public void injectPotentialNode( JsString id, object node)
{
//if we ever want to throw an error because of a duplicate id injection, this is the place to do it
//right now first one in wins
if (viableInjectionPoints[id] != null) {
JsContext.delete( viableInjectionPoints[ id ] );
dynamic instance = this;
instance[ id ] = node;
}
}
开发者ID:labriola,项目名称:Randori,代码行数:10,代码来源:AbstractBehavior.cs
示例14: addCSSEntry
public void addCSSEntry(JsString cssSelector, JsString extensionType, JsString extensionValue )
{
StyleExtensionMapEntry attributes = hashMap[cssSelector];
if (attributes == null) {
attributes = new StyleExtensionMapEntry();
hashMap[cssSelector] = attributes;
}
attributes.addExtensionType(extensionType, extensionValue);
}
开发者ID:griffith-computing,项目名称:Randori,代码行数:11,代码来源:StyleExtensionMap.cs
示例15: hasView
public bool hasView(JsString url)
{
jQuery fragment = null;
var allFragments = decoratedNode.children();
if ( allFragments.length > 0 ) {
fragment = allFragments.find("[data-url='" + url + "']");
}
return ((fragment != null) && fragment.length>0);
}
开发者ID:RandoriCSharp,项目名称:randori-framework,代码行数:11,代码来源:ViewStack.cs
示例16: addBehaviorEntry
public void addBehaviorEntry(JsString cssClassName, JsString behaviorType, JsString className )
{
StyleExtensionMapEntry attributes = hashMap[cssClassName];
if (attributes == null) {
attributes = new StyleExtensionMapEntry();
hashMap[cssClassName] = attributes;
}
attributes.addExtensionType(behaviorType, className);
}
开发者ID:labriola,项目名称:Randori,代码行数:11,代码来源:StyleBehaviorMap.cs
示例17: addTimeToUrl
public static JsString addTimeToUrl(JsString url)
{
if (-1 == url.indexOf("?"))
{
url += "?" + "time=" + (new JsDate()).getTime();
}
else
{
url += "&" + "time=" + (new JsDate()).getTime();
}
return url;
}
开发者ID:mgerasika,项目名称:gam-gam,代码行数:12,代码来源:ajaxHlp.cs
示例18: injectPotentialNode
public virtual void injectPotentialNode( JsString id, object node)
{
//by default dont inject if we dont have an id... we would have no way to reference it
//if we ever want to throw an error because of a duplicate id injection, this is the place to do it
//right now first one in wins
if ((id != null) && (viableInjectionPoints != null ) && (viableInjectionPoints[id] != null))
{
JsContext.delete( viableInjectionPoints[ id ] );
dynamic instance = this;
instance[ id ] = node;
}
}
开发者ID:griffith-computing,项目名称:Randori,代码行数:12,代码来源:AbstractBehavior.cs
示例19: PrependToLog
public static void PrependToLog(HtmlElement log, JsString message)
{
HtmlDivElement child = new HtmlDivElement();
child.innerHTML = message;
if (log.firstChild == null)
{
log.AppendChild(child);
}
else
{
log.InsertBefore(child, log.firstChild);
}
}
开发者ID:hultqvist,项目名称:SharpKit-SDK,代码行数:13,代码来源:Global.cs
示例20: synchronousLoad
public JsString synchronousLoad(JsString fragmentURL)
{
//We need to check to see if we already have this content. If we do not, then we need to load it now and insert it into the DOM
var request = new XMLHttpRequest();
request.open("GET", fragmentURL, false);
request.send("");
if (request.status == 404) {
throw new JsError("Cannot continue, missing required content " + fragmentURL);
}
return request.responseText;
}
开发者ID:labriola,项目名称:Randori,代码行数:13,代码来源:ContentLoader.cs
注:本文中的JsString类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论