本文整理汇总了C#中ScriptManager类的典型用法代码示例。如果您正苦于以下问题:C# ScriptManager类的具体用法?C# ScriptManager怎么用?C# ScriptManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScriptManager类属于命名空间,在下文中一共展示了ScriptManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start()
{
Show_BuyUnitText();
scriptManager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();
messageController = scriptManager.messageController;
}
示例2: EnsureScriptManager
/// <summary>
///
/// </summary>
/// <param name="sm"></param>
/// <param name="page"></param>
public static void EnsureScriptManager(ref ScriptManager sm, Page page)
{
if (sm == null)
{
sm = ScriptManager.GetCurrent(page);
if (sm == null)
{
ExceptionHelper.TrueThrow(page.Form.Controls.IsReadOnly, Resources.DeluxeWebResource.E_NoScriptManager);
sm = new ScriptManager();
//根据应用的Debug状态来决定ScriptManager的状态 2008-9-18
bool debug = WebAppSettings.IsWebApplicationCompilationDebug();
sm.ScriptMode = debug ? ScriptMode.Debug : ScriptMode.Release;
sm.EnableScriptGlobalization = true;
page.Form.Controls.Add(sm);
}
}
else
{
ExceptionHelper.FalseThrow(sm.EnableScriptGlobalization, "页面中ScriptManger对象中属性EnableScriptGlobalization值应该设置为True!");
}
if (sm != null)
{
sm.AsyncPostBackError -= sm_AsyncPostBackError;
sm.AsyncPostBackError += new EventHandler<AsyncPostBackErrorEventArgs>(sm_AsyncPostBackError);
}
}
示例3: CreateChildControls
protected override void CreateChildControls()
{
smCurrentScriptManager = new ScriptManager();
Controls.Add(smCurrentScriptManager);
base.CreateChildControls();
}
示例4: GenerateMapScriptCore
/// <summary>
/// Registers the JavaScript to display the map.
/// </summary>
/// <param name="scriptManager">The page's script manager.</param>
/// <param name="mapType">Type of the map.</param>
/// <param name="mapSectionId">The ID of the section (div) on the page in which the map should be created.</param>
/// <param name="currentLocationSpanId">The ID of the span showing the current location text.</param>
/// <param name="noLocationSpanId">The ID of the span shown when no location is selected.</param>
/// <param name="instructionSpanId">The ID of the span with driving directions, etc.</param>
/// <param name="directionsLinkId">The ID of the link to driving directions.</param>
/// <param name="directionsSectionId">The ID of the section (div) with driving directions text.</param>
/// <param name="locations">The list of locations to display.</param>
/// <param name="showAllLocationsOnLoad">if set to <c>true</c> shows the map with all locations on it by default.</param>
public override void GenerateMapScriptCore(ScriptManager scriptManager, MapType mapType, string mapSectionId, string currentLocationSpanId, string noLocationSpanId, string instructionSpanId, string directionsLinkId, string directionsSectionId, LocationCollection locations, bool showAllLocationsOnLoad)
{
ICollection<JavaScript.Location> locationsAsJson = locations.AsJson();
string mapParameters = String.Format(CultureInfo.InvariantCulture, "currentLocationSpan: {0}, noLocationSpan: {1}, instructionSpan: {2}, directionsLink: {3}, directionsSection: {4}, mapType: {5}, locationsArray: {6}", GetElementJavaScript(currentLocationSpanId), GetElementJavaScript(noLocationSpanId), GetElementJavaScript(instructionSpanId), GetElementJavaScript(directionsLinkId), GetElementJavaScript(directionsSectionId), ConvertMapType(mapType), new JavaScriptSerializer().Serialize(locationsAsJson));
scriptManager.Scripts.Add(new ScriptReference(GetLoaderUrl(this.ApiKey)));
scriptManager.Scripts.Add(new ScriptReference("Engage.Dnn.Locator.JavaScript.BaseLocator.js", "EngageLocator"));
scriptManager.Scripts.Add(new ScriptReference("Engage.Dnn.Locator.JavaScript.GoogleLocator.js", "EngageLocator"));
ScriptManager.RegisterStartupScript(
scriptManager.Page,
typeof(GoogleProvider),
"Initialize",
"google.setOnLoadCallback(jQuery(function(){ jQuery.noConflict(); $create(Engage.Dnn.Locator.GoogleMap, {" + mapParameters + "}, {}, {}, $get('" + mapSectionId + "')); }));",
true);
if (showAllLocationsOnLoad)
{
ScriptManager.RegisterStartupScript(
scriptManager.Page,
typeof(GoogleProvider),
"showAllLocations",
"google.setOnLoadCallback(jQuery(function(){ $find('" + mapSectionId + "$GoogleMap').showAllLocations(); }));",
true);
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager sm = new ScriptManager();
sm.EnablePageMethods = true;
this.form1.Controls.Add(sm);
}
示例6: ContainsService
public static bool ContainsService(ScriptManager manager, string service)
{
Assert.ArgumentNotNull(manager, "manager");
Assert.ArgumentNotNullOrEmpty(service, "service");
return manager.Services.FirstOrDefault(s => s.Path == service) != null;
}
示例7: ConfigureAuthenticationService
internal static void ConfigureAuthenticationService(ref StringBuilder sb, HttpContext context, ScriptManager scriptManager, List<ScriptManagerProxy> proxies) {
string authServiceUrl = null;
AuthenticationServiceManager authManager;
if(scriptManager.HasAuthenticationServiceManager) {
authManager = scriptManager.AuthenticationService;
// get ScriptManager.ServiceUrl
authServiceUrl = authManager.Path.Trim();
if(authServiceUrl.Length > 0) {
authServiceUrl = scriptManager.ResolveUrl(authServiceUrl);
}
}
// combine proxy ServiceUrls (find the first one that has specified one)
if(proxies != null) {
foreach(ScriptManagerProxy proxy in proxies) {
if(proxy.HasAuthenticationServiceManager) {
authManager = proxy.AuthenticationService;
// combine urls
authServiceUrl = ApplicationServiceManager.MergeServiceUrls(authManager.Path, authServiceUrl, proxy);
}
}
}
AuthenticationServiceManager.GenerateInitializationScript(ref sb, context, scriptManager, authServiceUrl);
}
示例8: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// add the script manager to the site to use Ajax
if (ScriptManager.GetCurrent(this.Page) == null)
{
this._sm = new ScriptManager();
_sm.EnablePageMethods = true;
this._sm.ID = "ScriptManager";
if (this.Page.IsPostBack)
{
this.Page.ClientScript.RegisterStartupScript(typeof(VanickApproveControlUserControl),
this.ID,
"_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;");
/*typeof("The Class Name of WebPart "),
"",
"_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;",
true);*/
}
if (this.Page.Form != null)
{
string str = this.Page.Form.Attributes["onsubmit"];
if (!(string.IsNullOrEmpty(str) || !(str == "return _spFormOnSubmitWrapper();")))
{
this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
}
this.Page.Form.Controls.AddAt(0, this._sm);
}
}
}
示例9: GetUrl
public string GetUrl(ScriptManager scriptManager)
{
string url = string.Empty;
if (String.IsNullOrEmpty(Path))
{
try
{
PropertyInfo piScriptManager_IControl = scriptManager.GetType().GetProperty("Control", BindingFlags.NonPublic | BindingFlags.Instance);
MethodInfo miScriptReference_GetUrl = typeof(ScriptReference).GetMethod("GetUrl", BindingFlags.NonPublic | BindingFlags.Instance);
Type typeIControl = Type.GetType(piScriptManager_IControl.PropertyType.AssemblyQualifiedName.ToString(), false, true);
//object value = Convert.ChangeType(piScriptManager_IControl.PropertyType, typeIControl);
object value = piScriptManager_IControl.GetValue(scriptManager, null);
url = (string)miScriptReference_GetUrl.Invoke(this, new object[] { scriptManager, value, false });
/*return base.GetUrl(scriptManager, false); //Ajax 3.5*/
//MethodInfo miGetScriptResourceUrl = typeof(ScriptManager).GetMethod("GetScriptResourceUrl", BindingFlags.NonPublic | BindingFlags.Instance);
//Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
//url = (string)miGetScriptResourceUrl.Invoke(scriptManager, new object[] { Name, asm });
}
catch (Exception ex) { }
}
else
{
url = scriptManager.ResolveClientUrl(Path);
}
return url;
}
示例10: Start
public void Start()
{
scriptManager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();
guiController = scriptManager.guiController;
turnController = scriptManager.turnController;
infopanel = scriptManager.infopanel;
}
示例11: GenerateInitializationScript
private static void GenerateInitializationScript(ref StringBuilder sb, HttpContext context, ScriptManager scriptManager, string serviceUrl) {
bool authEnabled = ApplicationServiceHelper.AuthenticationServiceEnabled;
if (authEnabled) {
if (sb == null) {
sb = new StringBuilder(ApplicationServiceManager.StringBuilderCapacity);
}
// The default path points to the built-in service (if it is enabled)
// Note that the client can't default to this path because it doesn't know what the app root is, we must tell it.
// We must specify the default path to the proxy even if a custom path is provided, because on the client they could
// reset the path back to the default if they want.
string defaultServicePath = scriptManager.ResolveClientUrl("~/" + System.Web.Script.Services.WebServiceData._authenticationServiceFileName);
sb.Append("Sys.Services._AuthenticationService.DefaultWebServicePath = '");
sb.Append(HttpUtility.JavaScriptStringEncode(defaultServicePath));
sb.Append("';\n");
}
bool pathSpecified = !String.IsNullOrEmpty(serviceUrl);
if(pathSpecified) {
if (sb == null) {
sb = new StringBuilder(ApplicationServiceManager.StringBuilderCapacity);
}
sb.Append("Sys.Services.AuthenticationService.set_path('");
sb.Append(HttpUtility.JavaScriptStringEncode(serviceUrl));
sb.Append("');\n");
}
// only emit this script if (1) the auth webservice is enabled or (2) a custom webservice url is specified
if ((authEnabled || pathSpecified) &&
(context != null && context.Request.IsAuthenticated)) {
Debug.Assert(sb != null);
sb.Append("Sys.Services.AuthenticationService._setAuthenticated(true);\n");
}
}
示例12: initAjax
protected virtual bool initAjax()
{
if (!VirtualPreviewUtil.IsVirtualPreview(this.Page))
{
ScriptManager scriptManager = AjaxManager.Current;
if (AjaxManager.Current == null)
{
scriptManager = new ScriptManager();
scriptManager.ID = StaticSettings.ScriptManagerID;
Controls.Add(scriptManager);
}
if (!scriptManager.EnablePartialRendering)
{
scriptManager.EnablePartialRendering = true;
}
if (!AjaxManager.ContainsService(scriptManager, StaticSettings.ServiceReference))
{
scriptManager.Services.Add(new ServiceReference(StaticSettings.ServiceReference));
}
}
return true;
}
示例13: AddTest_3
public void AddTest_3()
{
string temp;
ScriptManager sm = new ScriptManager();
bool result = sm.Add(_incorrectCode, true, out temp);
Assert.AreNotEqual(temp, "");
Assert.IsFalse(result);
}
示例14: GetUrl
public string GetUrl(ScriptManager scriptManager) {
if (String.IsNullOrEmpty(Path)) {
return base.GetUrl(scriptManager, false);
}
else {
return scriptManager.ResolveClientUrl(Path);
}
}
示例15: ScriptManager_Constructor_Returns_Not_Null
public void ScriptManager_Constructor_Returns_Not_Null()
{
var cacheManager = new Mock<ICacheManager>();
var contextAccessor = new Mock<IHttpContextAccessor>();
var target = new ScriptManager(cacheManager.Object, contextAccessor.Object);
Assert.IsNotNull(target);
}