Skip to content

Commit 90957a0

Browse files
committed
bring over mac & windows
1 parent 2f8f26c commit 90957a0

32 files changed

+1797
-44
lines changed

Acr.UserDialogs.sln

-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1414
readme.md = readme.md
1515
EndProjectSection
1616
EndProject
17-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{C88D14B5-E775-4EE0-91A4-FD321B18415F}"
18-
EndProject
1917
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "sample\Sample\Sample.csproj", "{15294F23-E346-4DD3-A0EA-FDAB8F73B9A9}"
2018
EndProject
2119
Global
@@ -180,7 +178,6 @@ Global
180178
HideSolutionNode = FALSE
181179
EndGlobalSection
182180
GlobalSection(NestedProjects) = preSolution
183-
{15294F23-E346-4DD3-A0EA-FDAB8F73B9A9} = {C88D14B5-E775-4EE0-91A4-FD321B18415F}
184181
EndGlobalSection
185182
GlobalSection(ExtensibilityGlobals) = postSolution
186183
SolutionGuid = {17CCE1B1-75B2-4B32-8BCA-DF55666927A4}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<maui:MauiWinUIApplication
2+
x:Class="Sample.WinUI.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:maui="using:Microsoft.Maui"
6+
xmlns:local="using:Sample.WinUI">
7+
8+
</maui:MauiWinUIApplication>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Microsoft.UI.Xaml;
2+
3+
// To learn more about WinUI, the WinUI project structure,
4+
// and more about our project templates, see: http://aka.ms/winui-project-info.
5+
6+
namespace Sample.WinUI
7+
{
8+
/// <summary>
9+
/// Provides application-specific behavior to supplement the default Application class.
10+
/// </summary>
11+
public partial class App : MauiWinUIApplication
12+
{
13+
/// <summary>
14+
/// Initializes the singleton application object. This is the first line of authored code
15+
/// executed, and as such is the logical equivalent of main() or WinMain().
16+
/// </summary>
17+
public App()
18+
{
19+
this.InitializeComponent();
20+
}
21+
22+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
23+
}
24+
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Package
3+
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
4+
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
5+
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
6+
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
7+
IgnorableNamespaces="uap rescap">
8+
9+
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
10+
11+
<mp:PhoneIdentity PhoneProductId="758E9959-8E75-455A-9459-87854FCF9A06" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
12+
13+
<Properties>
14+
<DisplayName>$placeholder$</DisplayName>
15+
<PublisherDisplayName>User Name</PublisherDisplayName>
16+
<Logo>$placeholder$.png</Logo>
17+
</Properties>
18+
19+
<Dependencies>
20+
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
21+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
22+
</Dependencies>
23+
24+
<Resources>
25+
<Resource Language="x-generate" />
26+
</Resources>
27+
28+
<Applications>
29+
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
30+
<uap:VisualElements
31+
DisplayName="$placeholder$"
32+
Description="$placeholder$"
33+
Square150x150Logo="$placeholder$.png"
34+
Square44x44Logo="$placeholder$.png"
35+
BackgroundColor="transparent">
36+
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
37+
<uap:SplashScreen Image="$placeholder$.png" />
38+
</uap:VisualElements>
39+
</Application>
40+
</Applications>
41+
42+
<Capabilities>
43+
<rescap:Capability Name="runFullTrust" />
44+
</Capabilities>
45+
46+
</Package>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="Sample.WinUI.app"/>
4+
5+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
6+
<windowsSettings>
7+
<!-- The combination of below two tags have the following effect:
8+
1) Per-Monitor for >= Windows 10 Anniversary Update
9+
2) System < Windows 10 Anniversary Update
10+
-->
11+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
12+
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
13+
</windowsSettings>
14+
</application>
15+
</assembly>

sample/Sample/Sample.csproj

