forked from IdrisQashan/WSM.Dependency.Injection.Winform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWForm.cs
29 lines (28 loc) · 733 Bytes
/
WForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WSM.Dependency.Injection;
namespace WSMDependencyInjection.Components.Main
{
public class WForm : Form
{
internal AppBuilder appBuilder;
public void WShow<T>()
where T : WForm
{
var obj = (WForm)appBuilder.Inject(typeof(T));
obj.appBuilder = appBuilder;
obj.Show();
}
public void WShowDialog<T>()
where T : WForm
{
var obj = (WForm)appBuilder.Inject(typeof(T));
obj.appBuilder = appBuilder;
obj.ShowDialog();
}
}
}