Skip to content

Commit

Permalink
added module to uno app
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlagunas committed May 5, 2022
1 parent d21e520 commit 2ed2821
Show file tree
Hide file tree
Showing 13 changed files with 240 additions and 7 deletions.
62 changes: 62 additions & 0 deletions e2e/Uno/HelloWorld.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.Uno", "..\..\src\Uno\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.DryIoc.Uno", "..\..\src\Uno\Prism.DryIoc.Uno\Prism.DryIoc.Uno.csproj", "{2FA7AE0E-B3CE-4742-B40B-449B6527055B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModuleA", "src\ModuleA\ModuleA.csproj", "{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{D6D40C4E-21EE-436E-845E-AC1871BDCCE9}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\HelloWorld.Shared\HelloWorld.Shared.projitems*{1a79c7bf-c92e-4009-a340-cdc937e0e620}*SharedItemsImports = 4
Expand Down Expand Up @@ -807,6 +811,62 @@ Global
{2FA7AE0E-B3CE-4742-B40B-449B6527055B}.Release|x64.Build.0 = Release|Any CPU
{2FA7AE0E-B3CE-4742-B40B-449B6527055B}.Release|x86.ActiveCfg = Release|Any CPU
{2FA7AE0E-B3CE-4742-B40B-449B6527055B}.Release|x86.Build.0 = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|ARM64.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|ARM64.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|ARM.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|ARM64.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|ARM64.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|iPhone.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|x64.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|x64.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|x86.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.AppStore|x86.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|ARM.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|ARM.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|ARM64.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|iPhone.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|x64.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|x64.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|x86.ActiveCfg = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Debug|x86.Build.0 = Debug|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|Any CPU.Build.0 = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|ARM.ActiveCfg = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|ARM.Build.0 = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|ARM64.ActiveCfg = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|ARM64.Build.0 = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|iPhone.ActiveCfg = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|iPhone.Build.0 = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|x64.ActiveCfg = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|x64.Build.0 = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|x86.ActiveCfg = Release|Any CPU
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -826,6 +886,8 @@ Global
{00E9F364-ABBF-4906-88CB-65735054F2B1} = {93D68E43-9939-49AF-A7AE-113DDF70EEAF}
{80A4C39A-A6B4-494D-801C-75EB4AEB803E} = {93D68E43-9939-49AF-A7AE-113DDF70EEAF}
{2FA7AE0E-B3CE-4742-B40B-449B6527055B} = {93D68E43-9939-49AF-A7AE-113DDF70EEAF}
{DAC1CB86-83F2-4896-BF55-883D2FE28F1F} = {D6D40C4E-21EE-436E-845E-AC1871BDCCE9}
{D6D40C4E-21EE-436E-845E-AC1871BDCCE9} = {2B7E4639-D606-4615-84E5-32BCFD2BE7DA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {529BCED6-0AB3-4552-A9BC-A93749A988DB}
Expand Down
4 changes: 4 additions & 0 deletions e2e/Uno/src/HelloWorld.Droid/HelloWorld.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@
<Project>{80a4c39a-a6b4-494d-801c-75eb4aeb803e}</Project>
<Name>Prism.Uno</Name>
</ProjectReference>
<ProjectReference Include="..\ModuleA\ModuleA.csproj">
<Project>{dac1cb86-83f2-4896-bf55-883d2fe28f1f}</Project>
<Name>ModuleA</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\HelloWorld.Shared\HelloWorld.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
Expand Down
8 changes: 8 additions & 0 deletions e2e/Uno/src/HelloWorld.Shared/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using HelloWorld.Views;
using Prism.DryIoc;
using Prism.Ioc;
using Prism.Modularity;
using ModuleA;

namespace HelloWorld
{
Expand All @@ -24,5 +26,11 @@ protected override void RegisterTypes(IContainerRegistry containerRegistry)
{

}

protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
{

moduleCatalog.AddModule<ModuleAModule>();
}
}
}
21 changes: 18 additions & 3 deletions e2e/Uno/src/HelloWorld.Shared/ViewModels/ShellViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;

namespace HelloWorld.ViewModels
{
class ShellViewModel : BindableBase
{
public string Title { get; set; } = "Hello Uno for Prism";

private DelegateCommand<string> _navigateCommand;
private readonly IRegionManager _regionManager;

public DelegateCommand<string> NavigateCommand =>
_navigateCommand ?? (_navigateCommand = new DelegateCommand<string>(ExecuteNavigateCommand));

public ShellViewModel(IRegionManager regionManager)
{
_regionManager = regionManager;
}

void ExecuteNavigateCommand(string viewName)
{
_regionManager.RequestNavigate("ContentRegion", viewName);
}
}
}
9 changes: 6 additions & 3 deletions e2e/Uno/src/HelloWorld.Shared/Views/Shell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
xmlns:pvm="using:Prism.Mvvm"
pvm:ViewModelLocator.AutowireViewModel="true"
xmlns:local="using:HelloWorld.Views"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" >

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Margin="20">
<TextBlock Text="{Binding Title}" FontSize="30" />
<TextBlock Text="Welcome to Uno/WinUI and Prism!" FontSize="15" />
<StackPanel Orientation="Horizontal">
<Button Command="{Binding NavigateCommand}" CommandParameter="ViewA">Navigate to View A</Button>
<Button Command="{Binding NavigateCommand}" CommandParameter="ViewB">Navigate to View B</Button>
</StackPanel>
</StackPanel>
<ContentControl Grid.Row="1" pr:RegionManager.RegionName="ContentRegion" />
</Grid>
Expand Down
4 changes: 4 additions & 0 deletions e2e/Uno/src/HelloWorld.UWP/HelloWorld.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
<Project>{80a4c39a-a6b4-494d-801c-75eb4aeb803e}</Project>
<Name>Prism.Uno</Name>
</ProjectReference>
<ProjectReference Include="..\ModuleA\ModuleA.csproj">
<Project>{dac1cb86-83f2-4896-bf55-883d2fe28f1f}</Project>
<Name>ModuleA</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
3 changes: 2 additions & 1 deletion e2e/Uno/src/HelloWorld.Wasm/HelloWorld.Wasm.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
Expand Down Expand Up @@ -53,6 +53,7 @@
<ProjectReference Include="..\..\..\..\src\Prism.Core\Prism.Core.csproj" />
<ProjectReference Include="..\..\..\..\src\Uno\Prism.DryIoc.Uno\Prism.DryIoc.Uno.csproj" />
<ProjectReference Include="..\..\..\..\src\Uno\Prism.Uno\Prism.Uno.csproj" />
<ProjectReference Include="..\ModuleA\ModuleA.csproj" />
</ItemGroup>
<Import Project="..\HelloWorld.Shared\HelloWorld.Shared.projitems" Label="Shared" Condition="Exists('..\HelloWorld.Shared\HelloWorld.Shared.projitems')" />
</Project>
49 changes: 49 additions & 0 deletions e2e/Uno/src/ModuleA/ModuleA.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Project Sdk="MSBuild.Sdk.Extras">
<!--
Adding project references to this project requires some manual adjustments.
Please see https://github.com/unoplatform/uno/issues/3909 for more details.
-->
<PropertyGroup>
<TargetFrameworks>netstandard2.0;xamarinios10;MonoAndroid11.0;MonoAndroid12.0;xamarinmac20</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);uap10.0.18362;</TargetFrameworks>
<!-- Ensures the .xr.xml files are generated in a proper layout folder -->
<GenerateLibraryLayout>true</GenerateLibraryLayout>
</PropertyGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('xamarinios')) or $(TargetFramework.StartsWith('xamarinmac')) or $(TargetFramework.StartsWith('MonoAndroid')) or $(TargetFramework.StartsWith('netstandard'))">
<PackageReference Include="Uno.UI" />
</ItemGroup>
<ItemGroup>
<Page Include="**\*.xaml" Exclude="bin\**\*.xaml;obj\**\*.xaml" />
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Include="**\*.xaml" Exclude="bin\**\*.xaml;obj\**\*.xaml" />
</ItemGroup>
<ItemGroup>
<None Remove="Views\ViewA.xaml" />
<None Remove="Views\ViewB.xaml" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="Views\ViewA.xaml" />
<UpToDateCheckInput Remove="Views\ViewB.xaml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\src\Prism.Core\Prism.Core.csproj" />
<ProjectReference Include="..\..\..\..\src\Uno\Prism.DryIoc.Uno\Prism.DryIoc.Uno.csproj" />
<ProjectReference Include="..\..\..\..\src\Uno\Prism.Uno\Prism.Uno.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="ViewModels\" />
</ItemGroup>
<ItemGroup>
<Page Update="Views\ViewA.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\ViewB.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>
29 changes: 29 additions & 0 deletions e2e/Uno/src/ModuleA/ModuleAModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using ModuleA.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;

