Startup 이벤트 또는 상태 변경을 처리합니다.
84 {
85 base.OnStartup(e);
86
87 DispatcherUnhandledException += (_, args) =>
88 {
89 System.Windows.MessageBox.Show(
90 args.Exception.ToString(),
91 "오류 발생 — DreamineVMS",
92 System.Windows.MessageBoxButton.OK,
93 System.Windows.MessageBoxImage.Error);
94 args.Handled = true;
95 };
96
97 AppDomain.CurrentDomain.UnhandledException += (_, args) =>
98 {
99 System.Windows.MessageBox.Show(
100 args.ExceptionObject?.ToString() ?? "알 수 없는 오류",
101 "치명적 오류 — DreamineVMS",
102 System.Windows.MessageBoxButton.OK,
103 System.Windows.MessageBoxImage.Error);
104 };
105
106 if (ServiceProvider is null)
107 {
108 throw new InvalidOperationException("ServiceProvider initialization failed.");
109 }
110
111 MainWindowViewModel viewModel = ServiceProvider.GetRequiredService<MainWindowViewModel>();
112 MainWindow window = ServiceProvider.GetRequiredService<MainWindow>();
113 window.DataContext = viewModel;
114
115 MainWindow = window;
116 window.Show();
117 }