public NavigatorViewModel(IScreen screen, GameResourceManager gameResourceManager)
            : this()
        {
            this.screen = screen;
            this.gameResourceManager = gameResourceManager;

            this.RefreshTree();
        }
예제 #2
0
        public MonoGameBase(IScreen screen)
        {
            this.screen = screen;

            this.graphics = new GraphicsDeviceManager(this);
            this.Content.RootDirectory = "Content";

            this.gameResourceManager = new XnaGameResourceManager(this.Content);

            this.gameTimer = new GameFramework.GameTimer();

            #if WINDOWS
            this.gameNavigator = new GameNavigatorGateway();
            #endif
        }
        public void Launch(IScreen gameScreen, GameResourceManager gameResourceManager, Action<int, int> moveGameWindow)
        {
            RestoreGameWindow(moveGameWindow);

            // Create a thread
            var newWindowThread = new Thread(() =>
            {
                // Navigator window
                this.navigatorViewModel = new NavigatorViewModel(gameScreen, gameResourceManager);
                var navigator = new NavigatorView { DataContext = navigatorViewModel };
                this.navigatorWindow = new Window { Content = navigator };

                this.RestoreNavigatorWindow();

                this.navigatorWindow.Closing += (sender, args) => { args.Cancel = true; this.navigatorWindow.Hide(); };

                this.navigatorWindow.SizeChanged += (sender, args) => PersistNavigatorWindow();
                this.navigatorWindow.LocationChanged += (sender, args) => PersistNavigatorWindow();

                //this.navigatorWindow.Show();

                // Object Inspector window
                var objectInspector = new ObjectInspectorView(navigatorViewModel);
                this.inspectorWindow = new Window { Content = objectInspector, Title = "Object Inspector" };

                this.RestoreInspectorWindow();

                this.inspectorWindow.Closing += (sender, args) => { args.Cancel = true; this.inspectorWindow.Hide(); };

                this.inspectorWindow.SizeChanged += (sender, args) => PersistInspectorWindow();
                this.inspectorWindow.LocationChanged += (sender, args) => PersistInspectorWindow();

                // Start the Dispatcher Processing
                Dispatcher.Run();
            });

            // Set the apartment state
            newWindowThread.SetApartmentState(ApartmentState.STA);
            // Make the thread a background thread
            newWindowThread.IsBackground = true;
            // Start the thread
            newWindowThread.Start();
        }
        public void Launch(IScreen screen, GameResourceManager gameResourceManager, GameWindow gameWindow)
        {
            this.HookWindowClosingShouldSavePosition(gameWindow);

            this.service.Launch(screen, gameResourceManager, (x, y) => MoveGameWindow(gameWindow, x, y));
        }