namespace ModuleA
{
public class ModuleAModule : IModule
{
private readonly IRegionManager _regionManager;

public ModuleAModule(IRegionManager regionManager)
{
_regionManager = regionManager;
}

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

public void OnInitialized(IContainerProvider containerProvider)
{
//_regionManager.RegisterViewWithRegion<ViewA>("ContentRegion");
//_regionManager.RequestNavigate("ContentRegion", "ViewA");
}
}
}
15 changes: 15 additions & 0 deletions e2e/Uno/src/ModuleA/Views/ViewA.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<UserControl
x:Class="ModuleA.Views.ViewA"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ModuleA.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">

<Grid>
<TextBlock Text="View A" FontSize="72" />
</Grid>
</UserControl>
14 changes: 14 additions & 0 deletions e2e/Uno/src/ModuleA/Views/ViewA.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Windows.UI.Xaml.Controls;

// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236

namespace ModuleA.Views
{
public sealed partial class ViewA : UserControl
{
public ViewA()
{
this.InitializeComponent();
}
}
}
15 changes: 15 additions & 0 deletions e2e/Uno/src/ModuleA/Views/ViewB.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<UserControl
x:Class="ModuleA.Views.ViewB"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ModuleA.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">

<Grid>
<TextBlock Text="View B" FontSize="72" />
</Grid>
</UserControl>
14 changes: 14 additions & 0 deletions e2e/Uno/src/ModuleA/Views/ViewB.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Windows.UI.Xaml.Controls;

// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236

namespace ModuleA.Views
{
public sealed partial class ViewB : UserControl
{
public ViewB()
{
this.InitializeComponent();
}
}
}

0 comments on commit 2ed2821

Please sign in to comment.