コード例 #1
0
ファイル: AppViewModel.cs プロジェクト: fweinaug/countdown
        private void CreateCountdown()
        {
            var viewModel = new EditCountdownViewModel(this)
            {
                Date = DateTime.Today
            };

            navigationService.EditCountdown(viewModel);
        }
コード例 #2
0
ファイル: AppViewModel.cs プロジェクト: fweinaug/countdown
        private void EditCountdown()
        {
            var countdown = selectedCountdown;

            var viewModel = new EditCountdownViewModel(this)
            {
                CountdownId          = countdown.CountdownId,
                Name                 = countdown.Name,
                Date                 = countdown.SelectedDate.Date,
                Time                 = countdown.SelectedDate.TimeOfDay,
                IsRecurrent          = countdown.IsRecurrent,
                ImageData            = countdown.ImageData,
                FinishedNotification = countdown.FinishedNotification,
                PinnedToStart        = countdown.PinnedToStart
            };

            navigationService.EditCountdown(viewModel);
        }
コード例 #3
0
        public async void SelectImage(EditCountdownViewModel viewModel)
        {
            var picker = new FileOpenPicker
            {
                ViewMode = PickerViewMode.Thumbnail,
                SuggestedStartLocation = PickerLocationId.PicturesLibrary
            };

            picker.FileTypeFilter.Add(".jpg");
            picker.FileTypeFilter.Add(".jpeg");
            picker.FileTypeFilter.Add(".png");
            picker.FileTypeFilter.Add(".bmp");

            var file = await picker.PickSingleFileAsync();

            if (file == null)
            {
                return;
            }

            var image = await SelectedImage.FromFile(file);

            if (!image.IsValid)
            {
                return;
            }

            if (image.IsSquare)
            {
                var imageData = await image.AsBytes();

                viewModel.ChangeImage(imageData);
                return;
            }

            var cropViewModel = new CropImageViewModel(viewModel)
            {
                SelectedImage = image
            };

            Frame.Navigate(typeof(CropImagePage), cropViewModel);
        }
コード例 #4
0
 public void EditCountdown(EditCountdownViewModel viewModel)
 {
     Frame.Navigate(typeof(EditCountdownPage), viewModel);
 }
コード例 #5
0
 public CropImageViewModel(EditCountdownViewModel parent)
 {
     this.parent = parent;
 }