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

Adding Dialog Demo #15

Merged
merged 15 commits into from
Apr 9, 2024
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
31 changes: 30 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,33 @@ jobs:
with:
name: MauiMicroMvvm
solution-path: build.slnf
install-workload: maui
install-workload: maui

validate:
needs: [build]
runs-on: macos-14
steps:
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2'
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: NuGet
path: Artifacts
- name: Install Templates
run: dotnet new install Artifacts/AvantiPoint.MauiMicroMvvm.Templates.*.nupkg
- name: Add Local Source
run: dotnet nuget add source ${{ github.workspace }}/Artifacts --name Artifacts
- name: Create Test Project
run: dotnet new maui-micro -o TestProject
- name: Workload Install
run: dotnet workload install maui
working-directory: TestProject
- name: Build Project
run: dotnet build
working-directory: TestProject
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-dotnettools.dotnet-maui"
]
}
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET MAUI",
"type": "maui",
"request": "launch",
"preLaunchTask": "maui: Build"
}
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"autowire",
"Mvvm"
]
}
13 changes: 2 additions & 11 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<RepositoryUrl>https://github.com/AvantiPoint/mauimicromvvm.git</RepositoryUrl>
<PackageProjectUrl>https://github.com/AvantiPoint/mauimicromvvm</PackageProjectUrl>
<NeutralLanguage>en</NeutralLanguage>
<Nullable>enable</Nullable>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -36,15 +38,4 @@
PackagePath="" />
<SourceRoot Include="$(MSBuildThisFileDirectory)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.Maui.Controls" Version="8.0.3" Condition="$(IsPackable) == 'true'"/>
<PackageVersion Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" Condition="$(IsPackable) != 'true'"/>
<PackageVersion Include="ReactiveUI" Version="19.5.39" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageVersion Include="Refit" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions sample/MauiMicroSample/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
</Tab>
</FlyoutItem>

<FlyoutItem Title="Dialog Demo"
Icon="dialog.png">
<Tab micro:MauiMicro.Route="DialogDemo" />
</FlyoutItem>

<FlyoutItem Title="Message Demo"
Icon="messages.png">
<Tab micro:MauiMicro.Route="MessageDemoPage" />
Expand Down
8 changes: 4 additions & 4 deletions sample/MauiMicroSample/MauiMicroSample.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(DotNetVersion)-android;$(DotNetVersion)-ios;$(DotNetVersion)-maccatalyst</TargetFrameworks>
Expand All @@ -16,7 +16,6 @@

<!-- App Identifier -->
<ApplicationId>com.avantipoint.mauimicro</ApplicationId>
<ApplicationIdGuid>CE320681-9974-4D30-B5AB-3FC8834733FD</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
Expand Down Expand Up @@ -49,8 +48,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Refit" Version="7.0.0" />
<PackageReference Include="Microsoft.Maui.Controls" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Refit" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions sample/MauiMicroSample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static MauiApp CreateMauiApp()
});

builder.Services.MapView<MainPage, MainPageViewModel>()
.MapView<DialogDemo, DialogDemoViewModel>()
.MapView<MessageDemoPage, MessageDemoPageViewModel>()
.MapView<MessageDisplay, MessageDisplayViewModel>()
.MapView<MauiInfluencersPage, MauiInfluencersViewModel>()
Expand Down
16 changes: 16 additions & 0 deletions sample/MauiMicroSample/Pages/DialogDemo.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiMicroSample.Pages.DialogDemo"
xmlns:micro="http://schemas.mauimicromvvm.com/2022/dotnet/maui"
xmlns:vm="clr-namespace:MauiMicroSample.ViewModels"
micro:MauiMicro.Autowire="True"
x:DataType="vm:DialogDemoViewModel"
Title="Dialog Demo">
<VerticalStackLayout Spacing="5"
Padding="10">
<Label Text="Dialog Demo" Style="{DynamicResource Title}" />
<Button Text="Display Alert" Command="{Binding ShowAlertCommand}" />
<Button Text="Display ActionSheet" Command="{Binding ShowActionSheetCommand}" />
</VerticalStackLayout>
</ContentPage>
9 changes: 9 additions & 0 deletions sample/MauiMicroSample/Pages/DialogDemo.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace MauiMicroSample.Pages;

public partial class DialogDemo : ContentPage
{
public DialogDemo()
{
InitializeComponent();
}
}
11 changes: 5 additions & 6 deletions sample/MauiMicroSample/Pages/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace MauiMicroSample.Pages
namespace MauiMicroSample.Pages;

public partial class MainPage : ContentPage
{
public partial class MainPage : ContentPage
public MainPage()
{
public MainPage()
{
InitializeComponent();
}
InitializeComponent();
}
}
1 change: 1 addition & 0 deletions sample/MauiMicroSample/Resources/Images/dialog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions sample/MauiMicroSample/ViewModels/DialogDemoViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Windows.Input;
using MauiMicroMvvm;

namespace MauiMicroSample.ViewModels;

public class DialogDemoViewModel : MauiMicroViewModel
{
public DialogDemoViewModel(ViewModelContext context)
: base(context)
{
ShowActionSheetCommand = new Command(async () => {
await context.PageDialogs.DisplayActionSheet("Sample Action Sheet", "Cancel", "Destroy", "Button 1", "Button 2");
});

ShowAlertCommand = new Command(async () => {
await context.PageDialogs.DisplayAlert("Sample Alert", "This is a sample alert", "Accept", "Cancel");
});
}

public ICommand ShowAlertCommand { get; }

public ICommand ShowActionSheetCommand { get; }
}
4 changes: 2 additions & 2 deletions src/MauiMicroMvvm.Rx/MauiMicroMvvm.Rx.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(DotNetVersion)</TargetFramework>
Expand All @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ReactiveUI" Version="19.5.39" />
<PackageReference Include="ReactiveUI" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"datatype": "choice",
"enableQuotelessLiterals": true,
"replaces": "$dotnetversion$",
"defaultValue": "net7.0",
"defaultValue": "net8.0",
"description": "Target Framework",
"choices": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-dotnettools.dotnet-maui"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET MAUI",
"type": "maui",
"request": "launch",
"preLaunchTask": "maui: Build"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

<!-- App Identifier -->
<ApplicationId>$ApplicationId$</ApplicationId>
<ApplicationIdGuid>683037c3-6415-40f7-a541-bdc57964b0d2</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
Expand Down Expand Up @@ -52,6 +51,8 @@
<!--#else -->
<PackageReference Include="AvantiPoint.MauiMicroMvvm" Version="$MauiMicroVersion$" />
<!--#endif -->
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$MicrosoftLoggingVersion$" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ private void OnClickCommand()
Message = $"Pressed {_count} times!";

_screenReader.Announce(Message);

if (_count > 3)
PageDialogs.DisplayAlert("Stop it!", "You're pressing too much!", "OK");
}
}
2 changes: 1 addition & 1 deletion src/MauiMicroMvvm/MauiMicroMvvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.3" />
<PackageReference Include="Microsoft.Maui.Controls" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/MauiMicroMvvm/Xaml/MauiMicro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ private static void OnRouteChanged(BindableObject bindable, object oldValue, obj
return;

content.Route = route;
SetContentTempalte(content, route);
SetContentTemplate(content, route);
}

private static void SetContentTempalte(ShellContent content, string route)
private static void SetContentTemplate(ShellContent content, string route)
{
content.ContentTemplate = new DataTemplate(() => CreateView(route));
}
Expand Down
Loading