EquipmentEditNotesView.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Comal.Classes;
  7. using InABox.Core;
  8. using InABox.Mobile;
  9. using Xamarin.Forms;
  10. using Xamarin.Forms.Xaml;
  11. using XF.Material.Forms.UI.Dialogs;
  12. namespace PRS.Mobile
  13. {
  14. [XamlCompilation(XamlCompilationOptions.Compile)]
  15. public partial class EquipmentEditNotesView
  16. {
  17. public EquipmentEditNotesView()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void Refresh()
  22. {
  23. }
  24. private async void DigitalKey_Tapped(object sender, EventArgs args)
  25. {
  26. String error = "";
  27. using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Please Wait..."))
  28. {
  29. String macaddress = "84:CC:A8:2E:95:8A";
  30. Guid service = Guid.Parse("7555408C-9414-EB46-C0AC-A72EB4CD80D8");
  31. Guid characteristic = Guid.Parse("432B917A-EB17-289B-285A-2657419B46C7");
  32. String key = "9ffe2145-f6c7-4f84-8908-d7003f237fe5";
  33. try
  34. {
  35. await App.Bluetooth.UnlockDigitalKey(
  36. macaddress,
  37. service,
  38. characteristic,
  39. key
  40. );
  41. }
  42. catch (Exception e)
  43. {
  44. error = e.Message;
  45. }
  46. }
  47. if (!String.IsNullOrWhiteSpace(error))
  48. await MaterialDialog.Instance.AlertAsync("Error Unlocking Device!", error, "OK");
  49. }
  50. }
  51. }