Ejemplo n.º 1
0
        public static void EndAspNetApplication(this Sphere10Framework applicationLifecycle)
        {
            var abort       = false;
            var abortReason = string.Empty;

            applicationLifecycle.EndFramework(out abort, out abortReason);
        }
Ejemplo n.º 2
0
        public static void StartAspNetApplication(this Sphere10Framework applicationLifecycle)
        {
            applicationLifecycle.StartFramework();
            // Set MVC dep resolver
            System.Web.Mvc.DependencyResolver.SetResolver(new ComponentRegistryMvcDependencyResolver(ComponentRegistry.Instance));

            //// Set Web API dep resolver
            System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver = new ComponentRegistryWebApiDependencyResolver(ComponentRegistry.Instance);
        }
Ejemplo n.º 3
0
        public static void StartWinFormsApplication(this Sphere10Framework applicationLifecycle)
        {
            applicationLifecycle.StartFramework();
            var mainForm = ComponentRegistry.Instance.Resolve <IMainForm>();

            if (!(mainForm is Form))
            {
                throw new SoftwareException("Registered IMainForm is not a WinForms Form");
            }
            if (mainForm is IBlockManager)
            {
                var blockManager = mainForm as IBlockManager;
                var blocks       = ComponentRegistry.Instance.ResolveAll <IApplicationBlock>().OrderBy(b => ComponentRegistryExtensions.BlockPositions[b.GetType()]);
                blocks.ForEach(blockManager.RegisterBlock);
            }
            System.Windows.Forms.Application.Run(mainForm as Form);
        }
Ejemplo n.º 4
0
 public static void EndWinFormsApplication(this Sphere10Framework applicationLifecycle, out bool abort, out string abortReason)
 {
     applicationLifecycle.EndFramework(out abort, out abortReason);
 }
Ejemplo n.º 5
0
 public static void StartWinFormsApplication <TMainForm>(this Sphere10Framework applicationLifecycle)
     where TMainForm : class, IMainForm
 {
     ComponentRegistry.Instance.RegisterMainForm <TMainForm>();
     applicationLifecycle.StartWinFormsApplication();
 }