Example #1
0
 internal override void OnCompleted(AsyncActionWithProgressCompletedHandler <TProgress> userCompletionHandler, AsyncStatus asyncStatus)
 {
     Debug.Assert(userCompletionHandler != null);
     userCompletionHandler(this, asyncStatus);
 }
Example #2
0
 public static void TrackAsyncAction(IAsyncActionWithProgress <double> action, AsyncActionWithProgressCompletedHandler <double> completed)
 {
     TrackAsyncAction(action, p => p, completed);
 }
Example #3
0
 public static void TrackAsyncAction <TProgress>(IAsyncActionWithProgress <TProgress> action, Func <TProgress, double> progressConverter, AsyncActionWithProgressCompletedHandler <TProgress> completed)
 {
     DisableView(null);
     action.Completed = (s, e) => root.Dispatcher.Begin(() =>
     {
         EnableView();
         completed(s, e);
     });
     action.Progress = (s, p) => root.Dispatcher.Begin(() => DisableView(progressConverter(p)));
 }
 private static async void TranscodeFile(StorageFile srcFile, StorageFile destFile, AsyncActionWithProgressCompletedHandler<double> action, AsyncActionProgressHandler<double> progress )
 {
     var profile = MediaEncodingProfile.CreateMp3(AudioEncodingQuality.High);
     var transcoder = new MediaTranscoder();
     var prepareOp = await transcoder.PrepareFileTranscodeAsync(srcFile, destFile, profile);
     if (!prepareOp.CanTranscode) return;
     var transcodeOp = prepareOp.TranscodeAsync();
     transcodeOp.Progress += progress;
     transcodeOp.Completed += action;
 }