Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            EventManager.RegisterClassHandler(typeof(System.Windows.Controls.TextBox),
                  System.Windows.Controls.TextBox.GotFocusEvent,
                  new RoutedEventHandler(TextBox_GotFocus));

            base.OnStartup(e);
            this.Exit += new ExitEventHandler(App_Exit);
            _eventHandler = new EventHandler(mainWindow_RequestClose);

            _window = new MainWindow()
            {
                //WindowStyle = WindowStyle.ToolWindow,
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen
            };

            _mainWindowVM = new MainWindowViewModel();

            _mainWindowVM.CloseEvent += _eventHandler;

            _window.DataContext = _mainWindowVM;

            _window.Show();
        }
Beispiel #2
0
 private void App_Exit(object sender, ExitEventArgs e)
 {
     _eventHandler = null;
     _mainWindowVM = null;
     _window = null;
 }