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 = "64:E8:33:71:74:11";
  30. Guid service = Guid.Parse("4fafc201-1fb5-459e-8fcc-c5c9c331914b");
  31. Guid characteristic = Guid.Parse("beb5483e-36e1-4688-b7f5-ea07361b26a8");
  32. //String key = "9ffe2145-f6c7-4f84-8908-d7003f237fe5";
  33. try
  34. {
  35. await App.Bluetooth.UnlockDigitalKey(
  36. macaddress,
  37. service,
  38. characteristic,
  39. "1"
  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. }