Merge remote-tracking branch 'origin/patch-3' into patch-2
This commit is contained in:
Коммит
e62536aa62
|
@ -64,6 +64,14 @@ namespace Avalonia.MusicStore.ViewModels
|
|||
get => _cover;
|
||||
private set => this.RaiseAndSetIfChanged(ref _cover, value);
|
||||
}
|
||||
|
||||
public async Task LoadCover()
|
||||
{
|
||||
await using (var imageStream = await _album.LoadCoverBitmapAsync())
|
||||
{
|
||||
Cover = await Task.Run(() => Bitmap.DecodeToWidth(imageStream, 400));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
@ -18,7 +18,7 @@ public ReactiveCommand<Unit, AlbumViewModel?> BuyMusicCommand { get; }
|
|||
|
||||
Note we are using `ReactiveCommand` this is where we are using ReactiveUI to provide some of the plumbing for us. Avalonia expects commands to be of type `ICommand` and `ReactiveCommand` implements this interface.
|
||||
|
||||
Note that `ReactiveCommand<TParam, TResult>` has some type arguments. Commands can take a parameter, however we do not need a paramter in this case, so we use `Unit` which is kind of a dummy type, it contains no data. Reactive Commands can also return a result. This sill be useful for returning the Album the user wants to buy.
|
||||
Note that `ReactiveCommand<TParam, TResult>` has some type arguments. Commands can take a parameter, however we do not need a paramter in this case, so we use `Unit` which is kind of a dummy type, it contains no data. Reactive Commands can also return a result. This will be useful for returning the Album the user wants to buy.
|
||||
|
||||
Now add a constructor to `MusicStoreViewModel` where we can instantiate the command, and implement the code needed to return a result from the dialog.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче