Guest User

Untitled

a guest
Jan 21st, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. interface IConnectionService
  2. {
  3. List<TargetDevice> FindDevices();
  4. void Connect(TargetDevice targetDevice);
  5. void Disconnect();
  6. byte[] Read();
  7. void Write(byte[] command);
  8. }
  9.  
  10. public interface IMvxPhoneCallTask
  11. {
  12. void MakePhoneCall(string name, string number);
  13. }
  14.  
  15. protected void MakePhoneCall(string name, string number)
  16. {
  17. var task = this.GetService<IMvxPhoneCallTask>();
  18. task.MakePhoneCall(name, number);
  19. }
  20.  
  21. RegisterServiceType<IMvxPhoneCallTask, MvxPhoneCallTask>();
  22.  
  23. public class MvxPhoneCallTask : MvxWindowsPhoneTask, IMvxPhoneCallTask
  24. {
  25. #region IMvxPhoneCallTask Members
  26.  
  27. public void MakePhoneCall(string name, string number)
  28. {
  29. var pct = new PhoneCallTask {DisplayName = name, PhoneNumber = number};
  30. DoWithInvalidOperationProtection(pct.Show);
  31. }
  32.  
  33. #endregion
  34. }
  35.  
  36. public class MvxPhoneCallTask : MvxAndroidTask, IMvxPhoneCallTask
  37. {
  38. #region IMvxPhoneCallTask Members
  39.  
  40. public void MakePhoneCall(string name, string number)
  41. {
  42. var phoneNumber = PhoneNumberUtils.FormatNumber(number);
  43. var newIntent = new Intent(Intent.ActionDial, Uri.Parse("tel:" + phoneNumber));
  44. StartActivity(newIntent);
  45. }
  46.  
  47.  
  48. #endregion
  49. }
  50.  
  51. public class MvxPhoneCallTask : MvxTouchTask, IMvxPhoneCallTask
  52. {
  53. #region IMvxPhoneCallTask Members
  54.  
  55. public void MakePhoneCall(string name, string number)
  56. {
  57. var url = new NSUrl("tel:" + number);
  58. DoUrlOpen(url);
  59. }
  60.  
  61. #endregion
  62. }
Add Comment
Please, Sign In to add comment