private void Application_Startup(object sender, StartupEventArgs e) { DispatcherHelper.UIDispatcher = Dispatcher; #if !DEBUG AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; #endif RunCommand.Initialize(); _mainWindow = new MainWindow { WindowStartupLocation = WindowStartupLocation.Manual, Top = 0, Left = 0 }; _mainWindow.Show(); //ホットキー周りをよしなにやってくれる神ライブラリで神すぎて神 ApplicationUtilities.ProcessCommand += ProcessCommand; HotKey = new HotKeyUtilities(_mainWindow); var ret = HotKey.RegisterHotKey(ModifierKeys.Alt, Key.F12, SwitchWindowState); if (!ret) { MessageBox.Show("Fail to register a hotkey."); } }