本文整理汇总了C#中JsString类的典型用法代码示例。如果您正苦于以下问题:C# JsString类的具体用法?C# JsString怎么用?C# JsString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsString类属于命名空间,在下文中一共展示了JsString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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 );
}
示例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);
}
示例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;
}
示例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>();
}
示例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;
}
}
示例7: synchronousTranslate
public override JsArray<Translation> synchronousTranslate(JsString domain, JsArray<JsString> keys)
{
if (!fileLoaded) {
makeSynchronousRequest( url );
}
return provideTranslations(domain, keys);
}
示例8: getCachedHtmlForUri
public JsString getCachedHtmlForUri(JsString key)
{
if (ContentCache.htmlMergedFiles[key] != null)
{
return ContentCache.htmlMergedFiles[key];
}
return null;
}
示例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;
}
}
示例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));
}
示例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) { }
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}