コード例 #1
0
        public async Task AddCoffeeVideoAsync()
        {
            try
            {
                var dialogData = await _addCoffeeVideoDialogService.ShowDialogAsync();

                if (dialogData.DialogResultIsOk)
                {
                    StartLoading($"Uploading your video {dialogData.BlobName}");

                    var cloudBlockBlob = await _coffeeVideoStorage.UploadVideoAsync(
                        dialogData.BlobByteArray,
                        dialogData.BlobName,
                        dialogData.BlobTitle,
                        dialogData.BlobDescription);

                    var coffeeVideoViewModel = _coffeeVideoViewModelCreator(cloudBlockBlob);
                    CoffeeVideos.Add(coffeeVideoViewModel);
                    SelectedCoffeeVideo = coffeeVideoViewModel;
                }
            }
            catch (Exception ex)
            {
                await _messageDialogService.ShowInfoDialogAsync(ex.Message, "Error");
            }
            finally
            {
                StopLoading();
            }
        }
コード例 #2
0
 public void RemoveCoffeeVideoViewModel(CoffeeVideoViewModel viewModel)
 {
     if (CoffeeVideos.Contains(viewModel))
     {
         CoffeeVideos.Remove(viewModel);
         if (SelectedCoffeeVideo == viewModel)
         {
             SelectedCoffeeVideo = null;
         }
     }
 }
コード例 #3
0
        public async Task ReloadAfterSnapshotPromotionAsync(CoffeeVideoViewModel snapshotViewModel)
        {
            var coffeeVideoViewModel = CoffeeVideos.SingleOrDefault(
                viewModel => viewModel.BlobName == snapshotViewModel.BlobName &&
                !viewModel.IsSnapshot);

            if (coffeeVideoViewModel != null)
            {
                await coffeeVideoViewModel.ReloadMetadataAsync();
            }
        }
コード例 #4
0
        public void RemoveCoffeeVideoViewModel(CoffeeVideoViewModel viewModel)
        {
            if (CoffeeVideos.Contains(viewModel))
            {
                CoffeeVideos.Remove(viewModel);
                if (SelectedCoffeeVideo == viewModel)
                {
                    SelectedCoffeeVideo = null;
                }

                if (!viewModel.IsSnapshot)
                {
                    RemoveSnapshotsOfRemovedVideo(viewModel.BlobName);
                }
            }
        }