Skip to content

Commit 065d8e3

Browse files
committed
WIP
1 parent 290059e commit 065d8e3

19 files changed

+65
-68
lines changed

sample/Sample/App.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version = "1.0" encoding = "UTF-8" ?>
22
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4-
xmlns:local="clr-namespace:Sample"
5-
x:Class="Sample.App">
4+
xmlns:local="clr-namespace:Samples"
5+
x:Class="Samples.App">
66
<Application.Resources>
77
<ResourceDictionary>
88
<ResourceDictionary.MergedDictionaries>

sample/Sample/App.xaml.cs

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using Samples;
1+
namespace Samples;
22

3-
namespace Sample
3+
public partial class App : Application
44
{
5-
public partial class App : Application
5+
public App()
66
{
7-
public App()
8-
{
9-
InitializeComponent();
7+
this.InitializeComponent();
108

11-
this.MainPage = new MainPage();
12-
}
9+
this.MainPage = new MainPage();
1310
}
1411
}

sample/Sample/MauiProgram.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using Acr.UserDialogs;
2-
using Microsoft.Maui.LifecycleEvents;
3-
4-
namespace Sample;
1+
namespace Samples;
52

63

74
public static class MauiProgram
@@ -18,7 +15,7 @@ public static MauiApp CreateMauiApp()
1815
});
1916

2017
#if ANDROID
21-
UserDialogs.Init(() => Platform.CurrentActivity);
18+
Acr.UserDialogs.UserDialogs.Init(() => Platform.CurrentActivity);
2219
#endif
2320
return builder.Build();
2421
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
using Android.App;
22
using Android.Content.PM;
3-
using Android.OS;
43

5-
namespace Sample
4+
namespace Samples
65
{
7-
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
6+
[Activity(
7+
Theme = "@style/Maui.SplashTheme",
8+
MainLauncher = true,
9+
ConfigurationChanges =
10+
ConfigChanges.ScreenSize |
11+
ConfigChanges.Orientation |
12+
ConfigChanges.UiMode |
13+
ConfigChanges.ScreenLayout |
14+
ConfigChanges.SmallestScreenSize |
15+
ConfigChanges.Density
16+
)]
817
public class MainActivity : MauiAppCompatActivity
918
{
1019
}
11-
}
20+
}

sample/Sample/Platforms/Android/MainApplication.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Android.App;
22
using Android.Runtime;
33

4-
namespace Sample
4+
namespace Samples
55
{
66
[Application]
77
public class MainApplication : MauiApplication
@@ -13,4 +13,4 @@ public MainApplication(IntPtr handle, JniHandleOwnership ownership)
1313

1414
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
1515
}
16-
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using Foundation;
22

3-
namespace Sample
3+
namespace Samples
44
{
55
[Register("AppDelegate")]
66
public class AppDelegate : MauiUIApplicationDelegate
77
{
88
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
99
}
10-
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
using ObjCRuntime;
1+
using UIKit;
22

3-
using UIKit;
4-
5-
namespace Sample
3+
namespace Samples
64
{
75
public class Program
86
{
@@ -14,4 +12,4 @@ static void Main(string[] args)
1412
UIApplication.Main(args, null, typeof(AppDelegate));
1513
}
1614
}
17-
}
15+
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<maui:MauiWinUIApplication
2-
x:Class="Sample.WinUI.App"
2+
x:Class="Samples.WinUI.App"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:maui="using:Microsoft.Maui"
6-
xmlns:local="using:Sample.WinUI">
6+
xmlns:local="using:Samples.WinUI">
77

88
</maui:MauiWinUIApplication>

sample/Sample/Platforms/Windows/App.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// To learn more about WinUI, the WinUI project structure,
44
// and more about our project templates, see: http://aka.ms/winui-project-info.
55

6-
namespace Sample.WinUI
6+
namespace Samples.WinUI
77
{
88
/// <summary>
99
/// Provides application-specific behavior to supplement the default Application class.

sample/Sample/Platforms/Windows/app.manifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3-
<assemblyIdentity version="1.0.0.0" name="Sample.WinUI.app"/>
3+
<assemblyIdentity version="1.0.0.0" name="Samples.WinUI.app"/>
44

55
<application xmlns="urn:schemas-microsoft-com:asm.v3">
66
<windowsSettings>
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using Foundation;
22

3-
namespace Sample
3+
namespace Samples
44
{
55
[Register("AppDelegate")]
66
public class AppDelegate : MauiUIApplicationDelegate
77
{
88
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
99
}
10-
}
10+
}
+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
using ObjCRuntime;
1+
using UIKit;
22

3-
using UIKit;
4-
5-
namespace Sample
3+
namespace Samples
64
{
75
public class Program
86
{
@@ -14,4 +12,4 @@ static void Main(string[] args)
1412
UIApplication.Main(args, null, typeof(AppDelegate));
1513
}
1614
}
17-
}
15+
}

