コード例 #1
0
        /// <summary>
        /// Send pup the given key.
        /// </summary>
        /// <returns>The pup key.</returns>
        /// <param name="keycode">Keycode.</param>
        public async Task <bool> SendPupKey(PopperCommand command)
        {
            if (IsDebugMode)
            {
                Logger.Debug($"Sent Pupper keycode {command}");
                return(true);
            }

            // TODO Move all this into a handler ...
            SendKeyInputRequest request = new SendKeyInputRequest();

            request.command = command;

            var response = await _api.MakeRequest <SendKeyInputRequest, string>(request).ConfigureAwait(false);

            if (response?.Success == true)
            {
                _analytics.TrackPupCommand(command);
                return(true);
            }
            else
            {
                //TODO Error handling???
                Logger.Error($"Error sending pup key {command}, responded with {response?.Code} and {response?.Messsage}");
                _analytics.TrackPupCommand(command, false);
                return(false);
            }
        }
コード例 #2
0
ファイル: AppAnalytics.cs プロジェクト: IainS1986/PinupMobile
 public void TrackPupCommand(PopperCommand key, bool success = true)
 {
     TrackEvent(success ? PupKeySuccessEvent : PupKeyFailedEvent, new Dictionary <string, string>()
     {
         {
             PupKeyProperty, key.ToString()
         }
     });
 }