diff --git a/App1/App.xaml b/App1/App.xaml
deleted file mode 100644
index 19bdc24..0000000
--- a/App1/App.xaml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/App1/App.xaml.cs b/App1/App.xaml.cs
deleted file mode 100644
index d6c3cb3..0000000
--- a/App1/App.xaml.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Microsoft.UI.Xaml.Data;
-using Microsoft.UI.Xaml.Input;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Navigation;
-using Microsoft.UI.Xaml.Shapes;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.ApplicationModel;
-using Windows.ApplicationModel.Activation;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
-namespace App1
-{
- ///
- /// Provides application-specific behavior to supplement the default Application class.
- ///
- public partial class App : Application
- {
- ///
- /// Initializes the singleton application object. This is the first line of authored code
- /// executed, and as such is the logical equivalent of main() or WinMain().
- ///
- public App()
- {
- this.InitializeComponent();
- }
-
- ///
- /// Invoked when the application is launched.
- ///
- /// Details about the launch request and process.
- protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
- {
- m_window = new MainWindow();
- m_window.Activate();
- }
-
- private Window m_window;
- }
-}
diff --git a/App1/App1.csproj b/App1/App1.csproj
deleted file mode 100644
index 1f61254..0000000
--- a/App1/App1.csproj
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
- WinExe
- net6.0-windows10.0.19041.0
- 10.0.17763.0
- App1
- app.manifest
- x86;x64;ARM64
- win10-x86;win10-x64;win10-arm64
- win10-$(Platform).pubxml
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
diff --git a/App1/Assets/LockScreenLogo.scale-200.png b/App1/Assets/LockScreenLogo.scale-200.png
deleted file mode 100644
index 7440f0d..0000000
Binary files a/App1/Assets/LockScreenLogo.scale-200.png and /dev/null differ
diff --git a/App1/Assets/SplashScreen.scale-200.png b/App1/Assets/SplashScreen.scale-200.png
deleted file mode 100644
index 32f486a..0000000
Binary files a/App1/Assets/SplashScreen.scale-200.png and /dev/null differ
diff --git a/App1/Assets/Square150x150Logo.scale-200.png b/App1/Assets/Square150x150Logo.scale-200.png
deleted file mode 100644
index 53ee377..0000000
Binary files a/App1/Assets/Square150x150Logo.scale-200.png and /dev/null differ
diff --git a/App1/Assets/Square44x44Logo.scale-200.png b/App1/Assets/Square44x44Logo.scale-200.png
deleted file mode 100644
index f713bba..0000000
Binary files a/App1/Assets/Square44x44Logo.scale-200.png and /dev/null differ
diff --git a/App1/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/App1/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
deleted file mode 100644
index dc9f5be..0000000
Binary files a/App1/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ
diff --git a/App1/Assets/StoreLogo.png b/App1/Assets/StoreLogo.png
deleted file mode 100644
index a4586f2..0000000
Binary files a/App1/Assets/StoreLogo.png and /dev/null differ
diff --git a/App1/Assets/Wide310x150Logo.scale-200.png b/App1/Assets/Wide310x150Logo.scale-200.png
deleted file mode 100644
index 8b4a5d0..0000000
Binary files a/App1/Assets/Wide310x150Logo.scale-200.png and /dev/null differ
diff --git a/App1/MainWindow.xaml b/App1/MainWindow.xaml
deleted file mode 100644
index 99d9cf1..0000000
--- a/App1/MainWindow.xaml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/App1/MainWindow.xaml.cs b/App1/MainWindow.xaml.cs
deleted file mode 100644
index a934cc2..0000000
--- a/App1/MainWindow.xaml.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Microsoft.UI.Xaml.Data;
-using Microsoft.UI.Xaml.Input;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Navigation;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
-namespace App1
-{
- ///
- /// An empty window that can be used on its own or navigated to within a Frame.
- ///
- public sealed partial class MainWindow : Window
- {
- public MainWindow()
- {
- this.InitializeComponent();
- }
- }
-}
diff --git a/App1/Package.appxmanifest b/App1/Package.appxmanifest
deleted file mode 100644
index 5fb8d1b..0000000
--- a/App1/Package.appxmanifest
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
- App1
- dan_c
- Assets\StoreLogo.png
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/App1/Properties/launchSettings.json b/App1/Properties/launchSettings.json
deleted file mode 100644
index c7779fb..0000000
--- a/App1/Properties/launchSettings.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "profiles": {
- "App1 (Package)": {
- "commandName": "MsixPackage"
- },
- "App1 (Unpackaged)": {
- "commandName": "Project"
- }
- }
-}
\ No newline at end of file
diff --git a/App1/app.manifest b/App1/app.manifest
deleted file mode 100644
index a44ef64..0000000
--- a/App1/app.manifest
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- PerMonitorV2
-
-
-
\ No newline at end of file
diff --git a/Hyperbar.Widget.MediaController.Windows/MediaController.cs b/Hyperbar.Widget.MediaController.Windows/MediaController.cs
index ffd1f50..773d25a 100644
--- a/Hyperbar.Widget.MediaController.Windows/MediaController.cs
+++ b/Hyperbar.Widget.MediaController.Windows/MediaController.cs
@@ -1,8 +1,4 @@
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Media.Imaging;
-using Windows.Graphics.Imaging;
-using Windows.Media.Control;
+using Windows.Media.Control;
using Windows.Storage.Streams;
namespace Hyperbar.Widget.MediaController.Windows;
@@ -17,7 +13,7 @@ public class MediaController :
private readonly AsyncLock asyncLock = new();
private readonly IDisposer disposer;
private readonly IMediator mediator;
- private GlobalSystemMediaTransportControlsSession? session;
+ private readonly GlobalSystemMediaTransportControlsSession session;
private GlobalSystemMediaTransportControlsSessionPlaybackStatus playbackStatus;
@@ -38,8 +34,6 @@ public class MediaController :
public void Dispose()
{
- session = null;
-
GC.SuppressFinalize(this);
disposer.Dispose(this);
}
@@ -95,31 +89,21 @@ public class MediaController :
private async Task UpdateMediaPropertiesAsync()
{
- if (session is not null)
+ using (await asyncLock)
{
- using (await asyncLock)
+ try
{
- try
- {
- //
+ GlobalSystemMediaTransportControlsSessionMediaProperties mediaProperties =
+ await session.TryGetMediaPropertiesAsync();
- //InMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream();
+ IRandomAccessStreamWithContentType randomAccessStream = await mediaProperties.Thumbnail.OpenReadAsync();
+ await mediator.PublishAsync(new Changed(new MediaInformation(mediaProperties.Title,
+ mediaProperties.Artist, randomAccessStream.AsStream())));
+ }
+ catch
+ {
- //// Copy the image stream to the random access stream
- //await d.AsStream().CopyToAsync(randomAccessStream.AsStreamForWrite());
-
- GlobalSystemMediaTransportControlsSessionMediaProperties mediaProperties =
- await session.TryGetMediaPropertiesAsync();
-
- IRandomAccessStreamWithContentType randomAccessStream = await mediaProperties.Thumbnail.OpenReadAsync();
- await mediator.PublishAsync(new Changed(new MediaInformation(mediaProperties.Title,
- mediaProperties.Artist, randomAccessStream.AsStream())));
- }
- catch
- {
-
- }
}
}
}
diff --git a/Hyperbar.sln b/Hyperbar.sln
index d5f857d..6911aaa 100644
--- a/Hyperbar.sln
+++ b/Hyperbar.sln
@@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Widget.MediaContro
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Widget.Windows", "Hyperbar.Widget.Windows\Hyperbar.Widget.Windows.csproj", "{E7322176-B67F-4A22-AFDB-7430A6AD44B6}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App1", "App1\App1.csproj", "{AB161079-E1AA-4A9B-B64C-D27A68245A2C}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -205,30 +203,6 @@ Global
{E7322176-B67F-4A22-AFDB-7430A6AD44B6}.Release|x64.Build.0 = Release|Any CPU
{E7322176-B67F-4A22-AFDB-7430A6AD44B6}.Release|x86.ActiveCfg = Release|Any CPU
{E7322176-B67F-4A22-AFDB-7430A6AD44B6}.Release|x86.Build.0 = Release|Any CPU
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|Any CPU.ActiveCfg = Debug|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|Any CPU.Build.0 = Debug|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|Any CPU.Deploy.0 = Debug|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|ARM64.ActiveCfg = Debug|ARM64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|ARM64.Build.0 = Debug|ARM64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|ARM64.Deploy.0 = Debug|ARM64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|x64.ActiveCfg = Debug|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|x64.Build.0 = Debug|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|x64.Deploy.0 = Debug|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|x86.ActiveCfg = Debug|x86
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|x86.Build.0 = Debug|x86
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Debug|x86.Deploy.0 = Debug|x86
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|Any CPU.ActiveCfg = Release|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|Any CPU.Build.0 = Release|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|Any CPU.Deploy.0 = Release|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|ARM64.ActiveCfg = Release|ARM64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|ARM64.Build.0 = Release|ARM64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|ARM64.Deploy.0 = Release|ARM64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|x64.ActiveCfg = Release|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|x64.Build.0 = Release|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|x64.Deploy.0 = Release|x64
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|x86.ActiveCfg = Release|x86
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|x86.Build.0 = Release|x86
- {AB161079-E1AA-4A9B-B64C-D27A68245A2C}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE