Open gragra33 opened 1 year ago
Hi @gragra33
Question if u do not mind. Is there a way to add static instance such as:
/// <summary>
/// Gets the current <see cref="App"/> instance in use
/// </summary>
public new static App Current => (App)Application.Current;
so that we can use it with an easy
IFilesService filesService = App.Current.Services.GetService
instead of DI constructor injection or page injection in Blazor ?
@Pinox Sorry for the late reply as I was not watching the issues for this Microsoft repo.
The IFilesService
interface allows us to abstract the implementation to any implementation. The sample project supports more than one platform as each has a different method of accessing the files.
For your own implementation, there is nothing stopping you from making a bound reference to your implementation in that manny but then you lose the flexibility if you decide to support more than one implementation in the future.
I have ported the Xamarin project to a Blazor project with minimal changes. Project can be found here: gragra33 / MvvmSampleBlazor