Use injetion wher epossible for services
parent
a57b87eeb2
commit
a006599675
|
@ -7,7 +7,7 @@ public partial class Player : ContentView
|
|||
public Player()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.playerService = ServicesProvider.GetService<PlayerService>();
|
||||
this.playerService = this.Handler.MauiContext.Services.GetService<PlayerService>();
|
||||
this.IsVisible = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,15 @@
|
|||
|
||||
public class WifiOptionsService
|
||||
{
|
||||
#if __MACCATALYST__
|
||||
Platforms.MacCatalyst.ConnectivityService connectivity;
|
||||
public WifiOptionsService(Platforms.MacCatalyst.ConnectivityService connectivity) => this.connectivity = connectivity;
|
||||
#endif
|
||||
|
||||
public async Task<bool> HasWifiOrCanPlayWithOutWifiAsync()
|
||||
{
|
||||
|
||||
#if __MACCATALYST__
|
||||
var connectivity = ServicesProvider.GetService<Platforms.MacCatalyst.ConnectivityService>();
|
||||
return await connectivity.IsConnected();
|
||||
#else
|
||||
if (Config.Desktop)
|
||||
|
|
Loading…
Reference in New Issue