public static void Register(IClientScriptManager manager, Registrations registrations, Nparams attrib)
 {
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     if ((registrations & Registrations.SwfUpload) == Registrations.SwfUpload)
     {
         //string swfUploadVersion;
         string version = SwfUploadVersion; // ((attrib != null) && attrib.TryGetValue("swfUploadVersion", out swfUploadVersion) ? swfUploadVersion : SwfUploadVersion);
         if (string.IsNullOrEmpty(version))
         {
             throw new InvalidOperationException("version");
         }
         string versionFolder = "Contoso.Resource_.SwfUpload" + version.Replace(".", "_");
         // STATE
         HttpContext.Current.Set <ClientScriptRegistrarSwfUploadShape>(new ClientScriptRegistrarSwfUploadShape
         {
             SwfUploadFlashUrl = ClientScriptManagerEx.GetWebResourceUrl(_type, versionFolder + ".swfupload.swf"),
         });
         // INCLUDES
         manager.EnsureItem <HtmlHead>("SwfUpload", () => new IncludeForResourceClientScriptItem(_type, "Contoso.Resource_.SwfUpload" + version + ".js"));
         if ((registrations & Registrations.SwfUploadCookiePlugin) == Registrations.SwfUploadCookiePlugin)
         {
             manager.EnsureItem <HtmlHead>("CookiePlugin", () => new IncludeForResourceClientScriptItem(_type, versionFolder + ".cookies.js"));
         }
         if ((registrations & Registrations.SwfUploadQueuePlugin) == Registrations.SwfUploadQueuePlugin)
         {
             manager.EnsureItem <HtmlHead>("QueuePlugin", () => new IncludeForResourceClientScriptItem(_type, versionFolder + ".queue.js"));
         }
         if ((registrations & Registrations.SwfUploadSpeedPlugin) == Registrations.SwfUploadSpeedPlugin)
         {
             manager.EnsureItem <HtmlHead>("SpeedPlugin", () => new IncludeForResourceClientScriptItem(_type, versionFolder + ".speed.js"));
         }
         if ((registrations & Registrations.SwfUploadSwfObjectPlugin) == Registrations.SwfUploadSwfObjectPlugin)
         {
             manager.EnsureItem <HtmlHead>("SwfObjectPlugin", () => new IncludeForResourceClientScriptItem(_type, versionFolder + ".swfobject.js"));
         }
     }
 }
Пример #2
0
 public static void Register(IClientScriptManager manager, Registrations registrations, Nparams attrib)
 {
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     if ((registrations & Registrations.SwfObject) == Registrations.SwfObject)
     {
         var version = SwfObjectVersion; // ((attrib != null) && attrib.TryGetValue("swfObjectVersion", out swfObjectVersion) ? swfObjectVersion : SwfObjectVersion);
         if (string.IsNullOrEmpty(version))
         {
             throw new InvalidOperationException("version");
         }
         var versionFolder = "Contoso.Resource_.SwfObject" + version.Replace(".", "_");
         // STATE
         HttpContext.Current.Set <ClientScriptRegistrarSwfObjectShape>(new ClientScriptRegistrarSwfObjectShape
         {
             SwfObjectExpressInstallFlashUrl = ClientScriptManagerEx.GetWebResourceUrl(_type, versionFolder + ".expressInstall.swf"),
         });
         // INCLUDES
         manager.EnsureItem <HtmlHead>("SwfObject", () => new IncludeForResourceClientScriptItem(_type, "Contoso.Resource_.SwfObject" + version + ".js"));
     }
 }