-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of SharedViewModel, and make VMs work with a DeviceViewModel …
…and ILogger instead
- Loading branch information
Showing
13 changed files
with
128 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2020 Jon Skeet. All rights reserved. | ||
// Use of this source code is governed by the Apache License 2.0, | ||
// as found in the LICENSE.txt file. | ||
|
||
using Microsoft.Extensions.Logging; | ||
using System.Threading.Tasks; | ||
using VDrumExplorer.Midi; | ||
using VDrumExplorer.Model; | ||
|
||
namespace VDrumExplorer.ViewModel | ||
{ | ||
public sealed class DeviceViewModel : ViewModelBase | ||
{ | ||
private ModuleSchema? connectedDeviceSchema; | ||
public ModuleSchema? ConnectedDeviceSchema | ||
{ | ||
get => connectedDeviceSchema; | ||
set => SetProperty(ref connectedDeviceSchema, value); | ||
} | ||
|
||
private RolandMidiClient? connectedDevice; | ||
public RolandMidiClient? ConnectedDevice | ||
{ | ||
get => connectedDevice; | ||
set | ||
{ | ||
if (SetProperty(ref connectedDevice, value)) | ||
{ | ||
RaisePropertyChanged(nameof(DeviceConnected)); | ||
} | ||
} | ||
} | ||
|
||
public bool DeviceConnected => connectedDevice is object; | ||
|
||
public async Task DetectModule(ILogger logger) | ||
{ | ||
ConnectedDevice = await MidiDevices.DetectSingleRolandMidiClientAsync(logger, ModuleSchema.KnownSchemas.Keys); | ||
ConnectedDeviceSchema = ConnectedDevice is null ? null : ModuleSchema.KnownSchemas[ConnectedDevice.Identifier].Value; | ||
RaisePropertyChanged(nameof(ConnectedDevice)); | ||
RaisePropertyChanged(nameof(ConnectedDeviceSchema)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.