// called by // returns to public static NameValueCollection GetInternalFields(object r = null, WebClient xWebClient = null) { // Z:\jsc.svn\examples\javascript\Test\TestAfterInvokeResponseHeaders\ApplicationWebService.cs //Console.WriteLine("enter GetInternalFields"); // X:\jsc.svn\examples\javascript\test\TestNullObjectFromWebService\TestNullObjectFromWebService\Application.cs // X:\jsc.svn\core\ScriptCoreLib.Ultra.Library\ScriptCoreLib.Ultra.Library\Ultra\WebService\InternalGlobalExtensions.InternalApplication_BeginRequest.cs //.field field_elapsed:<Stopwatch ElapsedMilliseconds="1204" IsRunning="True" /> if (xWebClient != null) { var value = new NameValueCollection(); xWebClient.ResponseHeaders.AllKeys.WithEach( k => { // Z:\jsc.svn\examples\javascript\Test\TestFirefoxWebServiceField\ApplicationWebService.cs var FieldName = k.SkipUntilOrEmpty(".field-"); if (string.IsNullOrEmpty(FieldName)) { return; } var FieldValue = xWebClient.ResponseHeaders[k]; //Console.WriteLine("GetInternalFields " + new { FieldName, FieldValue }); value[FieldName] = FieldValue; } ); return(value); } // web worker may not have window cookies // X:\jsc.svn\core\ScriptCoreLib.Ultra.Library\ScriptCoreLib.Ultra.Library\Ultra\WebService\InternalGlobalExtensions.cs var InternalFieldsCookie = new globalscl::ScriptCoreLib.JavaScript.Runtime.Cookie("InternalFields"); var InternalFieldsCookieValue = InternalFieldsCookie.Value; //Console.WriteLine("GetInternalFields " + new { InternalFieldsCookieValue }); var InternalFields = InternalFieldsCookie.Values; // tested by // X:\jsc.svn\examples\javascript\chrome\apps\ChromeTCPServer\ChromeTCPServer\Application.cs if (!__window_localStorage_available) { return(InternalFields); } InternalFieldsCookie.Delete(); // when is r null? if (r == null) { if (string.IsNullOrEmpty(InternalFieldsCookieValue)) { Console.WriteLine("GetInternalFields load fromlocalstorage! "); InternalFieldsCookieValue = Native.window.localStorage["InternalFields"]; InternalFields = globalscl::ScriptCoreLib.JavaScript.Runtime.Cookie.GetValues(InternalFieldsCookieValue); } else { //Console.WriteLine("GetInternalFields save to localstorage! " + new { InternalFieldsCookieValue }); Native.window.localStorage["InternalFields"] = InternalFieldsCookieValue; } } return(InternalFields); }
// called by // returns to public static NameValueCollection GetInternalFields(object r = null, WebClient xWebClient = null) { // Z:\jsc.svn\examples\javascript\Test\TestAfterInvokeResponseHeaders\ApplicationWebService.cs //Console.WriteLine("enter GetInternalFields"); // X:\jsc.svn\examples\javascript\test\TestNullObjectFromWebService\TestNullObjectFromWebService\Application.cs // X:\jsc.svn\core\ScriptCoreLib.Ultra.Library\ScriptCoreLib.Ultra.Library\Ultra\WebService\InternalGlobalExtensions.InternalApplication_BeginRequest.cs //.field field_elapsed:<Stopwatch ElapsedMilliseconds="1204" IsRunning="True" /> if (xWebClient != null) { var value = new NameValueCollection(); xWebClient.ResponseHeaders.AllKeys.WithEach( k => { // Z:\jsc.svn\examples\javascript\Test\TestFirefoxWebServiceField\ApplicationWebService.cs var FieldName = k.SkipUntilOrEmpty(".field-"); if (string.IsNullOrEmpty(FieldName)) return; var FieldValue = xWebClient.ResponseHeaders[k]; //Console.WriteLine("GetInternalFields " + new { FieldName, FieldValue }); value[FieldName] = FieldValue; } ); return value; } // web worker may not have window cookies // X:\jsc.svn\core\ScriptCoreLib.Ultra.Library\ScriptCoreLib.Ultra.Library\Ultra\WebService\InternalGlobalExtensions.cs var InternalFieldsCookie = new globalscl::ScriptCoreLib.JavaScript.Runtime.Cookie("InternalFields"); var InternalFieldsCookieValue = InternalFieldsCookie.Value; //Console.WriteLine("GetInternalFields " + new { InternalFieldsCookieValue }); var InternalFields = InternalFieldsCookie.Values; // tested by // X:\jsc.svn\examples\javascript\chrome\apps\ChromeTCPServer\ChromeTCPServer\Application.cs if (!__window_localStorage_available) return InternalFields; InternalFieldsCookie.Delete(); // when is r null? if (r == null) { if (string.IsNullOrEmpty(InternalFieldsCookieValue)) { Console.WriteLine("GetInternalFields load fromlocalstorage! "); InternalFieldsCookieValue = Native.window.localStorage["InternalFields"]; InternalFields = globalscl::ScriptCoreLib.JavaScript.Runtime.Cookie.GetValues(InternalFieldsCookieValue); } else { //Console.WriteLine("GetInternalFields save to localstorage! " + new { InternalFieldsCookieValue }); Native.window.localStorage["InternalFields"] = InternalFieldsCookieValue; } } return InternalFields; }