This commit is contained in:
Matthew Leibowitz 2021-07-12 18:44:29 +02:00
Родитель 89fa9a3412
Коммит de7308e6a5
2 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -1,6 +1,5 @@
using System;
using System.Runtime.InteropServices;
using CoreFoundation;
using Foundation;
using ObjCRuntime;
@ -28,7 +27,9 @@ namespace Xamarin.Essentials
try
{
return CFString.FromHandle(computerNameHandle);
#pragma warning disable CS0618 // Type or member is obsolete
return NSString.FromHandle(computerNameHandle);
#pragma warning restore CS0618 // Type or member is obsolete
}
finally
{

Просмотреть файл

@ -232,7 +232,9 @@ namespace Xamarin.Essentials
// we weren't able to work out what was happening, so try and guess
var typeHandle = IOPSGetProvidingPowerSourceType(infoHandle);
if (CFString.FromHandle(typeHandle) == kIOPMBatteryPowerKey)
#pragma warning disable CS0618 // Type or member is obsolete
if (NSString.FromHandle(typeHandle) == kIOPMBatteryPowerKey)
#pragma warning restore CS0618 // Type or member is obsolete
return BatteryState.Discharging;
return BatteryState.NotCharging;
@ -297,7 +299,7 @@ namespace Xamarin.Essentials
{
infoHandle = IOPSCopyPowerSourcesInfo();
var typeHandle = IOPSGetProvidingPowerSourceType(infoHandle);
switch (CFString.FromHandle(typeHandle))
switch (NSString.FromHandle(typeHandle))
{
case kIOPMBatteryPowerKey:
return BatteryPowerSource.Battery;