Пример #1
0
        /// <summary>
        /// Registers this module for all events required by the Spring.Web framework
        /// </summary>
        public virtual void Init(HttpApplication app)
        {
            lock (typeof(WebSupportModule))
            {
                s_log.Debug("Initializing Application instance");
                if (!s_isInitialized)
                {
                    HttpModuleCollection modules = app.Modules;
                    foreach (string moduleKey in modules.AllKeys)
                    {
                        if (modules[moduleKey] is SessionStateModule)
                        {
                            HookSessionEvent((SessionStateModule)modules[moduleKey]);
                        }
                    }
                }
                s_isInitialized = true;

                // signal, that VirtualEnvironment is ready to accept
                // handler registrations for EndRequest and EndSession events
                VirtualEnvironment.SetInitialized();
            }

            app.PreRequestHandlerExecute += new EventHandler(OnConfigureHandler);
            app.EndRequest += new EventHandler(VirtualEnvironment.RaiseEndRequest);

#if NET_2_0
            // TODO: this is only a workaround to get us up & running in IIS7/integrated mode
            // We must review all code for relative virtual paths - they must be resolved to application-relative paths
            // during parsing of the object definitions
            bool hideRequestResponse = false;
            if (ContextHideRequestResponse != null)
            {
                hideRequestResponse = (bool)ContextHideRequestResponse.GetValue(app.Context);
                ContextHideRequestResponse.SetValue(app.Context, false);
            }
#endif
            try
            {
                // ensure context is instantiated
                IConfigurableApplicationContext appContext = WebApplicationContext.GetRootContext() as IConfigurableApplicationContext;
                // configure this app + it's module instances
                if (appContext == null)
                {
                    throw new InvalidOperationException("Implementations of IApplicationContext must also implement IConfigurableApplicationContext");
                }

                HttpApplicationConfigurer.Configure(appContext, app);
            }
            finally
            {
#if NET_2_0
                if (ContextHideRequestResponse != null)
                {
                    ContextHideRequestResponse.SetValue(app.Context, hideRequestResponse);
                }
#endif
            }
        }
        public NamingContainerSupportsWebDependencyInjectionOwnerProxy(IApplicationContext defaultApplicationContext, Control targetControl) : base(defaultApplicationContext, targetControl)
        {
#if NET_2_0
            object targetOccasionalFields = refOccasionalFields.GetValue(targetControl);
            refOccasionalFields.SetValue(this, targetOccasionalFields);
#endif
        }
Пример #3
0
        public override void SetStat(Equipment item, float val)
        {
            float[] vals = info.GetValue(item.Stats);

            vals[(int)type] = val;

            info.SetValue(item.Stats, vals);
        }
Пример #4
0
 public override void Set(object context, object value)
 {
     field.SetValue(context, value);
 }
Пример #5
0
 public override void SetStat(Equipment item, float val)
 {
     info.SetValue(item.Stats, val);
 }