mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
* [Image Resizer] Remove old settings * [Image Resizer] Removed unused code * [common interop] remove "ShouldNewSettingsBeUsed()"
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
// Copyright (c) Brice Lambson
|
|
// The Brice Lambson licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
|
|
|
using System.Windows.Input;
|
|
using ImageResizer.Helpers;
|
|
using ImageResizer.Models;
|
|
using ImageResizer.Properties;
|
|
using ImageResizer.Views;
|
|
|
|
namespace ImageResizer.ViewModels
|
|
{
|
|
public class InputViewModel : Observable
|
|
{
|
|
private readonly ResizeBatch _batch;
|
|
private readonly MainViewModel _mainViewModel;
|
|
private readonly IMainView _mainView;
|
|
|
|
public InputViewModel(
|
|
Settings settings,
|
|
MainViewModel mainViewModel,
|
|
IMainView mainView,
|
|
ResizeBatch batch)
|
|
{
|
|
_batch = batch;
|
|
_mainViewModel = mainViewModel;
|
|
_mainView = mainView;
|
|
|
|
Settings = settings;
|
|
if (settings != null)
|
|
{
|
|
settings.CustomSize.PropertyChanged += (sender, e) => settings.SelectedSize = (CustomSize)sender;
|
|
}
|
|
|
|
ResizeCommand = new RelayCommand(Resize);
|
|
CancelCommand = new RelayCommand(Cancel);
|
|
}
|
|
|
|
public Settings Settings { get; }
|
|
|
|
public ICommand ResizeCommand { get; }
|
|
|
|
public ICommand CancelCommand { get; }
|
|
|
|
public void Resize()
|
|
{
|
|
Settings.Save();
|
|
_mainViewModel.CurrentPage = new ProgressViewModel(_batch, _mainViewModel, _mainView);
|
|
}
|
|
|
|
public void Cancel()
|
|
=> _mainView.Close();
|
|
}
|
|
}
|