2020-04-26 17:34:03 -07:00
|
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
2020-10-22 09:45:48 -07:00
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Library
|
2020-04-26 17:34:03 -07:00
|
|
|
|
{
|
2020-07-21 14:06:39 -07:00
|
|
|
|
public class ImageResizerSizes
|
2020-04-26 17:34:03 -07:00
|
|
|
|
{
|
2023-12-28 13:37:13 +03:00
|
|
|
|
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
|
|
|
|
|
{
|
|
|
|
|
|
WriteIndented = true,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2020-10-19 13:32:05 -07:00
|
|
|
|
// Suppressing this warning because removing the setter breaks
|
|
|
|
|
|
// deserialization with System.Text.Json. This affects the UI display.
|
|
|
|
|
|
// See: https://github.com/dotnet/runtime/issues/30258
|
2020-04-26 17:34:03 -07:00
|
|
|
|
[JsonPropertyName("value")]
|
|
|
|
|
|
public ObservableCollection<ImageSize> Value { get; set; }
|
|
|
|
|
|
|
2020-07-21 14:06:39 -07:00
|
|
|
|
public ImageResizerSizes()
|
2020-04-26 17:34:03 -07:00
|
|
|
|
{
|
2020-07-21 14:06:39 -07:00
|
|
|
|
Value = new ObservableCollection<ImageSize>();
|
2020-04-26 17:34:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-21 14:06:39 -07:00
|
|
|
|
public ImageResizerSizes(ObservableCollection<ImageSize> value)
|
2020-04-26 17:34:03 -07:00
|
|
|
|
{
|
|
|
|
|
|
Value = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string ToJsonString()
|
|
|
|
|
|
{
|
2023-12-28 13:37:13 +03:00
|
|
|
|
var options = _serializerOptions;
|
2020-04-26 17:34:03 -07:00
|
|
|
|
return JsonSerializer.Serialize(this, options);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|