public AppController(AppWindow appView) { try { this.appView = appView; var appModel = AppModel.Instance; // Create application modules externalController = new ExternalEventsController(this.appView, appModel.ExternalModel); workspaceController = new WorkspaceController(this.appView, appModel.WorkspaceModel); menuController = new MenuItemsController(this.appView, appModel.MenuModel); sceneTreeController = new SceneTreeController(this.appView, appModel.SceneTreeModel); toolbarController = new ToolstripItemsController(this.appView, appModel.ToolbarsModel); windowController = new WindowController(this.appView, appModel.AppWindowModel); // Create application configuration appModel.InitializeSettings(workspaceController.GraphicsUpdateCallback, this.appView, this.appView.Size); // Redirect UI invocations to the main form control MyMethodInvoker.SetInvocationTarget(appView); } catch (OutOfMemoryException ex) { MessageBoxFactory.Create(caption: "Critical Error", text: string.Format("Unable to create all application modules{0}Detailed information may be available in the LogFile.", Environment.NewLine), boxType: MessageBoxType.Error); Logger.Error(ex.ToString()); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var appView = new AppWindow(); // ReSharper disable once UnusedVariable var appController = new AppController(appView); Application.Run(appView); }