Esempio n. 1
0
        public static void ChangeTimeout(this eBrochureDomainContext domainContext,
                                         TimeSpan newTimeout)
        {
            // Try to get the channel factory property from the domain client
            // of the domain context. In case that this property does not exist
            // we throw an invalid operation exception.
            var channelFactoryProperty = domainContext.DomainClient.GetType().GetProperty("ChannelFactory");

            if (channelFactoryProperty == null)
            {
                throw new InvalidOperationException("The 'ChannelFactory' property on the DomainClient does not exist.");
            }

            // Now get the channel factory from the domain client and set the
            // new timeout to the binding of the service endpoint.
            var factory = (ChannelFactory)channelFactoryProperty.GetValue(domainContext.DomainClient, null);

            factory.Endpoint.Binding.SendTimeout = newTimeout;
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            HttpWebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
            HttpWebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
            // This will enable you to bind controls in XAML to WebContext.Current properties.
            this.Resources.Add("WebContext", WebContext.Current);
            JavaScriptMethods JSM = new JavaScriptMethods();

            HtmlPage.RegisterScriptableObject("JSM", JSM);
            // This will automatically authenticate a user when using Windows authentication or when the user chose "Keep me signed in" on a previous login attempt.
            //WebContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);
            eBrochure_zeebregts.Web.Services.eBrochureDomainContext ctx = new Web.Services.eBrochureDomainContext();


            ((WebDomainClient <eBrochure_zeebregts.Web.Services.eBrochureDomainContext.IeBrochureDomainServiceContract>)ctx.DomainClient).ChannelFactory.Endpoint.Binding.OpenTimeout = new TimeSpan(0, 10, 0);
            Acumulator.Instance().ctx = ctx;
            this.Resources.Add("ClientIP", e.InitParams["ClientIP"]);
            //   var ipaddress = e.InitParams["ClientIP"];
            //    MessageBox.Show(ipaddress + "::" + hostipaddres);
            // Acumulator.Instance().ClientIP = ipaddress;

            // Show some UI to the user while LoadUser is in progress
            this.InitializeRootVisual();
        }