+39-37
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
5-
<OutputType>Exe</OutputType>
6-
<RootNamespace>Sample</RootNamespace>
7-
<UseMaui>true</UseMaui>
8-
<SingleProject>true</SingleProject>
9-
<ImplicitUsings>enable</ImplicitUsings>
10-
11-
<ApplicationTitle>ACR User Dialogs</ApplicationTitle>
12-
13-
<!-- App Identifier -->
14-
<ApplicationId>org.shiny.dialogs</ApplicationId>
15-
<ApplicationIdGuid>FDEB2636-6320-4BEE-9C77-8F2AD2E4AA05</ApplicationIdGuid>
16-
17-
<!-- Versions -->
18-
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
19-
<ApplicationVersion>1</ApplicationVersion>
20-
21-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
22-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
23-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
24-
</PropertyGroup>
25-
26-
<ItemGroup>
27-
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
28-
29-
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
30-
31-
<MauiImage Include="Resources\Images\*" />
32-
<MauiFont Include="Resources\Fonts\*" />
33-
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
34-
</ItemGroup>
35-
36-
<ItemGroup>
37-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.14" />
38-
<ProjectReference Include="..\..\src\Acr.UserDialogs\Acr.UserDialogs.csproj" />
39-
</ItemGroup>
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
6+
<OutputType>Exe</OutputType>
7+
<RootNamespace>Sample</RootNamespace>
8+
<UseMaui>true</UseMaui>
9+
<SingleProject>true</SingleProject>
10+
<ImplicitUsings>enable</ImplicitUsings>
11+
12+
<ApplicationTitle>ACR User Dialogs</ApplicationTitle>
13+
14+
<!-- App Identifier -->
15+
<ApplicationId>org.shiny.dialogs</ApplicationId>
16+
<ApplicationIdGuid>FDEB2636-6320-4BEE-9C77-8F2AD2E4AA05</ApplicationIdGuid>
17+
18+
<!-- Versions -->
19+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
20+
<ApplicationVersion>1</ApplicationVersion>
21+
22+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
23+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
24+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
25+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
26+
</PropertyGroup>
27+
28+
<ItemGroup>
29+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
30+
31+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
32+
33+
<MauiImage Include="Resources\Images\*" />
34+
<MauiFont Include="Resources\Fonts\*" />
35+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.14" />
40+
<ProjectReference Include="..\..\src\Acr.UserDialogs\Acr.UserDialogs.csproj" />
41+
</ItemGroup>
4042
</Project>

src/Acr.UserDialogs/Acr.UserDialogs.csproj

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net8.0;net8.0-ios;net8.0-android;net8.0-maccatalyst</TargetFrameworks>
3+
<TargetFrameworks>net8.0;net8.0-ios;net8.0-android;net8.0-maccatalyst;net8.0-macos</TargetFrameworks>
4+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
45
<PackageProjectUrl>https://github.com/aritchie/userdialogs</PackageProjectUrl>
56
<Product>$(AssemblyName) ($(TargetFramework))</Product>
67
<Authors>Allan Ritchie</Authors>
78
<Description>A cross platform library that allows you to call for standard user dialogs from a shared/portable library. Supports Android, iOS, and UWP</Description>
89
<PackageTags>ios android xamarin xam.pcl dialogs plugin</PackageTags>
910
<PackageReleaseNotes>https://github.com/aritchie/userdialogs/raw/master/ChangeLog.md</PackageReleaseNotes>
10-
<PackageIconUrl>https://github.com/aritchie/userdialogs/raw/master/icon.png</PackageIconUrl>
1111
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1212
<LangVersion>latest</LangVersion>
1313
<NoWarn>$(NoWarn);1591;1701;1591;1702;1705;VSX1000;NU1603</NoWarn>
1414
<RepositoryUrl>https://github.com/aritchie/userdialogs</RepositoryUrl>
1515
<RepositoryType>git</RepositoryType>
16+
<PackageIcon>icon.png</PackageIcon>
17+
<PackageReadmeFile>readme.md</PackageReadmeFile>
1618
</PropertyGroup>
1719

1820
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
@@ -26,7 +28,8 @@
2628
</PropertyGroup>
2729

