Skip to content

Commit f887ee4

Browse files
committed
Improve Template
1 parent 6d417be commit f887ee4

5 files changed

Lines changed: 36 additions & 16 deletions

File tree

VSIX/DevWinUI_Template/DevWinUI_Template/Common/PredefinedCodes.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,4 @@ private async void NavigateToLogPath_Click(object sender, RoutedEventArgs e)
195195
<uap5:StartupTask TaskId="$safeprojectname$StartOnLoginTask" Enabled="true" DisplayName="ms-resource:AppDisplayName" />
196196
</uap5:Extension>
197197
"""";
198-
199-
public static readonly string InitializeAppMethods =
200-
""""
201-
private $OnLaunchedAsyncKeyword$void InitializeAppMethods()
202-
{
203-
$PackagedAppTaskId$$Windows11ContextMenuInitializer$$ConfigLogger$$UnhandeledException$
204-
}
205-
"""";
206198
}

VSIX/DevWinUI_Template/WinUIApp-MVVM-NavigationView/App.xaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private static IServiceProvider ConfigureServices()
3535
return services.BuildServiceProvider();
3636
}
3737

38-
protected $OnLaunchedAsyncKeyword$override void OnLaunched(LaunchActivatedEventArgs args)
38+
protected override void OnLaunched(LaunchActivatedEventArgs args)
3939
{
4040
MainWindow = new MainWindow();
4141

@@ -44,7 +44,14 @@ private static IServiceProvider ConfigureServices()
4444

4545
ThemeService.AutoInitialize(MainWindow).ConfigureTintColor();
4646

47-
MainWindow.Activate();$PackagedAppTaskId$$Windows11ContextMenuMVVMInitializer$$ConfigLogger$$UnhandeledException$
47+
MainWindow.Activate();
48+
49+
InitializeApp();
50+
}
51+
52+
private $OnLaunchedAsyncKeyword$void InitializeApp()
53+
{
54+
$PackagedAppTaskId$$Windows11ContextMenuMVVMInitializer$$ConfigLogger$$UnhandeledException$
4855
}
4956
}
5057

VSIX/DevWinUI_Template/WinUIApp-MVVM/App.xaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private static IServiceProvider ConfigureServices()
3333
return services.BuildServiceProvider();
3434
}
3535

36-
protected $OnLaunchedAsyncKeyword$override void OnLaunched(LaunchActivatedEventArgs args)
36+
protected override void OnLaunched(LaunchActivatedEventArgs args)
3737
{
3838
MainWindow = new MainWindow();
3939

@@ -42,7 +42,14 @@ private static IServiceProvider ConfigureServices()
4242

4343
ThemeService.AutoInitialize(MainWindow);
4444

45-
MainWindow.Activate();$Windows11ContextMenuMVVMInitializer$$ConfigLogger$$UnhandeledException$
45+
MainWindow.Activate();
46+
47+
InitializeApp();
48+
}
49+
50+
private $OnLaunchedAsyncKeyword$void InitializeApp()
51+
{
52+
$Windows11ContextMenuMVVMInitializer$$ConfigLogger$$UnhandeledException$
4653
}
4754
}
4855

VSIX/DevWinUI_Template/WinUIApp-NavigationView/App.xaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public App()
1313
NavService = new JsonNavigationService();
1414
}
1515

16-
protected $OnLaunchedAsyncKeyword$override void OnLaunched(LaunchActivatedEventArgs args)
16+
protected override void OnLaunched(LaunchActivatedEventArgs args)
1717
{
1818
MainWindow = new MainWindow();
1919

@@ -22,7 +22,14 @@ public App()
2222

2323
ThemeService = new ThemeService(MainWindow);
2424

25-
MainWindow.Activate();$PackagedAppTaskId$$Windows11ContextMenuInitializer$$ConfigLogger$$UnhandeledException$
25+
MainWindow.Activate();
26+
27+
InitializeApp();
28+
}
29+
30+
private $OnLaunchedAsyncKeyword$void InitializeApp()
31+
{
32+
$PackagedAppTaskId$$Windows11ContextMenuInitializer$$ConfigLogger$$UnhandeledException$
2633
}
2734
}
2835

VSIX/DevWinUI_Template/WinUIApp/App.xaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public App()
1111
this.InitializeComponent();
1212
}
1313

14-
protected $OnLaunchedAsyncKeyword$override void OnLaunched(LaunchActivatedEventArgs args)
14+
protected override void OnLaunched(LaunchActivatedEventArgs args)
1515
{
1616
MainWindow = new MainWindow();
1717

@@ -20,7 +20,14 @@ public App()
2020

2121
ThemeService = new ThemeService(MainWindow);
2222

23-
MainWindow.Activate();$Windows11ContextMenuInitializer$$ConfigLogger$$UnhandeledException$
23+
MainWindow.Activate();
24+
25+
InitializeApp();
26+
}
27+
28+
private $OnLaunchedAsyncKeyword$void InitializeApp()
29+
{
30+
$Windows11ContextMenuInitializer$$ConfigLogger$$UnhandeledException$
2431
}
2532
}
2633

0 commit comments

Comments
 (0)