Пример #1
0
        public async Task LoadProject(CompoProject project)
        {
            _project = project;
            CalculateFit();
            await RefreshImage();

            if (project == null)
            {
                _frames.Clear();
            }
            else
            {
                _frames.Clear();
                foreach (var frame in project.Frames)
                {
                    var frameModel = new CompoFrameViewModel();
                    await frameModel.LoadFrame(frame, _pixelsPerInch);

                    _frames.Add(frameModel);
                }
            }
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("ImageFilePath"));
                PropertyChanged(this, new PropertyChangedEventArgs("Image"));
                PropertyChanged(this, new PropertyChangedEventArgs("Frames"));
            }
        }
Пример #2
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var myArgs = (ImageCapturePageArguments)e.Parameter;

            _project     = myArgs.Project;
            _targetFrame = myArgs.TargetFrame;
            await _mediaCapture.InitializeAsync();

            _imageCapture.Source = _mediaCapture;
            _mediaCapture.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
            _mediaCapture.SetRecordRotation(VideoRotation.Clockwise90Degrees);
            await _mediaCapture.StartPreviewAsync();

            HardwareButtons.BackPressed += (sender, args) => Frame.Navigate(typeof(FramingPage), _project);
        }
Пример #3
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            StorageFile  file;
            CompoProject project;

            if ((file = e.Parameter as StorageFile) != null)
            {
                project = await CompoProject.NewFromImage(file);
            }
            else
            {
                project = e.Parameter as CompoProject;
            }
            if (project != null)
            {
                await _viewModel.LoadProject(project);

                RefreshCanvas();
            }
            HardwareButtons.BackPressed += HandleBackFromOpen;
        }
Пример #4
0
 public ImageCapturePageArguments(CompoProject project, CompoFrame targetFrame)
 {
     _project     = project;
     _targetFrame = targetFrame;
 }