Atomia.Web.Frame.MvcApplication.MvcApplication C# (CSharp) Method

MvcApplication() public method

Initializes a new instance of the MvcApplication class.
public MvcApplication ( ) : System
return System
        public MvcApplication()
        {
            this.HandlerClass = null;

            try
            {
                if (AtomiaWebBaseInterfaceConfig.Instance != null && AtomiaWebBaseInterfaceConfig.Instance.InterfaceList != null)
                {
                    GlobalEventDefaultHandler configHandler = AtomiaWebBaseInterfaceConfig.Instance.InterfaceList.GlobalEventDefaultHandler;

                    if (configHandler != null)
                    {
                        Type t = Type.GetType(string.Format("{0}.{1}, {2}", configHandler.ClassNamespace, configHandler.ClassName, configHandler.ClassAssembly));
                        if (t != null)
                        {
                            this.HandlerClass = (GlobalEventsDefaultHandler)Activator.CreateInstance(t);
                        }
                        else
                        {
                            Assembly pluginAssembly = GetPluginAssembly(configHandler);

                            if (pluginAssembly != null)
                            {
                                foreach (Type pluginAssemblyType in pluginAssembly.GetTypes().Where(pluginAssemblyType => pluginAssemblyType.Namespace == configHandler.ClassNamespace && pluginAssemblyType.Name == configHandler.ClassName))
                                {
                                    this.HandlerClass = (GlobalEventsDefaultHandler)Activator.CreateInstance(pluginAssemblyType);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                OrderPageLogger.LogOrderPageException(e);
            }

            if (this.HandlerClass == null)
            {
                this.HandlerClass = new GlobalEventsDefaultHandler();
            }
        }