sample/Sample/ViewModels/SpecificCasesViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ await this.Dialogs.AlertAsync(new AlertConfig
123123
Text = "Toast with image",
124124
Command = new Command(() =>
125125
{
126-
var img = Device.RuntimePlatform == Device.UWP ? "ms-appx:///Assets/emoji_cool_small.png" : "emoji_cool_small.png";
126+
var img = DeviceInfo.Platform == DevicePlatform.WinUI ? "ms-appx:///Assets/emoji_cool_small.png" : "emoji_cool_small.png";
127127
this.Dialogs.Toast(new ToastConfig("Wow what a cool guy").SetIcon(img));
128128
})
129129
},

sample/Sample/ViewModels/ToastsViewModel.cs

+18-18
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,24 @@ public ToastsViewModel(IUserDialogs dialogs) : base(dialogs)
4545
}
4646

4747

48-
static System.Drawing.Color FromHex(string hex)
49-
{
50-
var c = Color.FromHex(hex);
51-
var dc = System.Drawing.Color.FromArgb((int)c.Alpha, (int)c.Red, (int)c.Green, (int)c.Blue);
52-
return dc;
53-
}
54-
55-
56-
static string ToHex(Color color)
57-
{
58-
var red = (int)(color.Red * 255);
59-
var green = (int)(color.Green * 255);
60-
var blue = (int)(color.Blue * 255);
61-
//var alpha = (int)(color.A * 255);
62-
//var hex = String.Format($"#{red:X2}{green:X2}{blue:X2}{alpha:X2}");
63-
var hex = String.Format($"#{red:X2}{green:X2}{blue:X2}");
64-
return hex;
65-
}
48+
//static System.Drawing.Color FromHex(string hex)
49+
//{
50+
// var c = Color.FromArgb(hex);
51+
// var dc = System.Drawing.Color.FromArgb((int)c.Alpha, (int)c.Red, (int)c.Green, (int)c.Blue);
52+
// return dc;
53+
//}
54+
55+
56+
//static string ToHex(Color color)
57+
//{
58+
// var red = (int)(color.Red * 255);
59+
// var green = (int)(color.Green * 255);
60+
// var blue = (int)(color.Blue * 255);
61+
// //var alpha = (int)(color.A * 255);
62+
// //var hex = String.Format($"#{red:X2}{green:X2}{blue:X2}{alpha:X2}");
63+
// var hex = String.Format($"#{red:X2}{green:X2}{blue:X2}");
64+
// return hex;
65+
//}
6666

6767

6868
public ICommand Open { get; }

src/Acr.UserDialogs/Acr.UserDialogs.csproj

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<PropertyGroup>
33
<TargetFrameworks>net8.0;net8.0-ios;net8.0-android;net8.0-maccatalyst;net8.0-macos</TargetFrameworks>
44
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows</TargetFrameworks>
5+
<!--<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>-->
56
<PackageProjectUrl>https://github.com/aritchie/userdialogs</PackageProjectUrl>
67
<Product>$(AssemblyName) ($(TargetFramework))</Product>
78
<Authors>Allan Ritchie</Authors>
@@ -57,10 +58,15 @@
5758
<Compile Include="Platforms\macOS\**\*.cs" />
5859
</ItemGroup>
5960

60-
<ItemGroup Condition="$(TargetFramework.StartsWith('windows'))">
61+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('windows'))">
6162
<Compile Include="Platforms\Shared\**\*.cs" />
6263
<Compile Include="Platforms\Windows\**\*.cs" />
6364
<Page Include="Platforms\Windows\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
6465
<Compile Update="Platforms\Windows\**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
66+
67+
<!--
68+
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
69+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.240211001" />
70+
-->
6571
</ItemGroup>
6672
</Project>

src/Acr.UserDialogs/Platforms/Windows/ActionSheetViewModel.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using Windows.UI.Xaml;
43

54

65
namespace Acr.UserDialogs

src/Acr.UserDialogs/Platforms/Windows/TimePickerControl.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<UserControl
22
x:Class="Acr.UserDialogs.TimePickerControl"
3+
xmlns:="http://schemas.microsoft.com/winfx/2009/xaml"
34
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
45
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
56
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

src/Acr.UserDialogs/Platforms/Windows/UserDialogs.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using System.Threading.Tasks;
3-
using Windows.UI.Core;
4-
using Windows.ApplicationModel.Core;
53

64

75
namespace Acr.UserDialogs

src/Acr.UserDialogs/Platforms/Windows/UserDialogsImpl.cs

-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
using Windows.Foundation;
66
using Windows.UI.Core;
77
using Windows.UI.Popups;
8-
using Windows.UI.Xaml;
9-
using Windows.UI.Xaml.Controls;
10-
using Windows.UI.Xaml.Controls.Primitives;
11-
using Windows.UI.Xaml.Media;
12-
using Windows.UI.Xaml.Media.Imaging;
13-
using Coding4Fun.Toolkit.Controls;
148
using Acr.UserDialogs.Infrastructure;
159

1610

0 commit comments

Comments
 (0)