public async void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
        {
            if (args.Files.Count > 0)
            {
                StorageFile file = args.Files[0];
                if (file != null)
                {
                    using (var fileStream = await file.OpenSequentialReadAsync())
                    {
                        try
                        {
                            await App.container.CreateIfNotExistsAsync();

                            var blob = App.container.GetBlockBlobReference(file.Name);
                            await blob.DeleteIfExistsAsync();

                            await blob.UploadFromStreamAsync(fileStream);

                            statusText.Text = DateTime.Now.ToString() + ": Save picture '" + file.Name + "' successfully!\n";
                            refreshListview();
                        }
                        catch (Exception ex)
                        {
                            statusText.Text = (ex.Message + "\n");
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        // Handle the returned files from file picker
        public async void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
        {
            if (args.Files.Count > 0)
            {
                mediaElement.Stop();

                try
                {
                    // Open StorageFile as IRandomAccessStream to be passed to FFmpegInteropMSS
                    StorageFile         file       = args.Files.FirstOrDefault();
                    IRandomAccessStream readStream = await file.OpenAsync(FileAccessMode.Read);

                    // Instantiate FFmpeg object and pass the stream from opened file
                    FFmpegMSS = FFmpegInteropMSS.CreateFFmpegInteropMSSFromStream(readStream, forceDecodeAudio, forceDecodeVideo);
                    MediaStreamSource mss = FFmpegMSS.GetMediaStreamSource();

                    if (mss != null)
                    {
                        // Pass MediaStreamSource to Media Element
                        mediaElement.SetMediaStreamSource(mss);
                    }
                    else
                    {
                        DisplayErrorMessage("Cannot open media");
                    }
                }
                catch (Exception ex)
                {
                    DisplayErrorMessage(ex.Message);
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Implements IFileOpenPickerContinuable. This method is marked async but cannot be awaited
 /// by the caller and does not follow the "Async" naming convention.  It is intended to be
 /// called in a "fire and forget" manner.
 /// </summary>
 /// <param name="args">Contains the file(s) returned by the continuable file picker.</param>
 public async void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
 {
     if (args.Files.Count != 0)
     {
         await LoadImage(args.Files[0]);
     }
 }
Ejemplo n.º 4
0
 public async void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
 {
     if (args.Files.Any() == true)
     {
         _contactModel.Thumbnail = args.Files.First();
         thumbnail.Source        = await Util.LoadImage(args.Files.First());
     }
 }
Ejemplo n.º 5
0
 public void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
 {
     switch (args.ContinuationData["Operation"] as String)
     {
     case "OpenModel":
         Main.continueModelOpening(args.Files);
         break;
     }
 }
Ejemplo n.º 6
0
        public async void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
        {
            // The "args" object contains information about selected file(s).
            if (args.Files.Any())
            {
                var file = args.Files[0];
                //폰트를 설치
                await FontHelper.InstallFont(file);

                //폰트를 리스트에 적용  => 화면이 로딩되면 다시 리스트 Loaded가 발생하여 자동 갱신됨.
                //await FontHelper.InsertFont(FontSource, file);
            }
            //플라이아웃 다시 열기
            IsFlyoutOpen = true;
        }
Ejemplo n.º 7
0
        public void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
        {
            Uri    uri;
            string uriString = args.ContinuationData["uri"] as string;

            if (Uri.TryCreate(uriString, UriKind.Absolute, out uri))
            {
                if (args.Files.Count == 1)
                {
                    UploadSingleFile(uri, args.Files[0]);
                }
                else
                {
                    UploadMultipleFiles(uri, args.Files);
                }
            }
        }
Ejemplo n.º 8
0
 public void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
 {
     try
     {
         if (args.Files.Count == 1)
         {
             SaveSingleFileToLocalFolder(args.Files[0]);
             LoadPhraseList();
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
         Trace.LogStatus(rootPage, ex.Message, NotifyType.ErrorMessage);
     }
 }
Ejemplo n.º 9
0
 // 当协定激活(如文件打开或保存选取器)
 // 返回选取的文件或其他返回值时要执行的代码
 private void Application_ContractActivated(object sender, Windows.ApplicationModel.Activation.IActivatedEventArgs e)
 {
     if (e.Kind == Windows.ApplicationModel.Activation.ActivationKind.PickFileContinuation)
     {
         Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs ca = e as Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs;
         PickFiles.PickedFiles.Clear();
         foreach (var f in ca.Files)
         {
             PickFiles.PickedFiles.Add(f);
         }
     }
 }
Ejemplo n.º 10
0
 public void ContinueFileOpenPicker(Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs args)
 {
     //Pass the continuation args to the PictureChooserTask via the ViewModel
     ((HomeViewModel)ViewModel).ContinueFileOpenPicker(args);
 }