コード例 #1
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     _frames  = new List <WriteableBitmap>();
     filename = e.Parameter as String;
     FileNameTextBlock.Text = filename;
     ProgressBarHelper.ShowProgressBar("Loading GIF");
     await LoadImage(filename);
 }
コード例 #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            ProgressBarHelper.ShowProgressBar("Processing sequence");

            // The image sources are provided as parameter
            List <IImageProvider> imageProviders = new List <IImageProvider>();

            if (e.Parameter is List <StorageFile> ) // Using list of files as source for sequence
            {
                var files = e.Parameter as List <StorageFile>;
                foreach (StorageFile storageFile in files)
                {
                    imageProviders.Add(new StorageFileImageSource(storageFile));
                }
            }
            else if (e.Parameter is int) // Using bundled resources as source for sequence, list of files is created here
            {
                int sequenceId           = (int)e.Parameter;
                int imageIndex           = 0;
                List <StorageFile> files = new List <StorageFile>();
                try
                {
                    while (true)
                    {
                        var         imageUri = new Uri("ms-appx:///Assets/sequence." + sequenceId + "." + imageIndex + ".jpg");
                        StorageFile file     = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(imageUri);

                        var stream = await file.OpenReadAsync(); // only for checking if file exists

                        stream.Dispose();
                        imageProviders.Add(new StorageFileImageSource(file));
                        imageIndex++;
                    }
                }
                catch (Exception)
                {
                    // Expected FileNotFoundException
                }
            }

            await PrepareImageSequence(imageProviders);

            Canvas.ManipulationMode     = ManipulationModes.TranslateX | ManipulationModes.TranslateY;
            Canvas.ManipulationStarted += ImageElement_ManipulationStarted;
            Canvas.ManipulationDelta   += ImageElement_ManipulationDelta;

            SetControlsEnabled(true);

            AdjustPreviewImageSizeAccordingToLayout();
            RootGrid.SizeChanged += AdjustPreviewImageSizeAccordingToOrientation;

            _animationTimer.Start();

            ProgressBarHelper.HideProgressBar();
        }
コード例 #3
0
 private void StartStopCapture()
 {
     if (!_capturing)
     {
         _capturing = true;
         ProgressBarHelper.ShowProgressBar("Capturing");
         CaptureButton.Icon = new SymbolIcon(Symbol.Stop);
     }
     else
     {
         StopCapture();
     }
 }
コード例 #4
0
        private async void StartStopCapture()
        {
            if (!_recording)
            {
                _recording = true;
                ProgressBarHelper.ShowProgressBar("Capturing");
                await _lowLagPhotoSequenceCapture.StartAsync();

                CaptureButton.Icon = new SymbolIcon(Symbol.Stop);
            }
            else
            {
                StopSequenceCapture();
            }
        }
コード例 #5
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            Stop();
            await _renderTask;

            SetControlsEnabled(false);

            ProgressBarHelper.ShowProgressBar("Saving");

            await Save();

            ProgressBarHelper.HideProgressBar();

            if (Frame.BackStackDepth == 2)
            {
                Frame.BackStack.RemoveAt(1);
            }

            _navigationHelper.GoBack();
        }