User/lamotile/add powerrename settings (#1813)

* added powerrename settings

* removed pop-up message

* removed unused files

* revrted changes to old settings

* updated solution file

* added ToJsonString() method

* added JSON property for the powertoy name
This commit is contained in:
Lavius Motileng
2020-04-02 06:08:56 -07:00
parent 3015ffd950
commit 89b44f5126
16 changed files with 346 additions and 125 deletions

View File

@@ -2,70 +2,62 @@
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
/// <summary>
/// This class models the settings for the PowerPreview class.
/// Eaxmple JSON:
/// {
/// "name": "File Explorer Preview",
/// "properties": {
/// "IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL": { "value": true },
/// "PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID": { "value": true }
/// },
/// "version": "1.0"
/// }
/// </summary>
public class PowerPreviewSettings
public class PowerPreviewSettings : BasePTModuleSettings
{
public string name { get; set; }
public Properties properties { get; set; }
public string version { get; set; }
public PowerPreviewProperties properties { get; set; }
public PowerPreviewSettings()
{
this.properties = new Properties();
this.properties = new PowerPreviewProperties();
this.version = "1";
this.name = "_unset_";
}
public PowerPreviewSettings(string ptName)
{
this.properties = new Properties();
this.properties = new PowerPreviewProperties();
this.version = "1";
this.name = ptName;
}
public override string ToString()
public override string ToJsonString()
{
return "{\"" + this.name + "\":" + JsonSerializer.Serialize(this) + "}";
return JsonSerializer.Serialize(this);
}
}
public class Property
public class PowerPreviewProperties
{
public bool value { get; set; }
public BoolProperty IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL { get; set; }
public BoolProperty PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID { get; set; }
public PowerPreviewProperties()
{
this.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL = new BoolProperty();
this.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID = new BoolProperty();
}
public override string ToString()
{
return JsonSerializer.Serialize(this);
}
}
public class Properties
public class SndPowerPreviewSettings
{
public Property IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL { get; set; }
public Property PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID { get; set; }
[JsonPropertyName("File Explorer Preview")]
public PowerPreviewSettings File_Explorer_Preview { get; set; }
public Properties()
public SndPowerPreviewSettings(PowerPreviewSettings settings)
{
this.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL = new Property();
this.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID = new Property();
this.File_Explorer_Preview = settings;
}
public override string ToString()
public string ToJsonString()
{
return JsonSerializer.Serialize(this);
}