- add possibility to use midi view

master
Simon G 5 years ago
parent 64eda82e79
commit 5352ce4b12
  1. 4
      Mystify/MainModel.cs
  2. 3
      Mystify/ViewModels/MainWindowViewModel.cs
  3. 3
      Mystify/Views/MainWindow.axaml

@ -31,7 +31,7 @@ namespace Mystify
public List<IControllable>? Controllables => _controllableCollector?.Controllables; public List<IControllable>? Controllables => _controllableCollector?.Controllables;
public string? DeviceName => _device?.Name; public string? DeviceName => _device?.Name;
public void LoadDriverAndDevice(string driverPath) public void LoadDriverAndDevice(string driverPath, bool useMidiView)
{ {
IDriver? driver = _driverLoader.Load(driverPath); IDriver? driver = _driverLoader.Load(driverPath);
@ -41,7 +41,7 @@ namespace Mystify
_device = _deviceFactory.Create(driver); _device = _deviceFactory.Create(driver);
_controllableCollector = _controllableCollectorFactory.Create(); _controllableCollector = _controllableCollectorFactory.Create();
_device.StartCommunication(); _device.StartCommunication(useMidiView);
} }
} }
} }

@ -35,6 +35,7 @@ namespace Mystify.ViewModels
public IChannel? SelectedChannel { get; set; } public IChannel? SelectedChannel { get; set; }
public IControllable? SelectedControllable { get; set; } public IControllable? SelectedControllable { get; set; }
public bool UseMidiView { get; set; }
public string SelectedDeviceText => $"Selected Device: {_mainModel?.DeviceName ?? "-"}"; public string SelectedDeviceText => $"Selected Device: {_mainModel?.DeviceName ?? "-"}";
@ -47,7 +48,7 @@ namespace Mystify.ViewModels
string driverPath = (await openFileDialog.ShowAsync(_mainWindow))[0]; string driverPath = (await openFileDialog.ShowAsync(_mainWindow))[0];
_mainModel?.LoadDriverAndDevice(driverPath); _mainModel?.LoadDriverAndDevice(driverPath, UseMidiView);
RaisePropertyChanged(() => SelectedDeviceText); RaisePropertyChanged(() => SelectedDeviceText);
RaisePropertyChanged(() => Channels); RaisePropertyChanged(() => Channels);

@ -17,7 +17,8 @@
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="10"> <StackPanel Orientation="Horizontal" Margin="10">
<Button Margin="5" Content="Select MIDI Device Driver" Command="{Binding SelectDriverCommand}"/> <Button Margin="5" Content="Select MIDI Device Driver" Command="{Binding SelectDriverCommand}"/>
<TextBlock Text="{Binding SelectedDeviceText}" Margin="20,10"/> <TextBlock Text="{Binding SelectedDeviceText}" Margin="20,12"/>
<CheckBox Margin="20,5" Content="Use MidiView" IsChecked="{Binding UseMidiView}"/>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="10"> <StackPanel Orientation="Horizontal" Margin="10">

Loading…
Cancel
Save