Sample01
1.0.0.0
Sample01 사용 방법을 보여 주는 예제 프로젝트입니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
App.xaml.cs
이 파일의 문서화 페이지로 가기
1
using
Dreamine.Hybrid.Wpf.Interfaces;
7
using
Microsoft.Extensions.DependencyInjection;
8
using
Sample01.ViewModels
;
9
using
Sample01.Views
;
10
using
System;
11
using
System.Windows;
12
namespace
Sample01
13
{
22
public
partial class
App
: Application, IDreamineServiceProviderAware
23
{
32
public
static
IServiceProvider?
ServiceProvider
{
get
;
private
set
; }
33
58
public
void
SetServiceProvider
(IServiceProvider serviceProvider)
59
{
60
ServiceProvider
= serviceProvider ??
throw
new
ArgumentNullException(nameof(serviceProvider));
61
}
62
87
protected
override
void
OnStartup
(StartupEventArgs e)
88
{
89
base.OnStartup(e);
90
91
if
(
ServiceProvider
is
null
)
92
throw
new
InvalidOperationException(
"ServiceProvider 초기화 실패: Program.BuildHost가 먼저 호출되어야 합니다."
);
93
94
var vm =
ServiceProvider
.GetRequiredService<
MainWindowViewModel
>();
95
var win =
ServiceProvider
.GetRequiredService<
MainWindow
>();
96
win.DataContext = vm;
97
98
MainWindow
= win;
99
win.Show();
100
}
101
}
102
}
Sample01
Definition
App.xaml.cs:13
Sample01.ViewModels
Definition
MainWindowViewModel.cs:13
Sample01.Views
Definition
MainWindow.xaml.cs:19
Sample01.App
Definition
App.xaml.cs:23
Sample01.App.OnStartup
override void OnStartup(StartupEventArgs e)
Definition
App.xaml.cs:87
Sample01.App.SetServiceProvider
void SetServiceProvider(IServiceProvider serviceProvider)
Definition
App.xaml.cs:58
Sample01.App.ServiceProvider
static ? IServiceProvider ServiceProvider
Definition
App.xaml.cs:32
Sample01.ViewModels.MainWindowViewModel
Definition
MainWindowViewModel.cs:23
Sample01.Views.MainWindow
Definition
MainWindow.xaml.cs:29
App.xaml.cs
다음에 의해 생성됨 :
1.17.0