RobotViewModel.cs 959 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.ComponentModel.Composition;
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. using ELog;
  6. using Microsoft.Practices.Prism.ViewModel;
  7. using ENet;
  8. namespace Modules.Robot
  9. {
  10. [Export(contractType: typeof (RobotViewModel)), PartCreationPolicy(creationPolicy: CreationPolicy.NonShared)]
  11. internal class RobotViewModel : NotificationObject
  12. {
  13. private Host host;
  14. private string logText = "";
  15. public string LogText
  16. {
  17. get
  18. {
  19. return this.logText;
  20. }
  21. set
  22. {
  23. if (this.logText == value)
  24. {
  25. return;
  26. }
  27. this.logText = value;
  28. this.RaisePropertyChanged("LogText");
  29. }
  30. }
  31. public RobotViewModel()
  32. {
  33. Library.Initialize();
  34. Task.Factory.StartNew(() =>
  35. {
  36. });
  37. }
  38. public async Task<Peer> StartClient()
  39. {
  40. }
  41. public void Start()
  42. {
  43. var peer = StartClient().Result;
  44. if (peer.State == PeerState.Connected)
  45. {
  46. Log.Debug("11111111111");
  47. }
  48. }
  49. }
  50. }