update sample
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace NotificationFlyout.Shared.UI
|
||||
{
|
||||
public static class ImageSourceExtensions
|
||||
{
|
||||
public static Icon ConvertToIcon(this ImageSource imageSource, uint dpi)
|
||||
{
|
||||
if (imageSource == null) return null;
|
||||
|
||||
var uri = new Uri(imageSource.ToString(), UriKind.RelativeOrAbsolute);
|
||||
|
||||
var streamResource = Application.GetResourceStream(uri);
|
||||
if (streamResource == null) throw new ArgumentException(nameof(streamResource));
|
||||
|
||||
return new Icon(streamResource.Stream, new System.Drawing.Size(PInvoke.GetSystemMetricsForDpi((int)SystemMetricFlag.SM_CXICON, dpi), PInvoke.GetSystemMetricsForDpi((int)SystemMetricFlag.SM_CYICON, dpi)));
|
||||
}
|
||||
|
||||
private enum SystemMetricFlag : int
|
||||
{
|
||||
SM_CXICON = 11,
|
||||
SM_CYICON = 12,
|
||||
SM_CXSMICON = 49,
|
||||
SM_CYSMICON = 50
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Markup;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
[ContentProperty(Name = "Content")]
|
||||
public class NotificationFlyout : DependencyObject
|
||||
{
|
||||
public static readonly DependencyProperty IconSourceProperty =
|
||||
|
||||
Reference in New Issue
Block a user