Added sample packaged project and added app context based on whether you are running the app natively or thru an app package
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0'">
|
||||
<VisualStudioVersion>15.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x86">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x86</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x86">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x86</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|AnyCPU">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>AnyCPU</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|AnyCPU">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>AnyCPU</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>e2f52d15-a3bb-41ce-901c-ab491c50327a</ProjectGuid>
|
||||
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
|
||||
<EntryPointProjectUniqueName>..\NotificationFlyoutSample.Host\NotificationFlyoutSample.Host.csproj</EntryPointProjectUniqueName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Images\SplashScreen.scale-200.png" />
|
||||
<Content Include="Images\LockScreenLogo.scale-200.png" />
|
||||
<Content Include="Images\Square150x150Logo.scale-200.png" />
|
||||
<Content Include="Images\Square44x44Logo.scale-200.png" />
|
||||
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Content Include="Images\StoreLogo.png" />
|
||||
<Content Include="Images\Wide310x150Logo.scale-200.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.19041.8" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NotificationFlyoutSample.Host\NotificationFlyoutSample.Host.csproj">
|
||||
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
IgnorableNamespaces="uap rescap">
|
||||
|
||||
<Identity
|
||||
Name="b15dd450-41a7-49e9-bc4f-8192a7063ae2"
|
||||
Publisher="CN=dan"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<Properties>
|
||||
<DisplayName>NotificationFlyoutSample.Package</DisplayName>
|
||||
<PublisherDisplayName>dan</PublisherDisplayName>
|
||||
<Logo>Images\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="$targetentrypoint$">
|
||||
<uap:VisualElements
|
||||
DisplayName="NotificationFlyoutSample.Package"
|
||||
Description="NotificationFlyoutSample.Package"
|
||||
BackgroundColor="transparent"
|
||||
Square150x150Logo="Images\Square150x150Logo.png"
|
||||
Square44x44Logo="Images\Square44x44Logo.png">
|
||||
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
|
||||
<uap:SplashScreen Image="Images\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
</Package>
|
||||
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30914.41
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationFlyoutSample.Host", "NotificationFlyoutSample.Host\NotificationFlyoutSample.Host.csproj", "{D13742AD-DB71-4269-B3AF-7CA8C4E51A19}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyoutSample.Host", "NotificationFlyoutSample.Host\NotificationFlyoutSample.Host.csproj", "{D13742AD-DB71-4269-B3AF-7CA8C4E51A19}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationFlyoutSample", "NotificationFlyoutSample\NotificationFlyoutSample.csproj", "{2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}"
|
||||
EndProject
|
||||
@@ -18,6 +18,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Wpf.UI",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Wpf.UI.Controls", "..\src\NotificationFlyout.Wpf.UI.Controls\NotificationFlyout.Wpf.UI.Controls.csproj", "{094A2030-C430-490B-AB26-205385A0D4BF}"
|
||||
EndProject
|
||||
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "NotificationFlyoutSample.Package", "NotificationFlyoutSample.Package\NotificationFlyoutSample.Package.wapproj", "{E2F52D15-A3BB-41CE-901C-AB491C50327A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Uwp.UI", "..\src\NotificationFlyout.Uwp.UI\NotificationFlyout.Uwp.UI.csproj", "{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -79,8 +83,8 @@ Global
|
||||
{2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Release|x86.ActiveCfg = Release|x86
|
||||
{2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Release|x86.Build.0 = Release|x86
|
||||
{2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Release|x86.Deploy.0 = Release|x86
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
@@ -99,8 +103,8 @@ Global
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Release|x64.Build.0 = Release|x64
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{95F851E4-87A5-4BB7-953E-C0FE3B306F0E}.Release|x86.Build.0 = Release|Any CPU
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
@@ -119,8 +123,8 @@ Global
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Release|x64.Build.0 = Release|x64
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{49BCC188-22D2-468B-89EA-99C810BE790E}.Release|x86.Build.0 = Release|Any CPU
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
@@ -139,6 +143,56 @@ Global
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Release|x64.Build.0 = Release|x64
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{094A2030-C430-490B-AB26-205385A0D4BF}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|Any CPU.Deploy.0 = Debug|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x64.Build.0 = Debug|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x86.Build.0 = Debug|x86
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM.Build.0 = Release|ARM
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x64.ActiveCfg = Release|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x64.Build.0 = Release|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x64.Deploy.0 = Release|x64
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x86.ActiveCfg = Release|x86
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x86.Build.0 = Release|x86
|
||||
{E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x86.Deploy.0 = Release|x86
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|x64.Build.0 = Debug|x64
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|x64.ActiveCfg = Release|x64
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|x64.Build.0 = Release|x64
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls"
|
||||
xmlns:winui="using:Microsoft.UI.Xaml.Controls"
|
||||
LightIconSource="/Assets/Icon.ico">
|
||||
IconSource="/Assets/Icon.ico"
|
||||
LightIconSource="/Assets/Icon-Light.ico">
|
||||
<controls:NotificationFlyout.Content>
|
||||
<StackPanel
|
||||
Width="330"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using Microsoft.Windows.Sdk;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Extensions
|
||||
{
|
||||
internal class ExecutionMode
|
||||
{
|
||||
internal static bool IsRunningWithIdentity()
|
||||
{
|
||||
uint packageNameLength = 0;
|
||||
int result = PInvoke.GetCurrentPackageFullName(ref packageNameLength, "1024");
|
||||
|
||||
return result != 15700;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,18 +4,31 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Extensions
|
||||
{
|
||||
public static class ImageSourceExtensions
|
||||
{
|
||||
public static Icon ConvertToIcon(this ImageSource imageSource, uint dpi)
|
||||
public static async Task<Icon> ConvertToIconAsync(this ImageSource imageSource, uint dpi)
|
||||
{
|
||||
var bitmapImage = (BitmapImage)imageSource;
|
||||
var uri = $"{AppDomain.CurrentDomain.BaseDirectory}{bitmapImage.UriSource}".Replace("ms-appx:///", "").Replace("/", "\\");
|
||||
if (!ExecutionMode.IsRunningWithIdentity())
|
||||
{
|
||||
var uri = $"{AppDomain.CurrentDomain.BaseDirectory}{bitmapImage.UriSource}".Replace("ms-appx:///", "").Replace("/", "\\");
|
||||
|
||||
using var stream = File.OpenRead(uri);
|
||||
return new Icon(stream, new Size(PInvoke.GetSystemMetricsForDpi((int)SystemMetricFlag.SM_CXICON, dpi), PInvoke.GetSystemMetricsForDpi((int)SystemMetricFlag.SM_CYICON, dpi)));
|
||||
using var stream = File.OpenRead(uri);
|
||||
return new Icon(stream, new Size(PInvoke.GetSystemMetricsForDpi((int)SystemMetricFlag.SM_CXICON, dpi), PInvoke.GetSystemMetricsForDpi((int)SystemMetricFlag.SM_CYICON, dpi)));
|
||||
}
|
||||
else
|
||||
{
|
||||
var storageFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(bitmapImage.UriSource);
|
||||
using var stream = await storageFile.OpenStreamForReadAsync();
|
||||
return new Icon(stream, new Size(PInvoke.GetSystemMetricsForDpi((int)SystemMetricFlag.SM_CXICON, dpi), PInvoke.GetSystemMetricsForDpi((int)SystemMetricFlag.SM_CYICON, dpi)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private enum SystemMetricFlag : int
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
GetSystemMetricsForDpi
|
||||
GetSystemMetricsForDpi
|
||||
GetCurrentPackageFullName
|
||||
@@ -179,7 +179,7 @@ namespace NotificationFlyout.Wpf.UI.Controls
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateIcons()
|
||||
private async void UpdateIcons()
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace NotificationFlyout.Wpf.UI.Controls
|
||||
var iconSource = _systemPersonalisationHelper.Theme == SystemTheme.Dark ? _defaultIconSource : _lightIconSource;
|
||||
if (iconSource == null) return;
|
||||
|
||||
using var icon = iconSource.ConvertToIcon(dpi);
|
||||
using var icon = await iconSource.ConvertToIconAsync(dpi);
|
||||
_notificationIconHelper.SetIcon(icon.Handle);
|
||||
}
|
||||
|
||||
@@ -212,6 +212,7 @@ namespace NotificationFlyout.Wpf.UI.Controls
|
||||
flyoutHost.RequestedTheme = requestedTheme;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateWindow()
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||