Skip to content

Commit

Permalink
Merge pull request #211 from CommunityToolkit/llama/port-notifications
Browse files Browse the repository at this point in the history
🧪 Bring over StackedNotificationsBehavior from Toolkit
  • Loading branch information
Arlodotexe authored Nov 18, 2022
2 parents ccc5935 + 4bb8fd1 commit 3882ace
Show file tree
Hide file tree
Showing 45 changed files with 1,763 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@ namespace CommunityToolkit.Labs.Shared.Renderers;
/// </summary>
public partial class MarkdownTextBlock : ToolkitMTB
{
#if HAS_UNO
//// Polyfill dummy for event callback
#pragma warning disable CS0067 // Unused on purpose for polyfill
public event EventHandler<LinkClickedEventArgs>? LinkClicked;
#pragma warning restore CS0067 // Unused on purpose for polyfill
#endif
}

#if HAS_UNO
//// Polyfill dummy for event callback
public class LinkClickedEventArgs : EventArgs { }
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<DataTemplate x:Key="DocumentTemplate"
x:DataType="x:String">
<renderer:MarkdownTextBlock Background="Transparent"
LinkClicked="MarkdownTextBlock_LinkClicked"
Text="{Binding}"
TextWrapping="WrapWholeWords" />
</DataTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
using CommunityToolkit.Labs.Core.SourceGenerators;
using CommunityToolkit.Labs.Core.SourceGenerators.Metadata;
using Windows.Storage;
using Windows.System;

#if !HAS_UNO
#if !WINAPPSDK
using Microsoft.Toolkit.Uwp.UI.Controls;
#else
using CommunityToolkit.WinUI.UI.Controls;
#endif
#endif

namespace CommunityToolkit.Labs.Shared.Renderers;

Expand Down Expand Up @@ -113,8 +122,12 @@ private async Task LoadData()
index = match.Index + match.Length;
}

// Put rest of text at end
DocsAndSamples.Add(doctext.Substring(index));
var rest = doctext.Substring(index).Trim();
// Put rest of text at end (if any)
if (rest.Length > 0)
{
DocsAndSamples.Add(rest);
}
}
}

Expand Down Expand Up @@ -174,4 +187,30 @@ private static async Task<string> GetDocumentationFileContents(ToolkitFrontMatte
return $"Exception Encountered Loading file '{fileUri}':\n{e.Message}\n{e.StackTrace}";
}
}


#if HAS_UNO
private void MarkdownTextBlock_LinkClicked(object sender, LinkClickedEventArgs e)
{
// No-op - TODO: See https://github.com/CommunityToolkit/Labs-Windows/issues/151
}
#elif !HAS_UNO
private async void MarkdownTextBlock_LinkClicked(object sender, LinkClickedEventArgs e)
{
if (!Uri.IsWellFormedUriString(e.Link, UriKind.Absolute))
{
await new ContentDialog
{
Title = "Windows Community Toolkit Labs Sample App",
Content = $"Link {e.Link} was malformed.",
CloseButtonText = "Close",
XamlRoot = XamlRoot // TODO: For UWP this is only on 1903+
}.ShowAsync();
}
else
{
await Launcher.LaunchUriAsync(new Uri(e.Link));
}
}
#endif
}
2 changes: 1 addition & 1 deletion common/Labs.Head.Uwp.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project>
<Import Project="$(RepositoryDirectory)common\Labs.Uwp.Base.props" />
<Import Project="$(RepositoryDirectory)common\Labs.Head.Uwp.Dependencies.props" />

Expand Down
3 changes: 3 additions & 0 deletions common/Labs.Uno.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<ItemGroup Condition="'$(IsUno)' == 'true'">
<PackageReference Include="Uno.UI" Version="4.6.18" />
</ItemGroup>
<PropertyGroup Condition="'$(IsUno)' == 'true'">
<UnoUIUseRoslynSourceGenerators>true</UnoUIUseRoslynSourceGenerators>
</PropertyGroup>

<ItemGroup Condition="'$(IsWasm)' == 'true' OR '$(IsWpf)' == 'true' OR '$(IsGtk)' == 'true'">
<PackageReference Include="Uno.UI.RemoteControl" Version="4.6.18" Condition="'$(Configuration)'=='Debug'" />
Expand Down
9 changes: 4 additions & 5 deletions common/Labs.Uwp.Base.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<IncludeContentInPack>false</IncludeContentInPack>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
Expand Down Expand Up @@ -44,7 +48,6 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
Expand All @@ -69,7 +72,6 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
Expand All @@ -82,7 +84,6 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
Expand All @@ -95,7 +96,6 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
Expand All @@ -120,7 +120,6 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Description>
This package contains a CanvasLayout Layout for ItemsRepeater.
</Description>
<Version>0.0.1</Version>
<Version>0.0.2</Version>
</PropertyGroup>

<!-- XAML Pages are automatically included, and don't need to be specified here. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Description>
This package contains SizerBase.
</Description>
<Version>0.0.2</Version>
<Version>0.0.3</Version>
</PropertyGroup>

<!-- XAML Pages are automatically included, and don't need to be specified here. -->
Expand Down
Loading

0 comments on commit 3882ace

Please sign in to comment.