Пример #1
0
            public override void Handle(RHost host, Message response)
            {
                response.ExpectArguments(1, 3);
                var firstArg = response[0] as JValue;

                if (firstArg != null && firstArg.Value == null)
                {
                    CompletionSource.TrySetCanceled();
                    return;
                }

                response.ExpectArguments(3);
                var parseStatus = response.GetEnum <RParseStatus>(0, "parseStatus", parseStatusNames);
                var error       = response.GetString(1, "error", allowNull: true);

                REvaluationResult result;

                if (Kind.HasFlag(REvaluationKind.NoResult))
                {
                    result = new REvaluationResult(error, parseStatus);
                }
                else if (Kind.HasFlag(REvaluationKind.RawResult))
                {
                    result = new REvaluationResult(response.Blob, error, parseStatus);
                }
                else
                {
                    result = new REvaluationResult(response[2], error, parseStatus);
                }

                CompletionSource.TrySetResult(result);
            }
Пример #2
0
 protected override void OnDisappearing()
 {
     if (!valueSelected)
     {
         CompletionSource.TrySetCanceled();
     }
     base.OnDisappearing();
 }