Server/Actions/ActionHarmonyCommand.cs
changeset 258 e237c2e33545
parent 257 3f1d16d233dc
child 262 c4749a27966d
     1.1 --- a/Server/Actions/ActionHarmonyCommand.cs	Tue Aug 30 03:07:59 2016 +0200
     1.2 +++ b/Server/Actions/ActionHarmonyCommand.cs	Tue Aug 30 03:45:45 2016 +0200
     1.3 @@ -69,17 +69,12 @@
     1.4          /// <summary>
     1.5          /// 
     1.6          /// </summary>
     1.7 -        protected override void DoExecute()
     1.8 +        protected override async Task DoExecute()
     1.9          {
    1.10 -            //Fire and forget our command
    1.11 -            //TODO: check if the harmony client connection is opened
    1.12              if (Program.HarmonyClient!=null)
    1.13              {
    1.14 -                // Wait synchronously for now until we figure out how we could do async stuff in EAR.
    1.15 -                // TODO: Have an abort option in EAR. For instance we don't want to keep sending Harmony command if one failed.
    1.16 -                Task<bool> task = Program.HarmonyClient.TrySendKeyPressAsync(DeviceId, Command);
    1.17 -                bool result = task.Result; //Synchronously waiting for result
    1.18 -                Trace.WriteLine("ActionHarmonyCommand.DoExecute result: " + result.ToString());
    1.19 +                // Send our command and wait for it async
    1.20 +                await Program.HarmonyClient.TrySendKeyPressAsync(DeviceId, Command);               
    1.21              }
    1.22              else
    1.23              {