public ApplicationRoot(IEventAggregator eventAggregator,
                               ToolsetGame game,
                               IDataService dataService)
        {
            InitializeComponent();

            GameGrid.Children.Add(game);
            _dataService = dataService;

            _eventAggregator = eventAggregator;
            _eventAggregator.GetEvent <ApplicationClosedEvent>().Subscribe(CloseApplication);
        }
Exemple #2
0
        private static void RegisterMonogame(ContainerBuilder builder)
        {
            // Create Direct3D 11 device.
            var presentationParameters = new PresentationParameters
            {
                // Do not associate graphics device with window.
                DeviceWindowHandle = IntPtr.Zero,
            };
            var device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, presentationParameters);

            builder.RegisterInstance(device).AsSelf();
            builder.RegisterInstance(new SpriteBatch(device)).AsSelf();
            builder.RegisterInstance(new Camera2D(device)).AsSelf();

            var game = new ToolsetGame(device);

            builder.RegisterInstance(game);
            builder.RegisterType <Texture2D>();
            builder.RegisterInstance(game.Content).AsSelf();
        }