Пример #1
0
 /// <summary>
 /// Replies to the launch request sent by the caller.
 /// If the caller application sends the launch request to receive the result, the callee application can return the result back to the caller.
 /// </summary>
 /// <param name="replyRequest">The AppControl in which the results of the callee are contained.</param>
 /// <param name="result">The result code of the launch request.</param>
 /// <example>
 /// <code>
 ///     protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
 ///     {
 ///         ReceivedAppControl control = e.ReceivedAppControl;
 ///         if (control.IsReplyRequest)
 ///         {
 ///             AppControl replyRequest = new AppControl();
 ///             replyRequest.ExtraData.Add("myKey", "I'm replying");
 ///             control.ReplyToLaunchRequest(replyRequest, AppControlReplyResult.Succeeded);
 ///         }
 ///     }
 /// </code>
 /// </example>
 /// <since_tizen> 3 </since_tizen>
 public void ReplyToLaunchRequest(AppControl replyRequest, AppControlReplyResult result)
 {
     if (replyRequest == null)
     {
         throw new ArgumentNullException("replyRequest");
     }
     Interop.AppControl.ErrorCode err = Interop.AppControl.ReplyToLaunchRequest(replyRequest.SafeAppControlHandle, this.SafeAppControlHandle, (int)result);
     if (err != Interop.AppControl.ErrorCode.None)
     {
         throw new InvalidOperationException("Failed to reply. Err = " + err);
     }
 }
Пример #2
0
 /// <summary>
 /// A callback that receives the results of the photo or video taken by the camera
 /// Extract file location from result object, convert it to MediaFile, and save it as Result of Task
 /// </summary>
 /// <param name="launchRequest">Appcontrol object sent to run camera</param>
 /// <param name="replyRequest">The appcontrol object received as a result of running the camera</param>
 /// <param name="result">Success of Appcontrol Request</param>
 private void AppControlReplyReceivedCallback(AppControl launchRequest, AppControl replyRequest, AppControlReplyResult result)
 {
     var tcs = Interlocked.Exchange(ref completionSource, null);
     if (result == AppControlReplyResult.Succeeded)
     {
         var file = replyRequest.ExtraData.Get<IEnumerable<string>>(EX_KEY_SELECTED).FirstOrDefault();
         tcs.SetResult(new MediaFile(file, () => File.OpenRead(file)));
     }
     else
     {
         tcs.SetResult(null);
     }
 }
Пример #3
0
 internal ResultEventArgs(ContentCategory category, AppControl result, AppControlReplyResult resultCode)
 {
     _category   = category;
     _result     = result;
     _resultCode = resultCode;
 }
Пример #4
0
 private void OnLaunchResult(AppControl launchRequest, AppControl replyRequest, AppControlReplyResult result)
 {
     Tizen.Log.Info(Tag, $"Result of the request: {result}");
 }