Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,MediaId,MediaTypeId,MediaFormatId,CopyNumber")] MediaCopy mediaCopy)
        {
            if (id != mediaCopy.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mediaCopy);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MediaCopyExists(mediaCopy.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MediaId"]       = new SelectList(_context.Media, "Id", "Author", mediaCopy.MediaId);
            ViewData["MediaFormatId"] = new SelectList(_context.MediaFormat, "Id", "Id", mediaCopy.MediaFormatId);
            ViewData["MediaTypeId"]   = new SelectList(_context.MediaType, "Id", "Id", mediaCopy.MediaTypeId);
            return(View(mediaCopy));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,MediaId,MediaTypeId,MediaFormatId,CopyNumber")] MediaCopy mediaCopy)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mediaCopy);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MediaId"]       = new SelectList(_context.Media, "Id", "Author", mediaCopy.MediaId);
            ViewData["MediaFormatId"] = new SelectList(_context.MediaFormat, "Id", "Id", mediaCopy.MediaFormatId);
            ViewData["MediaTypeId"]   = new SelectList(_context.MediaType, "Id", "Id", mediaCopy.MediaTypeId);
            return(View(mediaCopy));
        }
Пример #3
0
        private async void OnCardChromeHolding(object sender, HoldingRoutedEventArgs e)
        {
            if (e.PointerDeviceType == PointerDeviceType.Touch && e.HoldingState == HoldingState.Started)
            {
                // To create a continuous video playing experience, let's pause it here.
                _mediaElement.Pause();

                // Record the location as we want to resume from here on another device.
                _mediaPlayedPosition = _mediaElement.Position;

                // We don't want to visually move the video player. Instead, we want to create the illusion that
                // a "copy" of it is being dragged down to another device. So here we use RenderTargetBitmap to
                // create such visual.
                var bitmap = new RenderTargetBitmap();
                await bitmap.RenderAsync(Card);

                MediaCopy.Source = bitmap;

                MediaContainer.IsHitTestVisible = false;

                // Create animations to show that a "copy" of the video player is popped up and ready to be dragged up.
                Card.Fade(0.3f).Start();
                MediaCopy
                .Fade(0.7f, 1)
                .Then()
                .Scale(0.975f, 0.975f, (float)Card.ActualWidth / 2, (float)Card.ActualHeight / 2, 300d)
                .Then()
                .Offset(offsetY: -24.0f, duration: 400d)
                .Start();

                // Create an animation that changes the offset of the "copy" based on the manipulation progress.
                _mediaCopyVisual = VisualExtensions.GetVisual(MediaCopy);
                var progressExpressionNode = _progress.GetReference().GetScalarProperty("Progress");
                _mediaCopyVisual.StartAnimation("Offset.Y", progressExpressionNode * -_maxDistance);

                try
                {
                    // Let InteractionTracker to handle the swipe gesture.
                    _interactionSource.TryRedirectForManipulation(_pressedPoint);

                    // Send the card json and media played position over using Remote Sessions API.
                    await RomeShare.SendMediaDataAsync(_cardJson, _mediaPlayedPosition, MediaUrl);
                }
                catch (UnauthorizedAccessException) { }
            }
        }
Пример #4
0
        private async Task ResetMediaCopyAsync()
        {
            CardsHost.IsHitTestVisible = false;

            // Reset the opacity, scale and position of the "copy" and fade in the real video player.
            await MediaCopy
            .Offset(offsetY : 0.0f, duration : 300d)
            .Scale(1.0f, 1.0f, (float)Card.ActualWidth / 2, (float)Card.ActualHeight / 2, 300d)
            .StartAsync();

            MediaCopy.Fade(0.0f, 400d).Start();
            await Card.Fade(1.0f, 400d).StartAsync();

            // Reset the InteractionTracker's position.
            _tracker.TryUpdatePosition(Vector3.Zero);

            CardsHost.IsHitTestVisible      = true;
            MediaContainer.IsHitTestVisible = true;
        }