Révision 03682d21 SICPA_Connexions/ViewModel/AnimalViewModel.cs

Voir les différences:

SICPA_Connexions/ViewModel/AnimalViewModel.cs
19 19
        #endregion
20 20

  
21 21
        #region Commandes
22
        public ICommand EditionCommand { get; private set; }
22
        public ICommand LectureBLECommand { get; private set; }
23 23
        #endregion
24 24

  
25 25
        #region Propriétés
......
55 55
        #region Constructeurs
56 56
        public AnimalViewModel()
57 57
        {
58
            EditionCommand = new Command(async () => await Edition());
58
           LectureBLECommand = new Command(async () => await LectureBLE(), CheckDeviceConnected);
59 59
        }
60 60
        #endregion
61 61

  
62 62
        #region Méthodes
63
        private async Task Edition()
63
        private async Task LectureBLE()
64 64
        {
65 65
            IsBusy = true;
66
            await Task.Delay(1000);
66
            if (GlobalApplication.GestionnaireBLE.DeviceConnected != null)
67
            {
68
                await GlobalApplication.GestionnaireBLE.LectureTag(GlobalApplication.GestionnaireBLE.DeviceConnected);
69
            }
67 70
            IsBusy = false;
68 71
        }
72

  
73
        private void HandleRetourBleModifiee(object sender, EventArgs e)
74
        {
75
            if (GlobalApplication.GestionnaireBLE != null)
76
            {
77
                NumRfid = GlobalApplication.GestionnaireBLE.RetourBLE;
78
            }
79
        }
80

  
81
        private bool CheckDeviceConnected()
82
        {
83
            return (GlobalApplication.GestionnaireBLE != null && GlobalApplication.GestionnaireBLE.DeviceConnected != null);
84
        }
85

  
86
        public void ActualisePage()
87
        {
88
            ((Command)LectureBLECommand).ChangeCanExecute();
89
            if (GlobalApplication.GestionnaireBLE != null)
90
            {
91
                GlobalApplication.GestionnaireBLE.RetourBlEMofifiee += HandleRetourBleModifiee;
92
            }
93
        }
94

  
69 95
        #endregion
70 96

  
71 97
    }

Formats disponibles : Unified diff