2830
<ItemGroup>
29-
<None Include="readme.txt" pack="true" PackagePath="." />
31+
<None Include="$(MSBuildThisFileDirectory)nuget.png" Pack="true" PackagePath="icon.png" />
32+
<None Include="$(MSBuildThisFileDirectory)nuget.txt" Pack="true" PackagePath="readme.txt" />
3033
<None Include="Platforms\**\*.*" />
3134
<Compile Remove="Platforms\**\*.*" />
3235
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
@@ -46,7 +49,18 @@
4649
<ItemGroup Condition=" $(TargetFramework.Contains('ios')) OR $(TargetFramework.Contains('catalyst')) ">
4750
<Compile Include="Platforms\Shared\**\*.cs" />
4851
<Compile Include="Platforms\ios\**\*.cs" />
49-
<Compile Include="Platforms\Apple\**\*.cs" />
5052
<PackageReference Include="BTProgressHUD" Version="2.0.1" />
5153
</ItemGroup>
54+
55+
<ItemGroup Condition=" $(TargetFramework.StartsWith('macos')) ">
56+
<Compile Include="Platforms\Shared\**\*.cs" />
57+
<Compile Include="Platforms\macOS\**\*.cs" />
58+
</ItemGroup>
59+
60+
<ItemGroup Condition=" $(TargetFramework.StartsWith('windows')) ">
61+
<Compile Include="Platforms\Shared\**\*.cs" />
62+
<Compile Include="Platforms\Windows\**\*.cs" />
63+
<Page Include="Platforms\Windows\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
64+
<Compile Update="Platforms\Windows\**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
65+
</ItemGroup>
5266
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<ContentDialog
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
x:Class="Acr.UserDialogs.ActionSheetContentDialog"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
Title="{Binding Title}"
8+
mc:Ignorable="d">
9+
<ContentDialog.Content>
10+
<ScrollViewer>
11+
<StackPanel>
12+
<TextBlock Text="{Binding Message}"
13+
FontSize="12"
14+
Visibility="{Binding MessageVisibility}" />
15+
<ListBox x:Name="List" ItemsSource="{Binding Options}" SelectionMode="Single">
16+
<ListBox.ItemTemplate>
17+
<DataTemplate>
18+
<StackPanel Orientation="Horizontal">
19+
<Image Source="{Binding ItemIcon}" />
20+
<TextBlock Text="{Binding Text}" />
21+
</StackPanel>
22+
</DataTemplate>
23+
</ListBox.ItemTemplate>
24+
</ListBox>
25+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
26+
<Button DataContext="{Binding Destructive}"
27+
Content="{Binding Text}"
28+
Command="{Binding Action}"
29+
Visibility="{Binding Visible}" />
30+
31+
<Button DataContext="{Binding Cancel}"
32+
Content="{Binding Text}"
33+
Command="{Binding Action}"
34+
Visibility="{Binding Visible}" />
35+
</StackPanel>
36+
</StackPanel>
37+
</ScrollViewer>
38+
</ContentDialog.Content>
39+
</ContentDialog>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using Windows.UI.Xaml.Controls;
3+
4+
5+
namespace Acr.UserDialogs {
6+
7+
public sealed partial class ActionSheetContentDialog : ContentDialog {
8+
9+
public ActionSheetContentDialog() {
10+
this.InitializeComponent();
11+
this.List.SelectionChanged += (sender, args) => {
12+
var vm = this.List.SelectedItem as ActionSheetOptionViewModel;
13+
vm?.Action?.Execute(null);
14+
};
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Windows.Input;
3+
using Windows.UI.Xaml;
4+
using Acr.UserDialogs.Infrastructure;
5+
6+
7+
namespace Acr.UserDialogs
8+
{
9+
public class ActionSheetOptionViewModel
10+
{
11+
public ActionSheetOptionViewModel(bool visible, string text, Action action, string image = null)
12+
{
13+
this.Text = text;
14+
this.Action = new Command(action);
15+
this.Visible = visible ? Visibility.Visible : Visibility.Collapsed;
16+
this.ItemIcon = image;
17+
}
18+
19+
20+
public Visibility Visible { get; }
21+
public string Text { get; }
22+
public ICommand Action { get; }
23+
public string ItemIcon { get; }
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Windows.UI.Xaml;
4+
5+
6+
namespace Acr.UserDialogs
7+
{
8+
9+
public class ActionSheetViewModel
10+
{
11+
12+
public string Title { get; set; }
13+
public string Message { get; set; }
14+
15+
public Visibility MessageVisibility
16+
=> String.IsNullOrWhiteSpace(this.Message) ? Visibility.Collapsed : Visibility.Visible;
17+
18+
public ActionSheetOptionViewModel Destructive { get; set; }
19+
public Visibility DestructiveVisibility { get; set; }
20+
21+
public ActionSheetOptionViewModel Cancel { get; set; }
22+
public Visibility CancelVisibility { get; set; }
23+
24+
public IList<ActionSheetOptionViewModel> Options { get; set; }
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<UserControl
2+
x:Class="Acr.UserDialogs.DatePickerControl"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
mc:Ignorable="d">
8+
<UserControl.Content>
9+
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
10+
<Grid.ColumnDefinitions>
11+
<ColumnDefinition Width="Auto" />
12+
<ColumnDefinition Width="Auto" />
13+
</Grid.ColumnDefinitions>
14+
<Grid.RowDefinitions>
15+
<RowDefinition Height="Auto" />
16+
<RowDefinition Height="Auto" />
17+
</Grid.RowDefinitions>
18+
<CalendarView x:Name="datePicker" SelectionMode="Single" HorizontalAlignment="Center" Grid.ColumnSpan="2" Grid.Row="0"></CalendarView>
19+
<Button x:Name="btnCancel" HorizontalAlignment="Stretch" Content="Cancel" Grid.Column="0" Grid.Row="1" />
20+
<Button x:Name="btnOk" HorizontalAlignment="Stretch" Content="OK" Grid.Column="1" Grid.Row="1" />
21+
</Grid>
22+
</UserControl.Content>
23+
</UserControl>

0 commit comments

Comments
 (0)