コード例 #1
0
        public ObjectInspectorView(NavigatorViewModel navigatorViewModel)
        {
            this.InitializeComponent();

            this.DataContext = navigatorViewModel;

            navigatorViewModel.RefreshInspector += (s, e) => this.PropertyGrid.Update();
        }
コード例 #2
0
        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();
        }