Skip to content

Commit a9acf30

Browse files
Adding launchSettings.json to demo apps (#3293)
1 parent fb9ba3a commit a9acf30

File tree

6 files changed

+32
-2
lines changed

6 files changed

+32
-2
lines changed

MainDemo.Wpf/App.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ namespace MaterialDesignDemo;
77
/// </summary>
88
public partial class App : Application
99
{
10+
internal static string? StartupItem { get; private set; }
11+
1012
protected override void OnStartup(StartupEventArgs e)
1113
{
14+
if (e.Args.Length > 0)
15+
{
16+
StartupItem = e.Args[0];
17+
}
18+
1219
//This is an alternate way to initialize MaterialDesignInXAML if you don't use the MaterialDesignResourceDictionary in App.xaml
1320
//Color primaryColor = SwatchHelper.Lookup[MaterialDesignColor.DeepPurple];
1421
//Color accentColor = SwatchHelper.Lookup[MaterialDesignColor.Lime];

MainDemo.Wpf/Domain/MainWindowViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue)
3131
{
3232
DemoItems.Add(item);
3333
}
34-
SelectedItem = DemoItems.First();
34+
SelectedItem = DemoItems.FirstOrDefault(di => string.Equals(di.Name, App.StartupItem, StringComparison.CurrentCultureIgnoreCase)) ?? DemoItems.First();
3535
_demoItemsView = CollectionViewSource.GetDefaultView(DemoItems);
3636
_demoItemsView.Filter = DemoItemsFilter;
3737

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"Demo App": {
4+
"commandName": "Project",
5+
"commandLineArgs": "Home"
6+
}
7+
}
8+
}

MaterialDesign3.Demo.Wpf/App.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ namespace MaterialDesign3Demo;
77
/// </summary>
88
public partial class App : Application
99
{
10+
internal static string? StartupItem { get; private set; }
11+
1012
protected override void OnStartup(StartupEventArgs e)
1113
{
14+
if (e.Args.Length > 0)
15+
{
16+
StartupItem = e.Args[0];
17+
}
18+
1219
//This is an alternate way to initialize MaterialDesignInXAML if you don't use the MaterialDesignResourceDictionary in App.xaml
1320
//Color primaryColor = SwatchHelper.Lookup[MaterialDesignColor.DeepPurple];
1421
//Color accentColor = SwatchHelper.Lookup[MaterialDesignColor.Lime];

MaterialDesign3.Demo.Wpf/Domain/MainWindowViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue)
4141
DemoItems.First(x => x.Name == "Fields"),
4242
DemoItems.First(x => x.Name == "Pickers")
4343
};
44-
44+
SelectedItem = DemoItems.FirstOrDefault(di => string.Equals(di.Name, App.StartupItem, StringComparison.CurrentCultureIgnoreCase)) ?? DemoItems.First();
4545
_demoItemsView = CollectionViewSource.GetDefaultView(DemoItems);
4646
_demoItemsView.Filter = DemoItemsFilter;
4747

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"Demo App": {
4+
"commandName": "Project",
5+
"commandLineArgs": "Home"
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)