Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new Bootstrapper API #2074

Merged
merged 4 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions e2e/Wpf/HelloWorld.Bootstraper/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Application x:Class="HelloWorld.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>

</Application.Resources>
</Application>
18 changes: 18 additions & 0 deletions e2e/Wpf/HelloWorld.Bootstraper/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Windows;

namespace HelloWorld
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

var bs = new Bootstrapper();
bs.Run();
dansiegel marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
29 changes: 29 additions & 0 deletions e2e/Wpf/HelloWorld.Bootstraper/Bootstrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using HelloWorld.Modules.ModuleA;
using HelloWorld.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Unity;
using System.Windows;
using Unity;

namespace HelloWorld
{
class Bootstrapper : PrismBootstrapper
{
protected override Window CreateShell()
{
return Container.Resolve<MainWindow>();
}

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterSharedSamples();
}

protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
{
base.ConfigureModuleCatalog(moduleCatalog);
moduleCatalog.AddModule<ModuleAModule>();
}
}
}
27 changes: 27 additions & 0 deletions e2e/Wpf/HelloWorld.Bootstraper/HelloWorld.Bootstrapper.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<RootNamespace>HelloWorld</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<DefaultItemExcludes>..\HelloWorld\bin\**;..\HelloWorld\obj\**;..\HelloWorld\App.*</DefaultItemExcludes>
</PropertyGroup>

<ItemGroup>
<Page Include="..\HelloWorld\**\*.xaml" LinkBase="%(RecurseDir)" Generator="MSBuild:Compile" Exclude="$(DefaultItemExcludes)" />
<Compile Include="..\HelloWorld\**\*.cs" LinkBase="%(RecurseDir)" Exclude="$(DefaultItemExcludes)" />
</ItemGroup>
dansiegel marked this conversation as resolved.
Show resolved Hide resolved

<ItemGroup>
<ProjectReference Include="..\..\..\src\Prism.Core\Prism.Core.csproj" />
<ProjectReference Include="..\..\..\src\Wpf\Prism.Unity.Wpf\Prism.Unity.Wpf.csproj" />
<ProjectReference Include="..\..\..\src\Wpf\Prism.Wpf\Prism.Wpf.csproj" />
<ProjectReference Include="..\HelloWorld.Core\HelloWorld.Core.csproj" />
<ProjectReference Include="..\Modules\HelloWorld.Modules.ModuleA\HelloWorld.Modules.ModuleA.csproj" />
</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions e2e/Wpf/HelloWorld.Core/DialogServiceExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Prism.Services.Dialogs;
using System;

namespace HelloWorld.Core
{
public static class DialogServiceExtensions
{
public static void ShowNotification(this IDialogService dialogService, string message, Action<IDialogResult> callBack)
{
dialogService.ShowDialog("NotificationDialog", new DialogParameters($"message={message}"), callBack);
}

public static void ShowConfirmation(this IDialogService dialogService, string message, Action<IDialogResult> callBack)
{
dialogService.ShowDialog("ConfirmationDialog", new DialogParameters($"message={message}"), callBack);
}

public static void ShowNotificationInAnotherWindow(this IDialogService dialogService, string message, Action<IDialogResult> callBack)
{
dialogService.ShowDialog("NotificationDialog", new DialogParameters($"message={message}"), callBack, "AnotherDialogWindow");
}
}
}
13 changes: 13 additions & 0 deletions e2e/Wpf/HelloWorld.Core/HelloWorld.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Prism.Core\Prism.Core.csproj" />
<ProjectReference Include="..\..\..\src\Wpf\Prism.Wpf\Prism.Wpf.csproj" />
</ItemGroup>

