Skip to content

Commit 305dcd1

Browse files
committed
Minor updates to settings app. Nothing yet complete.
1 parent c7ddc7e commit 305dcd1

File tree

13 files changed

+298
-35
lines changed

13 files changed

+298
-35
lines changed

src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ public App()
109109
services.AddTransient<EndpointsLoopPage>();
110110
services.AddTransient<EndpointsLoopViewModel>();
111111

112+
services.AddTransient<EndpointsDiagPage>();
113+
services.AddTransient<EndpointsDiagViewModel>();
114+
112115

113116
services.AddTransient<DeviceDetailPage>();
114117
services.AddTransient<DeviceDetailViewModel>();

src/user-tools/midi-settings/Microsoft.Midi.Settings/Controls/MidiEndpointDeviceListItemControl.xaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<helpers:HasUniqueIdToInverseVisibilityConverter x:Key="HasUniqueIdToInverseVisibilityConverter" />
1919
<helpers:MidiEndpointNativeDataFormatConverter x:Key="MidiEndpointNativeDataFormatConverter" />
2020
<helpers:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
21-
<helpers:BooleanToEmojiCheckConverter x:Key="BooleanToEmojiCheckConverter" />
21+
<helpers:BooleanToFluentCheckConverter x:Key="BooleanToFluentCheckConverter" />
2222
</ResourceDictionary>
2323
</UserControl.Resources>
2424

@@ -69,31 +69,36 @@
6969
<TextBlock Grid.Row="0" Grid.Column="2"
7070
Text="MIDI 1.0" Style="{StaticResource SmallPropertyLabel}" Margin="21,3,3,3"/>
7171
<TextBlock Grid.Row="0" Grid.Column="3"
72-
Text="{x:Bind EndpointItem.SupportsMidi10Protocol, Mode=OneTime, Converter={StaticResource BooleanToEmojiCheckConverter}}"
72+
Text="{x:Bind EndpointItem.SupportsMidi10Protocol, Mode=OneTime, Converter={StaticResource BooleanToFluentCheckConverter}}"
73+
FontFamily="{StaticResource SymbolThemeFontFamily}"
7374
Style="{StaticResource SmallEmphasizedPropertyValue}"/>
7475

7576
<TextBlock Grid.Row="1" Grid.Column="2"
7677
Text="MIDI 2.0" Style="{StaticResource SmallPropertyLabel}" Margin="21,3,3,3"/>
7778
<TextBlock Grid.Row="1" Grid.Column="3"
78-
Text="{x:Bind EndpointItem.SupportsMidi20Protocol, Mode=OneTime, Converter={StaticResource BooleanToEmojiCheckConverter}}"
79+
Text="{x:Bind EndpointItem.SupportsMidi20Protocol, Mode=OneTime, Converter={StaticResource BooleanToFluentCheckConverter}}"
80+
FontFamily="{StaticResource SymbolThemeFontFamily}"
7981
Style="{StaticResource SmallEmphasizedPropertyValue}"/>
8082

8183

8284
<TextBlock Grid.Row="0" Grid.Column="4"
8385
Text="Unique Id?" Style="{StaticResource SmallPropertyLabel}" Margin="21,3,3,3"/>
8486
<TextBlock Grid.Row="0" Grid.Column="5"
85-
Text="☑️"
87+
Text="&#xf16c;"
88+
FontFamily="{StaticResource SymbolThemeFontFamily}"
8689
Visibility="{x:Bind EndpointItem.TransportSuppliedSerialNumber, Mode=OneTime, Converter={StaticResource HasUniqueIdToVisibilityConverter}}"
8790
Style="{StaticResource SmallEmphasizedPropertyValue}"/>
8891
<TextBlock Grid.Row="0" Grid.Column="5"
89-
Text=""
92+
Text="&#xf16b;"
93+
FontFamily="{StaticResource SymbolThemeFontFamily}"
9094
Visibility="{x:Bind EndpointItem.TransportSuppliedSerialNumber, Mode=OneTime, Converter={StaticResource HasUniqueIdToInverseVisibilityConverter}}"
9195
Style="{StaticResource SmallEmphasizedPropertyValue}"/>
9296

