[fxcop] image resizer ui (#6841)

* adjustments

* Settings fixed

* Getting resizing tests operational again

* fixed default vs loading from settings

* one small tewak
This commit is contained in:
Clint Rutkas
2020-10-01 11:33:23 -07:00
committed by GitHub
parent 19b519638f
commit c219fe0d1d
21 changed files with 141 additions and 112 deletions

View File

@@ -15,7 +15,7 @@ namespace ImageResizer.Views
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> AdvancedViewModel.EncoderMap.TryGetValue((Guid)value, out var result)
? result
: value.ToString();
: value?.ToString();
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();

View File

@@ -15,12 +15,12 @@ namespace ImageResizer.Views
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var type = value.GetType();
var type = value?.GetType();
var builder = new StringBuilder();
builder
.Append(type.Name)
.Append("_")
.Append('_')
.Append(Enum.GetName(type, value));
var toLower = false;
@@ -31,15 +31,15 @@ namespace ImageResizer.Views
else if (parameter != null)
{
builder
.Append("_")
.Append('_')
.Append(parameter);
}
var targetValue = Resources.ResourceManager.GetString(builder.ToString());
var targetValue = Resources.ResourceManager.GetString(builder.ToString(), culture);
if (toLower)
{
targetValue = targetValue.ToLower();
targetValue = targetValue.ToLower(culture);
}
return targetValue;

View File

@@ -39,8 +39,7 @@ namespace ImageResizer.Views
return openFileDialog.FileNames;
}
public void ShowAdvanced(AdvancedViewModel viewModel)
=> viewModel.Close(new AdvancedWindow(viewModel).ShowDialog() == true);
public void ShowAdvanced(AdvancedViewModel viewModel) => viewModel?.Close(new AdvancedWindow(viewModel).ShowDialog() == true);
void IMainView.Close()
=> Dispatcher.Invoke((Action)Close);

View File

@@ -15,7 +15,7 @@ namespace ImageResizer.Views
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var output = Resources.ResourceManager.GetString(Enum.GetName(typeof(ResizeUnit), value));
var output = Resources.ResourceManager.GetString(Enum.GetName(typeof(ResizeUnit), value), culture);
if ((string)parameter == "ToLower")
{

View File

@@ -15,7 +15,8 @@ namespace ImageResizer.Views
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> Resources.ResourceManager.GetString(
"TiffCompressOption_" + Enum.GetName(typeof(TiffCompressOption), value));
"TiffCompressOption_" + Enum.GetName(typeof(TiffCompressOption), value),
culture);
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();

View File

@@ -36,7 +36,7 @@ namespace ImageResizer.Views
return string.Format(
culture,
Resources.ResourceManager.GetString(builder.ToString()),
Resources.ResourceManager.GetString(builder.ToString(), culture),
timeRemaining.Hours,
timeRemaining.Minutes,
timeRemaining.Seconds);