sharee.bike-App/TINK/TINK.UWP/Device/WinPhoneDevice .cs
2021-05-13 20:16:41 +02:00

33 lines
966 B
C#

using System;
using TINK.Model.Device;
using TINK.UWP.Device;
using Windows.System.Profile;
using Windows.UI.Xaml;
[assembly: Xamarin.Forms.Dependency(typeof(WinPhoneDevice))]
namespace TINK.UWP.Device
{
public class WinPhoneDevice : IDevice
{
/// <summary> Gets unitque device identifier. </summary>
/// <returns>Gets the identifies specifying device.</returns>
public string GetIdentifier()
{
var token = HardwareIdentification.GetPackageSpecificToken(null);
var hardwareId = token.Id;
var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
byte[] bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);
return BitConverter.ToString(bytes);
}
/// <summary> Close the application. </summary>
public void CloseApplication()
{
Application.Current.Exit();
}
}
}