Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Apr 3, 2024
1 parent 290059e commit 065d8e3
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 68 deletions.
4 changes: 2 additions & 2 deletions sample/Sample/App.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Sample"
x:Class="Sample.App">
xmlns:local="clr-namespace:Samples"
x:Class="Samples.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
13 changes: 5 additions & 8 deletions sample/Sample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using Samples;
namespace Samples;

namespace Sample
public partial class App : Application
{
public partial class App : Application
public App()
{
public App()
{
InitializeComponent();
this.InitializeComponent();

this.MainPage = new MainPage();
}
this.MainPage = new MainPage();
}
}
7 changes: 2 additions & 5 deletions sample/Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Acr.UserDialogs;
using Microsoft.Maui.LifecycleEvents;

namespace Sample;
namespace Samples;


public static class MauiProgram
Expand All @@ -18,7 +15,7 @@ public static MauiApp CreateMauiApp()
});

#if ANDROID
UserDialogs.Init(() => Platform.CurrentActivity);
Acr.UserDialogs.UserDialogs.Init(() => Platform.CurrentActivity);
#endif
return builder.Build();
}
Expand Down
17 changes: 13 additions & 4 deletions sample/Sample/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace Sample
namespace Samples
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
[Activity(
Theme = "@style/Maui.SplashTheme",
MainLauncher = true,
ConfigurationChanges =
ConfigChanges.ScreenSize |
ConfigChanges.Orientation |
ConfigChanges.UiMode |
ConfigChanges.ScreenLayout |
ConfigChanges.SmallestScreenSize |
ConfigChanges.Density
)]
public class MainActivity : MauiAppCompatActivity
{
}
}
}
4 changes: 2 additions & 2 deletions sample/Sample/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Android.App;
using Android.Runtime;

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

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
}
4 changes: 2 additions & 2 deletions sample/Sample/Platforms/MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Foundation;

namespace Sample
namespace Samples
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
}
8 changes: 3 additions & 5 deletions sample/Sample/Platforms/MacCatalyst/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using ObjCRuntime;
using UIKit;

using UIKit;

namespace Sample
namespace Samples
{
public class Program
{
Expand All @@ -14,4 +12,4 @@ static void Main(string[] args)
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
}
4 changes: 2 additions & 2 deletions sample/Sample/Platforms/Windows/App.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<maui:MauiWinUIApplication
x:Class="Sample.WinUI.App"
x:Class="Samples.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maui="using:Microsoft.Maui"
xmlns:local="using:Sample.WinUI">
xmlns:local="using:Samples.WinUI">

</maui:MauiWinUIApplication>
2 changes: 1 addition & 1 deletion sample/Sample/Platforms/Windows/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace Sample.WinUI
namespace Samples.WinUI
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
Expand Down
2 changes: 1 addition & 1 deletion sample/Sample/Platforms/Windows/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="Sample.WinUI.app"/>
<assemblyIdentity version="1.0.0.0" name="Samples.WinUI.app"/>

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
Expand Down
4 changes: 2 additions & 2 deletions sample/Sample/Platforms/iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Foundation;

namespace Sample
namespace Samples
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
}
8 changes: 3 additions & 5 deletions sample/Sample/Platforms/iOS/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using ObjCRuntime;
using UIKit;

using UIKit;

namespace Sample
namespace Samples
{
public class Program
{
Expand All @@ -14,4 +12,4 @@ static void Main(string[] args)
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
}
2 changes: 1 addition & 1 deletion sample/Sample/ViewModels/SpecificCasesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ await this.Dialogs.AlertAsync(new AlertConfig
Text = "Toast with image",
Command = new Command(() =>
{
var img = Device.RuntimePlatform == Device.UWP ? "ms-appx:///Assets/emoji_cool_small.png" : "emoji_cool_small.png";
var img = DeviceInfo.Platform == DevicePlatform.WinUI ? "ms-appx:///Assets/emoji_cool_small.png" : "emoji_cool_small.png";
this.Dialogs.Toast(new ToastConfig("Wow what a cool guy").SetIcon(img));
})
},
Expand Down
36 changes: 18 additions & 18 deletions sample/Sample/ViewModels/ToastsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ public ToastsViewModel(IUserDialogs dialogs) : base(dialogs)
}


static System.Drawing.Color FromHex(string hex)
{
var c = Color.FromHex(hex);
var dc = System.Drawing.Color.FromArgb((int)c.Alpha, (int)c.Red, (int)c.Green, (int)c.Blue);
return dc;
}


static string ToHex(Color color)
{
var red = (int)(color.Red * 255);
var green = (int)(color.Green * 255);
var blue = (int)(color.Blue * 255);
//var alpha = (int)(color.A * 255);
//var hex = String.Format($"#{red:X2}{green:X2}{blue:X2}{alpha:X2}");
var hex = String.Format($"#{red:X2}{green:X2}{blue:X2}");
return hex;
}
//static System.Drawing.Color FromHex(string hex)
//{
// var c = Color.FromArgb(hex);
// var dc = System.Drawing.Color.FromArgb((int)c.Alpha, (int)c.Red, (int)c.Green, (int)c.Blue);
// return dc;
//}


//static string ToHex(Color color)
//{
// var red = (int)(color.Red * 255);
// var green = (int)(color.Green * 255);
// var blue = (int)(color.Blue * 255);
// //var alpha = (int)(color.A * 255);
// //var hex = String.Format($"#{red:X2}{green:X2}{blue:X2}{alpha:X2}");
// var hex = String.Format($"#{red:X2}{green:X2}{blue:X2}");
// return hex;
//}


public ICommand Open { get; }
Expand Down
8 changes: 7 additions & 1 deletion src/Acr.UserDialogs/Acr.UserDialogs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net8.0;net8.0-ios;net8.0-android;net8.0-maccatalyst;net8.0-macos</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows</TargetFrameworks>
<!--<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>-->
<PackageProjectUrl>https://github.com/aritchie/userdialogs</PackageProjectUrl>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<Authors>Allan Ritchie</Authors>
Expand Down Expand Up @@ -57,10 +58,15 @@
<Compile Include="Platforms\macOS\**\*.cs" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('windows'))">
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('windows'))">
<Compile Include="Platforms\Shared\**\*.cs" />
<Compile Include="Platforms\Windows\**\*.cs" />
<Page Include="Platforms\Windows\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
<Compile Update="Platforms\Windows\**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />

<!--
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.240211001" />
-->
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Windows.UI.Xaml;


namespace Acr.UserDialogs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<UserControl
x:Class="Acr.UserDialogs.TimePickerControl"
xmlns:="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand Down
2 changes: 0 additions & 2 deletions src/Acr.UserDialogs/Platforms/Windows/UserDialogs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Threading.Tasks;
using Windows.UI.Core;
using Windows.ApplicationModel.Core;


namespace Acr.UserDialogs
Expand Down
6 changes: 0 additions & 6 deletions src/Acr.UserDialogs/Platforms/Windows/UserDialogsImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
using Windows.Foundation;
using Windows.UI.Core;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Coding4Fun.Toolkit.Controls;
using Acr.UserDialogs.Infrastructure;


Expand Down

0 comments on commit 065d8e3

Please sign in to comment.