mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
* adjustments * Settings fixed * Getting resizing tests operational again * fixed default vs loading from settings * one small tewak
49 lines
1.6 KiB
C#
49 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;
|
|
using System.Globalization;
|
|
using System.Text;
|
|
using System.Windows.Data;
|
|
using ImageResizer.Properties;
|
|
|
|
namespace ImageResizer.Views
|
|
{
|
|
[ValueConversion(typeof(TimeSpan), typeof(string))]
|
|
internal class TimeRemainingConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
var timeRemaining = (TimeSpan)value;
|
|
|
|
var builder = new StringBuilder("Progress_TimeRemaining_");
|
|
|
|
if (timeRemaining.Hours != 0)
|
|
{
|
|
builder.Append(timeRemaining.Hours == 1 ? "Hour" : "Hours");
|
|
}
|
|
|
|
if (timeRemaining.Hours != 0 || timeRemaining.Minutes > 0)
|
|
{
|
|
builder.Append(timeRemaining.Minutes == 1 ? "Minute" : "Minutes");
|
|
}
|
|
|
|
if (timeRemaining.Hours == 0)
|
|
{
|
|
builder.Append(timeRemaining.Seconds == 1 ? "Second" : "Seconds");
|
|
}
|
|
|
|
return string.Format(
|
|
culture,
|
|
Resources.ResourceManager.GetString(builder.ToString(), culture),
|
|
timeRemaining.Hours,
|
|
timeRemaining.Minutes,
|
|
timeRemaining.Seconds);
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> throw new NotImplementedException();
|
|
}
|
|
}
|