From 5ed76c48395e2336b566277b2706171c18eec37c Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Sat, 1 Feb 2025 23:56:26 -0500 Subject: [PATCH 1/7] Most of the updates to settings app for Customer Preview 1 --- build/nuke_build/Build.cs | 7 +- build/staging/version/BundleInfo.wxi | 4 +- .../version/WindowsMidiServicesVersion.cs | 10 +- .../version/WindowsMidiServicesVersion.h | 10 +- .../basics/client-basics-cpp.vcxproj | 2 +- samples/cpp-winrt/basics/packages.config | 2 +- .../loopback-endpoints-cpp.vcxproj | 2 +- .../loopback-endpoints/packages.config | 2 +- samples/cpp-winrt/send-speed/packages.config | 2 +- .../send-speed/send-speed-cpp.vcxproj | 2 +- .../simple-app-to-app-midi/packages.config | 2 +- .../simple-app-to-app-cpp.vcxproj | 2 +- .../static-enum-endpoints/packages.config | 2 +- .../static-enum-endpoints-cpp.vcxproj | 2 +- .../cpp-winrt/watch-endpoints/packages.config | 2 +- .../watch-endpoints-cpp.vcxproj | 2 +- src/app-sdk/mididiag/mididiag.vcxproj | 2 +- src/app-sdk/mididiag/packages.config | 2 +- src/app-sdk/midimdnsinfo/midimdnsinfo.vcxproj | 2 +- src/app-sdk/midimdnsinfo/packages.config | 2 +- src/app-sdk/midiusbinfo/midiusbinfo.vcxproj | 2 +- src/app-sdk/midiusbinfo/packages.config | 2 +- .../Microsoft.Midi.Settings/App.xaml | 1 + .../Microsoft.Midi.Settings/App.xaml.cs | 37 +++- .../Microsoft.Midi.Settings.csproj | 24 +++ .../MidiSettings.exe.manifest | 141 ------------ .../Models/AppState.cs | 53 ++++- .../Endpoints/APP/EndpointsAppPage.xaml | 15 ++ .../Endpoints/APP/EndpointsAppPage.xaml.cs | 31 +++ .../Endpoints/APP/EndpointsAppViewModel.cs | 132 ++++++++++++ .../Endpoints/All/EndpointsAllPage.xaml | 144 +++++++++++++ .../Endpoints/All/EndpointsAllPage.xaml.cs | 62 ++++++ .../Endpoints/All/EndpointsAllViewModel.cs | 132 ++++++++++++ .../Endpoints/BLE10/EndpointsBle10Page.xaml | 15 ++ .../BLE10/EndpointsBle10Page.xaml.cs | 31 +++ .../BLE10/EndpointsBle10ViewModel.cs | 132 ++++++++++++ .../Endpoints}/DeviceDetailPage.xaml | 6 +- .../Endpoints}/DeviceDetailPage.xaml.cs | 27 +++ .../Endpoints}/DeviceDetailViewModel.cs | 0 .../Endpoints/KS/EndpointsKSPage.xaml} | 3 +- .../Endpoints/KS/EndpointsKSPage.xaml.cs} | 8 +- .../Endpoints/KS/EndpointsKSViewModel.cs | 132 ++++++++++++ .../Endpoints/KSA/EndpointsKsaPage.xaml | 15 ++ .../Endpoints/KSA/EndpointsKsaPage.xaml.cs | 31 +++ .../Endpoints/KSA/EndpointsKsaViewModel.cs | 132 ++++++++++++ .../Endpoints/LOOP/EndpointsLoopPage.xaml | 15 ++ .../Endpoints/LOOP/EndpointsLoopPage.xaml.cs | 31 +++ .../Endpoints/LOOP/EndpointsLoopViewModel.cs | 132 ++++++++++++ .../NET2UDP/EndpointsNet2UdpPage.xaml | 15 ++ .../NET2UDP/EndpointsNet2UdpPage.xaml.cs | 31 +++ .../NET2UDP/EndpointsNet2UdpViewModel.cs | 132 ++++++++++++ .../WinMMMidi1DevicesPage.xaml | 0 .../WinMMMidi1DevicesPage.xaml.cs | 0 .../WinMMMidi1DevicesViewModel.cs | 0 .../WinRTMidi1DevicesPage.xaml | 0 .../WinRTMidi1DevicesPage.xaml.cs | 0 .../WinRTMidi1DevicesViewModel.cs | 0 .../Settings}/SettingsPage.xaml | 0 .../Settings}/SettingsPage.xaml.cs | 0 .../Settings}/SettingsViewModel.cs | 1 + .../{Views => Sections/Setups}/SetupPage.xaml | 0 .../Setups}/SetupPage.xaml.cs | 0 .../Setups}/SetupViewModel.cs | 0 .../Tools}/ToolsConsolePage.xaml | 0 .../Tools}/ToolsConsolePage.xaml.cs | 0 .../Tools}/ToolsConsoleViewModel.cs | 0 .../Tools}/ToolsMonitorPage.xaml | 0 .../Tools}/ToolsMonitorPage.xaml.cs | 0 .../Tools}/ToolsMonitorViewModel.cs | 0 .../Tools}/ToolsSysExPage.xaml | 0 .../Tools}/ToolsSysExPage.xaml.cs | 0 .../Tools}/ToolsSysExViewModel.cs | 0 .../Tools}/ToolsTestPage.xaml | 0 .../Tools}/ToolsTestPage.xaml.cs | 0 .../Tools}/ToolsTestViewModel.cs | 0 .../TroubleshootingViewModel.cs | 0 .../Services/GeneralSettingsService.cs | 19 +- .../Services/LocalSettingsService.cs | 6 +- .../Services/PageService.cs | 10 +- .../Services/ThemeSelectorService.cs | 2 +- .../Strings/en-us/Resources.resw | 34 ++- .../Styles/MidiStyles.xaml | 14 ++ .../MidiServiceSessionInformationWrapper.cs | 11 +- .../ViewModels/HomeViewModel.cs | 19 ++ .../ViewModels/ManagementSessionsViewModel.cs | 23 +- .../Views/HomePage.xaml | 200 +++++++++++++++--- .../Views/HomePage.xaml.cs | 5 + .../Views/ManagementSessionsPage.xaml | 7 +- .../Views/PluginsTransportPage.xaml | 2 +- .../Views/ShellPage.xaml | 100 ++++++--- 90 files changed, 1901 insertions(+), 279 deletions(-) create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppPage.xaml create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppPage.xaml.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppViewModel.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllPage.xaml create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllPage.xaml.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllViewModel.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10Page.xaml create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10Page.xaml.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10ViewModel.cs rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Endpoints}/DeviceDetailPage.xaml (99%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Endpoints}/DeviceDetailPage.xaml.cs (88%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/Endpoints}/DeviceDetailViewModel.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views/DevicesPage.xaml => Sections/Endpoints/KS/EndpointsKSPage.xaml} (99%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views/DevicesPage.xaml.cs => Sections/Endpoints/KS/EndpointsKSPage.xaml.cs} (90%) create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/KS/EndpointsKSViewModel.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/KSA/EndpointsKsaPage.xaml create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/KSA/EndpointsKsaPage.xaml.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/KSA/EndpointsKsaViewModel.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/LOOP/EndpointsLoopPage.xaml create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/LOOP/EndpointsLoopPage.xaml.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/LOOP/EndpointsLoopViewModel.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/NET2UDP/EndpointsNet2UdpPage.xaml create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/NET2UDP/EndpointsNet2UdpPage.xaml.cs create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/NET2UDP/EndpointsNet2UdpViewModel.cs rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/EndpointsWinMM}/WinMMMidi1DevicesPage.xaml (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/EndpointsWinMM}/WinMMMidi1DevicesPage.xaml.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/EndpointsWinMM}/WinMMMidi1DevicesViewModel.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/EndpointsWinRT1}/WinRTMidi1DevicesPage.xaml (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/EndpointsWinRT1}/WinRTMidi1DevicesPage.xaml.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/EndpointsWinRT1}/WinRTMidi1DevicesViewModel.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Settings}/SettingsPage.xaml (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Settings}/SettingsPage.xaml.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/Settings}/SettingsViewModel.cs (98%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Setups}/SetupPage.xaml (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Setups}/SetupPage.xaml.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/Setups}/SetupViewModel.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Tools}/ToolsConsolePage.xaml (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Tools}/ToolsConsolePage.xaml.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/Tools}/ToolsConsoleViewModel.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Tools}/ToolsMonitorPage.xaml (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Tools}/ToolsMonitorPage.xaml.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/Tools}/ToolsMonitorViewModel.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Tools}/ToolsSysExPage.xaml (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Tools}/ToolsSysExPage.xaml.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/Tools}/ToolsSysExViewModel.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Tools}/ToolsTestPage.xaml (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{Views => Sections/Tools}/ToolsTestPage.xaml.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/Tools}/ToolsTestViewModel.cs (100%) rename src/user-tools/midi-settings/Microsoft.Midi.Settings/{ViewModels => Sections/Troubleshooting}/TroubleshootingViewModel.cs (100%) create mode 100644 src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/MidiStyles.xaml diff --git a/build/nuke_build/Build.cs b/build/nuke_build/Build.cs index fdbd97e24..91ad276d0 100644 --- a/build/nuke_build/Build.cs +++ b/build/nuke_build/Build.cs @@ -34,14 +34,15 @@ class Build : NukeBuild //readonly GitVersion MasterBuildVersion; - string VersionName => "Developer Preview 9"; - string NuGetVersionName => "preview-9"; + //string VersionName => "Developer Preview 9"; + string VersionName => "Customer Preview 1"; + string NuGetVersionName => "preview-10"; // we set these here, especially the time, so it's the same for all platforms in the single build const string BuildVersionMajor = "1"; const string BuildVersionMinor = "0"; - const string BuildVersionRevision = "2"; + const string BuildVersionRevision = "3"; const string BuildMajorMinorRevision = $"{BuildVersionMajor}.{BuildVersionMinor}.{BuildVersionRevision}"; //string BuildDateNumber = DateTime.Now.ToString("yy") + DateTime.Now.DayOfYear.ToString("000"); // YYddd where ddd is the day number for the year diff --git a/build/staging/version/BundleInfo.wxi b/build/staging/version/BundleInfo.wxi index ad340fe80..f9014e9c3 100644 --- a/build/staging/version/BundleInfo.wxi +++ b/build/staging/version/BundleInfo.wxi @@ -1,4 +1,4 @@ - - + + diff --git a/build/staging/version/WindowsMidiServicesVersion.cs b/build/staging/version/WindowsMidiServicesVersion.cs index 7b0d23345..7d4b0b8ff 100644 --- a/build/staging/version/WindowsMidiServicesVersion.cs +++ b/build/staging/version/WindowsMidiServicesVersion.cs @@ -5,13 +5,13 @@ namespace Microsoft.Midi.Common public static class MidiBuildInformation { public const string Source = "GitHub Preview"; - public const string Name = "Developer Preview 9"; - public const string BuildFullVersion = "1.0.2-preview-9.250121-1820"; + public const string Name = "Customer Preview 1"; + public const string BuildFullVersion = "1.0.3-preview-10.250131-1639"; public const string VersionMajor = "1"; public const string VersionMinor = "0"; - public const string VersionRevision = "2"; - public const string VersionDateNumber = "250121"; - public const string VersionTimeNumber = "1820"; + public const string VersionRevision = "3"; + public const string VersionDateNumber = "250131"; + public const string VersionTimeNumber = "1639"; } } diff --git a/build/staging/version/WindowsMidiServicesVersion.h b/build/staging/version/WindowsMidiServicesVersion.h index 9c2627144..8429a5864 100644 --- a/build/staging/version/WindowsMidiServicesVersion.h +++ b/build/staging/version/WindowsMidiServicesVersion.h @@ -4,13 +4,13 @@ #define WINDOWS_MIDI_SERVICES_VERSION_INCLUDE #define WINDOWS_MIDI_SERVICES_BUILD_SOURCE L"GitHub Preview" -#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_NAME L"Developer Preview 9" -#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL L"1.0.2-preview-9.250121-1820" +#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_NAME L"Customer Preview 1" +#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL L"1.0.3-preview-10.250131-1639" #define WINDOWS_MIDI_SERVICES_BUILD_VERSION_MAJOR L"1" #define WINDOWS_MIDI_SERVICES_BUILD_VERSION_MINOR L"0" -#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_REVISION L"2" -#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_DATE_NUMBER L"250121" -#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_TIME_NUMBER L"1820" +#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_REVISION L"3" +#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_DATE_NUMBER L"250131" +#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_TIME_NUMBER L"1639" #endif diff --git a/samples/cpp-winrt/basics/client-basics-cpp.vcxproj b/samples/cpp-winrt/basics/client-basics-cpp.vcxproj index 09708f0dd..f62037901 100644 --- a/samples/cpp-winrt/basics/client-basics-cpp.vcxproj +++ b/samples/cpp-winrt/basics/client-basics-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true false diff --git a/samples/cpp-winrt/basics/packages.config b/samples/cpp-winrt/basics/packages.config index 712dd7091..0b7b58915 100644 --- a/samples/cpp-winrt/basics/packages.config +++ b/samples/cpp-winrt/basics/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj b/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj index f60216292..a9c8bf108 100644 --- a/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true true diff --git a/samples/cpp-winrt/loopback-endpoints/packages.config b/samples/cpp-winrt/loopback-endpoints/packages.config index 712dd7091..0b7b58915 100644 --- a/samples/cpp-winrt/loopback-endpoints/packages.config +++ b/samples/cpp-winrt/loopback-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/send-speed/packages.config b/samples/cpp-winrt/send-speed/packages.config index 712dd7091..0b7b58915 100644 --- a/samples/cpp-winrt/send-speed/packages.config +++ b/samples/cpp-winrt/send-speed/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj b/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj index 36e4a8ef1..1a878e354 100644 --- a/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj +++ b/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true true diff --git a/samples/cpp-winrt/simple-app-to-app-midi/packages.config b/samples/cpp-winrt/simple-app-to-app-midi/packages.config index 712dd7091..0b7b58915 100644 --- a/samples/cpp-winrt/simple-app-to-app-midi/packages.config +++ b/samples/cpp-winrt/simple-app-to-app-midi/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/simple-app-to-app-midi/simple-app-to-app-cpp.vcxproj b/samples/cpp-winrt/simple-app-to-app-midi/simple-app-to-app-cpp.vcxproj index df679f33e..173efae13 100644 --- a/samples/cpp-winrt/simple-app-to-app-midi/simple-app-to-app-cpp.vcxproj +++ b/samples/cpp-winrt/simple-app-to-app-midi/simple-app-to-app-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true true diff --git a/samples/cpp-winrt/static-enum-endpoints/packages.config b/samples/cpp-winrt/static-enum-endpoints/packages.config index 712dd7091..0b7b58915 100644 --- a/samples/cpp-winrt/static-enum-endpoints/packages.config +++ b/samples/cpp-winrt/static-enum-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj b/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj index c7cd501f1..29d7cc9ab 100644 --- a/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true true diff --git a/samples/cpp-winrt/watch-endpoints/packages.config b/samples/cpp-winrt/watch-endpoints/packages.config index 712dd7091..0b7b58915 100644 --- a/samples/cpp-winrt/watch-endpoints/packages.config +++ b/samples/cpp-winrt/watch-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj b/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj index 9802dc24d..24b3cba6d 100644 --- a/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true true diff --git a/src/app-sdk/mididiag/mididiag.vcxproj b/src/app-sdk/mididiag/mididiag.vcxproj index a7d11a8ca..62860eb7a 100644 --- a/src/app-sdk/mididiag/mididiag.vcxproj +++ b/src/app-sdk/mididiag/mididiag.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true true diff --git a/src/app-sdk/mididiag/packages.config b/src/app-sdk/mididiag/packages.config index 2c326a3a2..b1fd25239 100644 --- a/src/app-sdk/mididiag/packages.config +++ b/src/app-sdk/mididiag/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/src/app-sdk/midimdnsinfo/midimdnsinfo.vcxproj b/src/app-sdk/midimdnsinfo/midimdnsinfo.vcxproj index 450d057a2..eeb10de89 100644 --- a/src/app-sdk/midimdnsinfo/midimdnsinfo.vcxproj +++ b/src/app-sdk/midimdnsinfo/midimdnsinfo.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true true diff --git a/src/app-sdk/midimdnsinfo/packages.config b/src/app-sdk/midimdnsinfo/packages.config index 2c326a3a2..b1fd25239 100644 --- a/src/app-sdk/midimdnsinfo/packages.config +++ b/src/app-sdk/midimdnsinfo/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/src/app-sdk/midiusbinfo/midiusbinfo.vcxproj b/src/app-sdk/midiusbinfo/midiusbinfo.vcxproj index 54d106e75..42e7d8cde 100644 --- a/src/app-sdk/midiusbinfo/midiusbinfo.vcxproj +++ b/src/app-sdk/midiusbinfo/midiusbinfo.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820 + Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250131-1639 true true true diff --git a/src/app-sdk/midiusbinfo/packages.config b/src/app-sdk/midiusbinfo/packages.config index 2c326a3a2..b1fd25239 100644 --- a/src/app-sdk/midiusbinfo/packages.config +++ b/src/app-sdk/midiusbinfo/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml b/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml index 3b864afd7..22ae3ca62 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml @@ -11,6 +11,7 @@ + diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs index 76a2ddd53..a161d543a 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs @@ -10,6 +10,7 @@ using Microsoft.Midi.Settings.ViewModels; using Microsoft.Midi.Settings.Views; using Microsoft.UI.Xaml; +using Windows.UI.Popups; namespace Microsoft.Midi.Settings; @@ -86,8 +87,28 @@ public App() services.AddTransient(); services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); @@ -141,13 +162,19 @@ private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledEx App.GetService().LogError(e.Message); } + private MidiDesktopAppSdkInitializer? _midiInitializer = null; + + public MidiDesktopAppSdkInitializer? MidiInitializer => _midiInitializer; + protected async override void OnLaunched(LaunchActivatedEventArgs args) { base.OnLaunched(args); - await App.GetService().ActivateAsync(args); + // initialize the SDK + if (AppState.Current.Initialize()) + { + await App.GetService().ActivateAsync(args); - // force construction - var current = AppState.Current; + } } } diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Microsoft.Midi.Settings.csproj b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Microsoft.Midi.Settings.csproj index d893a4d42..643630300 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Microsoft.Midi.Settings.csproj +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Microsoft.Midi.Settings.csproj @@ -71,6 +71,12 @@ + + + + + + @@ -153,6 +159,24 @@ Never + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + $(DefaultXamlRuntime) diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/MidiSettings.exe.manifest b/src/user-tools/midi-settings/Microsoft.Midi.Settings/MidiSettings.exe.manifest index 2da4ccb7a..f4a5bff09 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/MidiSettings.exe.manifest +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/MidiSettings.exe.manifest @@ -17,146 +17,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Models/AppState.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Models/AppState.cs index ecd4523a6..3f654372e 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Models/AppState.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Models/AppState.cs @@ -6,6 +6,7 @@ using System.Resources; using System.Text; using System.Threading.Tasks; +using Windows.UI.Popups; namespace Microsoft.Midi.Settings.Models; @@ -18,32 +19,45 @@ public class AppState private static AppState? _current; + private MidiDesktopAppSdkInitializer? _initializer; + private AppState() { - var initializer = Microsoft.Windows.Devices.Midi2.Initialization.MidiDesktopAppSdkInitializer.Create(); - if (initializer == null) + } + + public bool Initialize() + { + _initializer = Microsoft.Windows.Devices.Midi2.Initialization.MidiDesktopAppSdkInitializer.Create(); + + if (_initializer == null) { // TODO: Failed - return; + return false; } - // initialize SDK runtime - if (!initializer.InitializeSdkRuntime()) + if (!_initializer!.InitializeSdkRuntime()) { - // TODO: Failed - return; + // TODO: Localize these messages + var dialog = new MessageDialog("Unable to initialize the Windows MIDI Services SDK runtime. Is it installed? Exiting."); + dialog.ShowAsync().Wait(); + + return false; } - // start the service - if (!initializer.EnsureServiceAvailable()) + if (!_initializer!.EnsureServiceAvailable()) { - // TODO: Failed - return; + // TODO: Localize these messages + var dialog = new MessageDialog("The Windows MIDI Services SDK is installed, but we failed to start the service. Exiting."); + dialog.ShowAsync().Wait(); + + return false; } StartDeviceWatcher(true); + + return true; } public static AppState Current @@ -67,6 +81,23 @@ public string GetCurrentSetupFileName() return val; } + public string GetInstalledSdkVersionString() + { + string val = "Unable to query SDK version"; + + if (_initializer != null) + { + val = _initializer.GetInstalledSdkDescription(true, true, true); + } + + return val; + } + + public Uri GetMidiSdkInstallerUri() + { + return new Uri(MidiDesktopAppSdkInitializer.LatestMidiAppSdkDownloadUrl); + } + public MidiEndpointDeviceWatcher MidiEndpointDeviceWatcher { diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppPage.xaml b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppPage.xaml new file mode 100644 index 000000000..7bd6b1e53 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppPage.xaml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppPage.xaml.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppPage.xaml.cs new file mode 100644 index 000000000..6503ec73f --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppPage.xaml.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +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; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace Microsoft.Midi.Settings.Views +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class EndpointsAppPage : Page + { + public EndpointsAppPage() + { + this.InitializeComponent(); + } + } +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppViewModel.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppViewModel.cs new file mode 100644 index 000000000..c6fbfb564 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/APP/EndpointsAppViewModel.cs @@ -0,0 +1,132 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Microsoft.Midi.Settings.Contracts.Services; +using Microsoft.Midi.Settings.Contracts.ViewModels; +using Microsoft.Midi.Settings.Models; +using Microsoft.UI.Dispatching; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace Microsoft.Midi.Settings.ViewModels +{ + public class EndpointsAppViewModel : ObservableRecipient, INavigationAware + { + private readonly INavigationService _navigationService; + + public ICommand ViewDeviceDetailsCommand + { + get; private set; + } + + public DispatcherQueue? DispatcherQueue { get; set; } + + public EndpointsAppViewModel(INavigationService navigationService) + { + _navigationService = navigationService; + + ViewDeviceDetailsCommand = new RelayCommand( + (param) => + { + System.Diagnostics.Debug.WriteLine("View Device Details Command exec"); + + _navigationService.NavigateTo(typeof(DeviceDetailViewModel).FullName!, param); + + }); + } + + public ObservableCollection MidiEndpointDevicesByTransport { get; } = []; + + + public void RefreshDeviceCollection(bool showDiagnosticsEndpoints = false) + { + if (DispatcherQueue == null) return; + + DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Normal, () => + { + System.Diagnostics.Debug.WriteLine("Begin RefreshDeviceCollection"); + + ObservableCollection tempCollection = []; + + // go through devices in AppState and group by parent + + // pre-populate with transports + + foreach (var transport in MidiReporting.GetInstalledTransportPlugins()) + { + var t = new MidiEndpointDevicesByTransport(transport); + + tempCollection.Add(t); + } + + // now get all the endpoint devices and put them in groups by transport + + var enumeratedDevices = AppState.Current.MidiEndpointDeviceWatcher.EnumeratedEndpointDevices; + + foreach (var endpointDevice in enumeratedDevices.Values) + { + if (endpointDevice != null) + { + // Get the transport + + var transportInfo = endpointDevice.GetTransportSuppliedInfo(); + var transportId = transportInfo.TransportId; + + var parentTransport = tempCollection.Where(x => x.Transport.Id == transportId).FirstOrDefault(); + + // add this device to the transport's collection + if (parentTransport != null) + { + parentTransport.EndpointDevices.Add(new MidiEndpointDeviceListItem(endpointDevice)); + } + } + } + + + // Only show relevant transports. Either they have children, or support + // creating a runtime through the settings application + + MidiEndpointDevicesByTransport.Clear(); + + foreach (var item in tempCollection.OrderBy(x => x.Transport.Name)) + { + // TODO: this is a hack. Probably shouldn't be using the transport code directly + // Instead, need a transport property for purpose like we have with endpoints + if (item.Transport.TransportCode == "DIAG") + { + if (showDiagnosticsEndpoints) + { + MidiEndpointDevicesByTransport.Add(item); + } + } + else if (item.EndpointDevices.Count > 0 || item.Transport.IsRuntimeCreatableBySettings) + { + MidiEndpointDevicesByTransport.Add(item); + } + } + + + System.Diagnostics.Debug.WriteLine("Completed RefreshDeviceCollection"); + + + + }); + + } + + + + public void OnNavigatedFrom() + { + } + + + public void OnNavigatedTo(object parameter) + { + } + } +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllPage.xaml b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllPage.xaml new file mode 100644 index 000000000..3dba6883b --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllPage.xaml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllPage.xaml.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllPage.xaml.cs new file mode 100644 index 000000000..2b6f9acdd --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllPage.xaml.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +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 CommunityToolkit.WinUI.Controls; +using Microsoft.Midi.Settings.Contracts.Services; +using Microsoft.Midi.Settings.ViewModels; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace Microsoft.Midi.Settings.Views +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class EndpointsAllPage : Page + { + private ILoggingService _loggingService; + + + public EndpointsAllViewModel ViewModel + { + get; + } + + + public EndpointsAllPage() + { + ViewModel = App.GetService(); + _loggingService = App.GetService(); + + Loaded += DevicesPage_Loaded; + + InitializeComponent(); + } + + private void DevicesPage_Loaded(object sender, RoutedEventArgs e) + { + ViewModel.DispatcherQueue = this.DispatcherQueue; + + ViewModel.RefreshDeviceCollection(); + } + + + // work around WinUI binding bug + private void EndpointSettingsCard_Loaded(object sender, RoutedEventArgs e) + { + ((SettingsCard)sender).Command = ViewModel.ViewDeviceDetailsCommand; + } + } +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllViewModel.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllViewModel.cs new file mode 100644 index 000000000..9f580308e --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/All/EndpointsAllViewModel.cs @@ -0,0 +1,132 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Microsoft.Midi.Settings.Contracts.Services; +using Microsoft.Midi.Settings.Contracts.ViewModels; +using Microsoft.Midi.Settings.Models; +using Microsoft.UI.Dispatching; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace Microsoft.Midi.Settings.ViewModels +{ + public class EndpointsAllViewModel : ObservableRecipient, INavigationAware + { + private readonly INavigationService _navigationService; + + public ICommand ViewDeviceDetailsCommand + { + get; private set; + } + + public DispatcherQueue? DispatcherQueue { get; set; } + + public EndpointsAllViewModel(INavigationService navigationService) + { + _navigationService = navigationService; + + ViewDeviceDetailsCommand = new RelayCommand( + (param) => + { + System.Diagnostics.Debug.WriteLine("View Device Details Command exec"); + + _navigationService.NavigateTo(typeof(DeviceDetailViewModel).FullName!, param); + + }); + } + + public ObservableCollection MidiEndpointDevicesByTransport { get; } = []; + + + public void RefreshDeviceCollection(bool showDiagnosticsEndpoints = false) + { + if (DispatcherQueue == null) return; + + DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Normal, () => + { + System.Diagnostics.Debug.WriteLine("Begin RefreshDeviceCollection"); + + ObservableCollection tempCollection = []; + + // go through devices in AppState and group by parent + + // pre-populate with transports + + foreach (var transport in MidiReporting.GetInstalledTransportPlugins()) + { + var t = new MidiEndpointDevicesByTransport(transport); + + tempCollection.Add(t); + } + + // now get all the endpoint devices and put them in groups by transport + + var enumeratedDevices = AppState.Current.MidiEndpointDeviceWatcher.EnumeratedEndpointDevices; + + foreach (var endpointDevice in enumeratedDevices.Values) + { + if (endpointDevice != null) + { + // Get the transport + + var transportInfo = endpointDevice.GetTransportSuppliedInfo(); + var transportId = transportInfo.TransportId; + + var parentTransport = tempCollection.Where(x => x.Transport.Id == transportId).FirstOrDefault(); + + // add this device to the transport's collection + if (parentTransport != null) + { + parentTransport.EndpointDevices.Add(new MidiEndpointDeviceListItem(endpointDevice)); + } + } + } + + + // Only show relevant transports. Either they have children, or support + // creating a runtime through the settings application + + MidiEndpointDevicesByTransport.Clear(); + + foreach (var item in tempCollection.OrderBy(x => x.Transport.Name)) + { + // TODO: this is a hack. Probably shouldn't be using the transport code directly + // Instead, need a transport property for purpose like we have with endpoints + if (item.Transport.TransportCode == "DIAG") + { + if (showDiagnosticsEndpoints) + { + MidiEndpointDevicesByTransport.Add(item); + } + } + else if (item.EndpointDevices.Count > 0 || item.Transport.IsRuntimeCreatableBySettings) + { + MidiEndpointDevicesByTransport.Add(item); + } + } + + + System.Diagnostics.Debug.WriteLine("Completed RefreshDeviceCollection"); + + + + }); + + } + + + + public void OnNavigatedFrom() + { + } + + + public void OnNavigatedTo(object parameter) + { + } + } +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10Page.xaml b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10Page.xaml new file mode 100644 index 000000000..308f9cac5 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10Page.xaml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10Page.xaml.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10Page.xaml.cs new file mode 100644 index 000000000..a68c3e609 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10Page.xaml.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +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; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace Microsoft.Midi.Settings.Views +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class EndpointsBle10Page : Page + { + public EndpointsBle10Page() + { + this.InitializeComponent(); + } + } +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10ViewModel.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10ViewModel.cs new file mode 100644 index 000000000..3b9690e87 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/BLE10/EndpointsBle10ViewModel.cs @@ -0,0 +1,132 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Microsoft.Midi.Settings.Contracts.Services; +using Microsoft.Midi.Settings.Contracts.ViewModels; +using Microsoft.Midi.Settings.Models; +using Microsoft.UI.Dispatching; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace Microsoft.Midi.Settings.ViewModels +{ + public class EndpointsBle10ViewModel : ObservableRecipient, INavigationAware + { + private readonly INavigationService _navigationService; + + public ICommand ViewDeviceDetailsCommand + { + get; private set; + } + + public DispatcherQueue? DispatcherQueue { get; set; } + + public EndpointsBle10ViewModel(INavigationService navigationService) + { + _navigationService = navigationService; + + ViewDeviceDetailsCommand = new RelayCommand( + (param) => + { + System.Diagnostics.Debug.WriteLine("View Device Details Command exec"); + + _navigationService.NavigateTo(typeof(DeviceDetailViewModel).FullName!, param); + + }); + } + + public ObservableCollection MidiEndpointDevicesByTransport { get; } = []; + + + public void RefreshDeviceCollection(bool showDiagnosticsEndpoints = false) + { + if (DispatcherQueue == null) return; + + DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Normal, () => + { + System.Diagnostics.Debug.WriteLine("Begin RefreshDeviceCollection"); + + ObservableCollection tempCollection = []; + + // go through devices in AppState and group by parent + + // pre-populate with transports + + foreach (var transport in MidiReporting.GetInstalledTransportPlugins()) + { + var t = new MidiEndpointDevicesByTransport(transport); + + tempCollection.Add(t); + } + + // now get all the endpoint devices and put them in groups by transport + + var enumeratedDevices = AppState.Current.MidiEndpointDeviceWatcher.EnumeratedEndpointDevices; + + foreach (var endpointDevice in enumeratedDevices.Values) + { + if (endpointDevice != null) + { + // Get the transport + + var transportInfo = endpointDevice.GetTransportSuppliedInfo(); + var transportId = transportInfo.TransportId; + + var parentTransport = tempCollection.Where(x => x.Transport.Id == transportId).FirstOrDefault(); + + // add this device to the transport's collection + if (parentTransport != null) + { + parentTransport.EndpointDevices.Add(new MidiEndpointDeviceListItem(endpointDevice)); + } + } + } + + + // Only show relevant transports. Either they have children, or support + // creating a runtime through the settings application + + MidiEndpointDevicesByTransport.Clear(); + + foreach (var item in tempCollection.OrderBy(x => x.Transport.Name)) + { + // TODO: this is a hack. Probably shouldn't be using the transport code directly + // Instead, need a transport property for purpose like we have with endpoints + if (item.Transport.TransportCode == "DIAG") + { + if (showDiagnosticsEndpoints) + { + MidiEndpointDevicesByTransport.Add(item); + } + } + else if (item.EndpointDevices.Count > 0 || item.Transport.IsRuntimeCreatableBySettings) + { + MidiEndpointDevicesByTransport.Add(item); + } + } + + + System.Diagnostics.Debug.WriteLine("Completed RefreshDeviceCollection"); + + + + }); + + } + + + + public void OnNavigatedFrom() + { + } + + + public void OnNavigatedTo(object parameter) + { + } + } +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Views/DeviceDetailPage.xaml b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/DeviceDetailPage.xaml similarity index 99% rename from src/user-tools/midi-settings/Microsoft.Midi.Settings/Views/DeviceDetailPage.xaml rename to src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/DeviceDetailPage.xaml index f5c0ac49c..55459f558 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Views/DeviceDetailPage.xaml +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Sections/Endpoints/DeviceDetailPage.xaml @@ -45,7 +45,11 @@ Style="{StaticResource PageHeaderStyleDeviceName}" /> - +