</Project>
25 changes: 23 additions & 2 deletions e2e/Wpf/HelloWorld.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28729.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{B03C14CC-8DE9-40EE-9562-12B976E4CEE8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{B03C14CC-8DE9-40EE-9562-12B976E4CEE8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism", "..\..\src\Prism.Core\Prism.Core.csproj", "{457AA668-72BB-4701-9A4E-FA86B0C412DE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.Core", "..\..\src\Prism.Core\Prism.Core.csproj", "{457AA668-72BB-4701-9A4E-FA86B0C412DE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Prism Library", "Prism Library", "{15CF1FE1-D78E-4E3D-A9F8-FA0FCC56A83A}"
EndProject
Expand All @@ -15,6 +15,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.DryIoc.Wpf", "..\..\s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.Unity.Wpf", "..\..\src\Wpf\Prism.Unity.Wpf\Prism.Unity.Wpf.csproj", "{DEBADAAB-5C78-444E-AA77-336A43B49EC3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld.Bootstrapper", "HelloWorld.Bootstraper\HelloWorld.Bootstrapper.csproj", "{36C11381-D25A-4E40-956F-05E9C440FA86}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld.Modules.ModuleA", "Modules\HelloWorld.Modules.ModuleA\HelloWorld.Modules.ModuleA.csproj", "{D16AADD5-6EAA-446A-83F5-9DFC36DD4108}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld.Core", "HelloWorld.Core\HelloWorld.Core.csproj", "{F9541A8C-42DD-4340-AB57-54C7AAAC1BCC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{63541838-3D6A-4F2E-92EF-AC4953BB9B9B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -41,6 +49,18 @@ Global
{DEBADAAB-5C78-444E-AA77-336A43B49EC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEBADAAB-5C78-444E-AA77-336A43B49EC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEBADAAB-5C78-444E-AA77-336A43B49EC3}.Release|Any CPU.Build.0 = Release|Any CPU
{36C11381-D25A-4E40-956F-05E9C440FA86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36C11381-D25A-4E40-956F-05E9C440FA86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36C11381-D25A-4E40-956F-05E9C440FA86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36C11381-D25A-4E40-956F-05E9C440FA86}.Release|Any CPU.Build.0 = Release|Any CPU
{D16AADD5-6EAA-446A-83F5-9DFC36DD4108}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D16AADD5-6EAA-446A-83F5-9DFC36DD4108}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D16AADD5-6EAA-446A-83F5-9DFC36DD4108}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D16AADD5-6EAA-446A-83F5-9DFC36DD4108}.Release|Any CPU.Build.0 = Release|Any CPU
{F9541A8C-42DD-4340-AB57-54C7AAAC1BCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9541A8C-42DD-4340-AB57-54C7AAAC1BCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9541A8C-42DD-4340-AB57-54C7AAAC1BCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9541A8C-42DD-4340-AB57-54C7AAAC1BCC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -50,6 +70,7 @@ Global
{AA8ED3D6-A708-4187-8FAC-00F56E063AD7} = {15CF1FE1-D78E-4E3D-A9F8-FA0FCC56A83A}
{A0842858-BFD5-41AE-BDE7-CBD870BC9900} = {15CF1FE1-D78E-4E3D-A9F8-FA0FCC56A83A}
{DEBADAAB-5C78-444E-AA77-336A43B49EC3} = {15CF1FE1-D78E-4E3D-A9F8-FA0FCC56A83A}
{D16AADD5-6EAA-446A-83F5-9DFC36DD4108} = {63541838-3D6A-4F2E-92EF-AC4953BB9B9B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D877B086-37FD-4AA5-8AB3-CF7E87E27425}
Expand Down
18 changes: 8 additions & 10 deletions e2e/Wpf/HelloWorld/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using HelloWorld.Views;
using Prism.Ioc;
using System.Windows;
using HelloWorld.Dialogs;
using Prism.Modularity;
using HelloWorld.Modules.ModuleA;

namespace HelloWorld
{
Expand All @@ -15,18 +16,15 @@ protected override Window CreateShell()
return Container.Resolve<MainWindow>();
}

public static string ViewAName = "MyViewA";

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<ViewA>(ViewAName);

containerRegistry.RegisterDialog<NotificationDialog, NotificationDialogViewModel>();
containerRegistry.RegisterDialog<ConfirmationDialog, ConfirmationDialogViewModel>();
containerRegistry.RegisterSharedSamples();
}

//register a custom window host
containerRegistry.RegisterDialogWindow<CustomDialogWindow>();
containerRegistry.RegisterDialogWindow<AnotherDialogWindow>(nameof(AnotherDialogWindow));
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
{
base.ConfigureModuleCatalog(moduleCatalog);
moduleCatalog.AddModule<ModuleAModule>();
}
}
}
2 changes: 2 additions & 0 deletions e2e/Wpf/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<ProjectReference Include="..\..\..\src\Prism.Core\Prism.Core.csproj" />
<ProjectReference Include="..\..\..\src\Wpf\Prism.DryIoc.Wpf\Prism.DryIoc.Wpf.csproj" />
<ProjectReference Include="..\..\..\src\Wpf\Prism.Wpf\Prism.Wpf.csproj" />
<ProjectReference Include="..\HelloWorld.Core\HelloWorld.Core.csproj" />
<ProjectReference Include="..\Modules\HelloWorld.Modules.ModuleA\HelloWorld.Modules.ModuleA.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions e2e/Wpf/HelloWorld/SharedSampleRegistrations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using HelloWorld.Dialogs;
using Prism.Ioc;

namespace HelloWorld
{
static class SharedSampleRegistrations
{
public static void RegisterSharedSamples(this IContainerRegistry containerRegistry)
{
containerRegistry.RegisterDialog<NotificationDialog, NotificationDialogViewModel>();
containerRegistry.RegisterDialog<ConfirmationDialog, ConfirmationDialogViewModel>();

//register a custom window host
containerRegistry.RegisterDialogWindow<CustomDialogWindow>();
containerRegistry.RegisterDialogWindow<AnotherDialogWindow>(nameof(AnotherDialogWindow));
}
}
}
17 changes: 1 addition & 16 deletions e2e/Wpf/HelloWorld/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using HelloWorld.Core;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;
Expand Down Expand Up @@ -93,21 +94,5 @@ private void ShowDialog()
}
}

public static class DialogServiceExtensions
{
public static void ShowNotification(this IDialogService dialogService, string message, Action<IDialogResult> callBack)
{
dialogService.ShowDialog("NotificationDialog", new DialogParameters($"message={message}"), callBack);
}

public static void ShowConfirmation(this IDialogService dialogService, string message, Action<IDialogResult> callBack)
{
dialogService.ShowDialog("ConfirmationDialog", new DialogParameters($"message={message}"), callBack);
}

public static void ShowNotificationInAnotherWindow(this IDialogService dialogService, string message, Action<IDialogResult> callBack)
{
dialogService.ShowDialog("NotificationDialog", new DialogParameters($"message={message}"), callBack, "AnotherDialogWindow");
}
}
}
10 changes: 6 additions & 4 deletions e2e/Wpf/HelloWorld/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Button Command="{Binding ShowDialogCommand}" Content="Show Dialog" />
<!--<ContentControl prism:RegionManager.RegionName="ContentRegion" />-->
<!--<Button Command="{Binding NavigateCommand}" CommandParameter="{x:Static local:App.ViewAName}">Navigate to Named View</Button>
<TabControl Grid.Row="1" prism:RegionManager.RegionName="ContentRegion" />-->
<!--<Button Command="{Binding ShowDialogCommand}" Content="Show Dialog" />-->

<Button Command="{Binding NavigateCommand}" CommandParameter="ViewA">Navigate to ViewA</Button>
<ContentControl Grid.Row="1" prism:RegionManager.RegionName="ContentRegion" />

<!--<TabControl Grid.Row="1" prism:RegionManager.RegionName="ContentRegion" />-->

</Grid>
</Window>
12 changes: 0 additions & 12 deletions e2e/Wpf/HelloWorld/Views/ViewA.xaml

This file was deleted.

44 changes: 0 additions & 44 deletions e2e/Wpf/HelloWorld/Views/ViewA.xaml.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\Prism.Core\Prism.Core.csproj" />
<ProjectReference Include="..\..\..\..\src\Wpf\Prism.Wpf\Prism.Wpf.csproj" />
<ProjectReference Include="..\..\HelloWorld.Core\HelloWorld.Core.csproj" />
</ItemGroup>

</Project>
19 changes: 19 additions & 0 deletions e2e/Wpf/Modules/HelloWorld.Modules.ModuleA/ModuleAModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using HelloWorld.Modules.ModuleA.Views;
using Prism.Ioc;
using Prism.Modularity;

namespace HelloWorld.Modules.ModuleA
{
public class ModuleAModule : IModule
{
public void OnInitialized(IContainerProvider containerProvider)
{

}

public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<ViewA>();
}
}
}
Loading