9397
<TextBlock Grid.Row="1" Grid.Column="4"
9498
Text="Multi-client" Style="{StaticResource SmallPropertyLabel}" Margin="21,3,3,3"/>
9599
<TextBlock Grid.Row="1" Grid.Column="5"
96-
Text="{x:Bind EndpointItem.SupportsMultiClient, Mode=OneTime, Converter={StaticResource BooleanToEmojiCheckConverter}}"
100+
Text="{x:Bind EndpointItem.SupportsMultiClient, Mode=OneTime, Converter={StaticResource BooleanToFluentCheckConverter}}"
101+
FontFamily="{StaticResource SymbolThemeFontFamily}"
97102
Style="{StaticResource SmallEmphasizedPropertyValue}"/>
98103

99104
</Grid>

src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/BooleanToEmojiCheckConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public object Convert(object value, Type targetType, object parameter, string la
2121
return "❌";
2222
}
2323

24-
throw new ArgumentException("BooleanToVisibilityConverter object must be a bool");
24+
throw new ArgumentException("BooleanToEmojiCheckConverter object must be a bool");
2525
}
2626

2727
public object? ConvertBack(object value, Type targetType, object parameter, string language)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Microsoft.UI.Xaml;
2+
using Microsoft.UI.Xaml.Data;
3+
4+
namespace Microsoft.Midi.Settings.Helpers;
5+
6+
public partial class BooleanToFluentCheckConverter : IValueConverter
7+
{
8+
public BooleanToFluentCheckConverter()
9+
{
10+
}
11+
12+
public object Convert(object value, Type targetType, object parameter, string language)
13+
{
14+
if (value is bool val)
15+
{
16+
if (val)
17+
{
18+
return "\uf16c";
19+
}
20+
21+
return "\uf16b";
22+
}
23+
24+
throw new ArgumentException("BooleanToFluentCheckConverter object must be a bool");
25+
}
26+
27+
public object? ConvertBack(object value, Type targetType, object parameter, string language)
28+
{
29+
return null;
30+
}
31+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<Page
2+
x:Class="Microsoft.Midi.Settings.Views.EndpointsDiagPage"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:views="using:Microsoft.Midi.Settings.Views"
6+
xmlns:local="using:Microsoft.Midi.Settings.ViewModels"
7+
xmlns:midi2="using:Microsoft.Windows.Devices.Midi2"
8+
xmlns:helpers="using:Microsoft.Midi.Settings.Helpers"
9+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
10+
xmlns:midicontrols="using:Microsoft.Midi.Settings.Controls"
11+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
12+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
13+
mc:Ignorable="d"
14+
>
15+
16+
<Page.Resources>
17+
<ResourceDictionary>
18+
<helpers:HasUniqueIdToVisibilityConverter x:Key="HasUniqueIdToVisibilityConverter" />
19+
<helpers:HasUniqueIdToInverseVisibilityConverter x:Key="HasUniqueIdToInverseVisibilityConverter" />
20+
<helpers:MidiEndpointNativeDataFormatConverter x:Key="MidiEndpointNativeDataFormatConverter" />
21+
<helpers:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
22+
<helpers:BooleanToEmojiCheckConverter x:Key="BooleanToEmojiCheckConverter" />
23+
</ResourceDictionary>
24+
</Page.Resources>
25+
26+
<Grid x:Name="ContentArea">
27+
<Grid.RowDefinitions>
28+
<RowDefinition Height="Auto" />
29+
<RowDefinition Height="*" />
30+
</Grid.RowDefinitions>
31+
32+
<TextBlock Grid.Row="0" x:Uid="DevicesPage_Description" Margin="0,0,0,8" />
33+
34+
<ScrollViewer Grid.Row="1">
35+
<StackPanel Margin="0,0,8,0" HorizontalAlignment="Stretch">
36+
37+
<!-- Transport -->
38+
39+
40+
<!-- If this transport supports runtime creation, have create button at this level -->
41+
42+
43+
<TextBlock Text="{x:Bind ViewModel.Transport.Name, Mode=OneWay}" Style="{StaticResource SmallEmphasizedPropertyValue}"/>
44+
<TextBlock Text="{x:Bind ViewModel.Transport.Description, Mode=OneWay}" Style="{StaticResource SmallPlainPropertyValue}"/>
45+
46+
47+
<ItemsControl ItemsSource="{x:Bind ViewModel.MidiEndpointDevices}">
48+
<ItemsControl.ItemTemplate>
49+
<DataTemplate x:DataType="local:MidiEndpointDeviceListItem">
50+
<midicontrols:MidiEndpointDeviceListItemControl EndpointItem="{x:Bind}"
51+
Loaded="MidiEndpointDeviceListItemControl_Loaded"
52+
Margin="3"/>
53+
</DataTemplate>
54+
55+
</ItemsControl.ItemTemplate>
56+
57+
</ItemsControl>
58+
59+
</StackPanel>
60+
61+
</ScrollViewer>
62+
63+
</Grid>
64+
65+
</Page>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.Foundation;
7+
using Windows.Foundation.Collections;
8+
using Microsoft.UI.Xaml;
9+
using Microsoft.UI.Xaml.Controls;
10+
using Microsoft.UI.Xaml.Controls.Primitives;
11+
using Microsoft.UI.Xaml.Data;
12+
using Microsoft.UI.Xaml.Input;
13+
using Microsoft.UI.Xaml.Media;
14+
using Microsoft.UI.Xaml.Navigation;
15+
using Microsoft.Midi.Settings.Contracts.Services;
16+
using Microsoft.Midi.Settings.Controls;
17+
using Microsoft.Midi.Settings.ViewModels;
18+
19+
// To learn more about WinUI, the WinUI project structure,
20+
// and more about our project templates, see: http://aka.ms/winui-project-info.
21+
22+
namespace Microsoft.Midi.Settings.Views
23+
{
24+
/// <summary>
25+
/// An empty page that can be used on its own or navigated to within a Frame.
26+
/// </summary>
27+
public sealed partial class EndpointsDiagPage : Page
28+
{
29+
private ILoggingService _loggingService;
30+
31+
32+
public EndpointsDiagViewModel ViewModel
33+
{
34+
get;
35+
}
36+
37+
38+
public EndpointsDiagPage()
39+
{
40+
ViewModel = App.GetService<EndpointsDiagViewModel>();
41+
_loggingService = App.GetService<ILoggingService>();
42+
43+
Loaded += DevicesPage_Loaded;
44+
45+
InitializeComponent();
46+
}
47+
48+
private void DevicesPage_Loaded(object sender, RoutedEventArgs e)
49+
{
50+
ViewModel.DispatcherQueue = this.DispatcherQueue;
51+
52+
ViewModel.RefreshDeviceCollection();
53+
}
54+
55+
56+
// work around WinUI binding bug
57+
private void MidiEndpointDeviceListItemControl_Loaded(object sender, RoutedEventArgs e)
58+
{
59+
((MidiEndpointDeviceListItemControl)sender).ViewDeviceDetailsCommand = ViewModel.ViewDeviceDetailsCommand;
60+
}
61+
}
62+
}
63+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using CommunityToolkit.Mvvm.ComponentModel;
2+
using CommunityToolkit.Mvvm.Input;
3+
using Microsoft.Midi.Settings.Contracts.Services;
4+
using Microsoft.Midi.Settings.Contracts.ViewModels;
5+
using Microsoft.Midi.Settings.Models;
6+
using Microsoft.Midi.Settings.Services;
7+
using Microsoft.UI.Dispatching;
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Collections.ObjectModel;
11+
using System.Linq;
12+
using System.Text;
13+
using System.Threading.Tasks;
14+
using System.Windows.Input;
15+
16+
namespace Microsoft.Midi.Settings.ViewModels
17+
{
18+
public partial class EndpointsDiagViewModel : SingleTransportEndpointViewModelBase, INavigationAware
19+
{
20+
public EndpointsDiagViewModel(INavigationService navigationService) : base("DIAG", navigationService)
21+
{
22+
}
23+
24+
}
25+
}

src/user-tools/midi-settings/Microsoft.Midi.Settings/Services/PageService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public PageService()
2121
Configure<EndpointsLoopViewModel, EndpointsLoopPage>();
2222
Configure<EndpointsNet2UdpViewModel, EndpointsNet2UdpPage>();
2323

24+
Configure<EndpointsDiagViewModel, EndpointsDiagPage>();
25+
2426

2527
Configure<DeviceDetailViewModel, DeviceDetailPage>();
2628
Configure<RoutesViewModel, RoutesPage>();

src/user-tools/midi-settings/Microsoft.Midi.Settings/Strings/en-us/Resources.resw

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,37 @@
378378
<data name="DeviceDetailPage_ParentDeviceExpander.Description" xml:space="preserve">
379379
<value>Devices may have more than one MIDI Endpoint. This is the parent device for this endpoint.</value>
380380
</data>
381+
<data name="Shell_EndpointsDiagnostic.Content" xml:space="preserve">
382+
<value>Diagnostic</value>
383+
</data>
384+
<data name="CommonTasks_SetServiceAutoStart.Text" xml:space="preserve">
385+
<value>Set MIDI Service to auto-start at boot (requires Administrator account)</value>
386+
</data>
387+
<data name="CommonTasks_AssignMidi1DeviceToNewDriver.Text" xml:space="preserve">
388+
<value>Set a USB MIDI 1.0 device to use the new fast UMP MIDI 2.0 driver (requires Administrator account)</value>
389+
</data>
390+
<data name="CommonTasks_CreateLoopbackEndpoints.Text" xml:space="preserve">
391+
<value>Create a loopback endpoint so two or more applications can communicate using MIDI messages</value>
392+
</data>
393+
<data name="CommonTasks_SendSysExFile.Text" xml:space="preserve">
394+
<value>Send a file of System Exclusive data (patches, firmware, etc.) to an endpoint</value>
395+
</data>
396+
<data name="CommonTasks_CaptureMidiDiag.Text" xml:space="preserve">
397+
<value>Capture MIDI Diagnostics information to a text file for use with technical support</value>
398+
</data>
399+
<data name="CommonTasks_OpenConsole.Text" xml:space="preserve">
400+
<value>Open Windows MIDI Services Console</value>
401+
</data>
402+
<data name="CommonTasks_SetUpNetworkMidi2.Text" xml:space="preserve">
403+
<value>Set up Network MIDI 2.0 to enable MIDI messages to be sent to other devices on your local network.</value>
404+
</data>
405+
<data name="CommonTasksGroup_Endpoints.Text" xml:space="preserve">
406+
<value>Endpoints</value>
407+
</data>
408+
<data name="CommonTasksGroup_ServiceAndDrivers.Text" xml:space="preserve">
409+
<value>Service and Drivers</value>
410+
</data>
411+
<data name="CommonTasksGroup_Other.Text" xml:space="preserve">
412+
<value>Other</value>
413+
</data>
381414
</root>

src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/TextBlock.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@
5252
<Setter Property="TextWrapping" Value="WrapWholeWords" />
5353
</Style>
5454

55+
<Style x:Key="HomeCardItemSeparatorStyle" TargetType="TextBlock">
56+
<Setter Property="VerticalAlignment" Value="Center" />
57+
<Setter Property="FontWeight" Value="Normal" />
58+
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}" />
59+
<Setter Property="Margin" Value="16,6,0,6" />
60+
<Setter Property="TextTrimming" Value="None" />
61+
<Setter Property="TextWrapping" Value="NoWrap" />
62+
<Setter Property="Foreground" Value="CornflowerBlue" />
63+
</Style>
5564

5665

5766
<Style x:Key="SmallPropertyLabel" TargetType="TextBlock">

0 commit comments

Comments
 (0)