Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor Sample Project #123

Open
gragra33 opened this issue Jun 15, 2023 · 2 comments
Open

Blazor Sample Project #123

gragra33 opened this issue Jun 15, 2023 · 2 comments

Comments

@gragra33
Copy link

I have ported the Xamarin project to a Blazor project with minimal changes. Project can be found here: gragra33 / MvvmSampleBlazor

@Pinox
Copy link

Pinox commented Jun 26, 2023

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 ?

@gragra33
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants