mirror of
https://github.com/Maassoft/ColorControl.git
synced 2026-10-21 08:09:49 -05:00
add label to set device config call, add EzAdjust service menu expert button
This commit is contained in:
1 parent
a1a94d27db
commit
f609471fd2
7 files changed
+58
-24
No files matched your search
@@ -18,8 +18,8 @@
|
||||
<PublisherName>Maassoft</PublisherName>
|
||||
<Company>Maassoft</Company>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>5.1.0.0</ApplicationVersion>
|
||||
<Version>5.1.0.0</Version>
|
||||
<ApplicationVersion>5.2.0.0</ApplicationVersion>
|
||||
<Version>5.2.0.0</Version>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>false</BootstrapperEnabled>
|
||||
|
||||
+26
-13
@@ -162,8 +162,9 @@ namespace ColorControl
|
||||
AddInvokableAction("turnScreenOff", new Func<Dictionary<string, object>, bool>(TurnScreenOffAction));
|
||||
AddInvokableAction("turnScreenOn", new Func<Dictionary<string, object>, bool>(TurnScreenOnAction));
|
||||
|
||||
AddInternalPresetAction(new LgPreset("InStart", "com.webos.app.factorywin", new[] { "0", "4", "1", "3" }));
|
||||
AddInternalPresetAction(new LgPreset("Software Update", "com.webos.app.softwareupdate"));
|
||||
AddInternalPresetAction(new LgPreset("InStart", "com.webos.app.factorywin", new[] { "0", "4", "1", "3" }, new { id = "executeFactory", irKey = "inStart" }));
|
||||
AddInternalPresetAction(new LgPreset("EzAdjust", "com.webos.app.factorywin", new[] { "0", "4", "1", "3" }, new { id = "executeFactory", irKey = "ezAdjust" }));
|
||||
AddInternalPresetAction(new LgPreset("Software Update", "com.webos.app.softwareupdate", null, new { mode = "user", flagUpdate = true }));
|
||||
|
||||
AddSetDeviceConfigAction("HDMI_1_icon", typeof(HdmiIcon), "HDMI 1 icon");
|
||||
AddSetDeviceConfigAction("HDMI_2_icon", typeof(HdmiIcon), "HDMI 2 icon");
|
||||
@@ -203,7 +204,7 @@ namespace ColorControl
|
||||
MinValue = minValue,
|
||||
MaxValue = maxValue,
|
||||
Category = category,
|
||||
Title = title == null ? name.Substring(0, 1).ToUpper() + name.Substring(1) : title
|
||||
Title = title == null ? Utils.FirstCharUpperCase(name) : title
|
||||
};
|
||||
|
||||
_invokableActions.Add(action);
|
||||
@@ -216,7 +217,7 @@ namespace ColorControl
|
||||
Name = name,
|
||||
Function = new Func<Dictionary<string, object>, bool>(GenericDeviceConfigAction),
|
||||
EnumType = type,
|
||||
Title = title == null ? name.Substring(0, 1).ToUpper() + name.Substring(1) : title
|
||||
Title = title == null ? Utils.FirstCharUpperCase(name) : title
|
||||
};
|
||||
|
||||
_invokableActions.Add(action);
|
||||
@@ -409,15 +410,24 @@ namespace ColorControl
|
||||
{
|
||||
try
|
||||
{
|
||||
dynamic @params = null;
|
||||
if (config.ShowAdvancedActions && preset.appId.Equals("com.webos.app.softwareupdate"))
|
||||
var @params = preset.AppParams;
|
||||
if (@params == null && config.ShowAdvancedActions)
|
||||
{
|
||||
@params = new { mode = "user", flagUpdate = true };
|
||||
}
|
||||
|
||||
if (preset.appId.Equals("com.webos.app.factorywin"))
|
||||
{
|
||||
@params = new { id = "executeFactory", irKey = "inStart" };
|
||||
if (preset.appId.Equals("com.webos.app.softwareupdate"))
|
||||
{
|
||||
@params = new { mode = "user", flagUpdate = true };
|
||||
}
|
||||
else if (preset.appId.Equals("com.webos.app.factorywin"))
|
||||
{
|
||||
if (preset.name.Contains("ezadjust", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@params = new { id = "executeFactory", irKey = "ezAdjust" };
|
||||
}
|
||||
else
|
||||
{
|
||||
@params = new { id = "executeFactory", irKey = "inStart" };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await _lgTvApi.LaunchApp(preset.appId, @params);
|
||||
@@ -827,7 +837,10 @@ namespace ColorControl
|
||||
var id = parameters["name"].ToString().Replace("_icon", string.Empty);
|
||||
var stringValues = parameters["value"] as string[];
|
||||
var value = stringValues[0];
|
||||
var task = _lgTvApi.SetDeviceConfig(id, value);
|
||||
|
||||
var description = Utils.GetDescriptionByEnumName<HdmiIcon>(value);
|
||||
|
||||
var task = _lgTvApi.SetDeviceConfig(id, value, description);
|
||||
Utils.WaitForTask(task);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -9,11 +9,10 @@ namespace ColorControl
|
||||
{
|
||||
public static List<LgApp> LgApps { get; set; }
|
||||
public static List<LgDevice> LgDevices { get; set; }
|
||||
|
||||
|
||||
public string appId { get; set; }
|
||||
public List<string> steps { get; set; }
|
||||
public string DeviceMacAddress { get; set; }
|
||||
public dynamic AppParams { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int X { get; set; }
|
||||
@@ -37,7 +36,7 @@ namespace ColorControl
|
||||
}
|
||||
}
|
||||
|
||||
public LgPreset(string name, string appId, IEnumerable<string> steps = null) : this()
|
||||
public LgPreset(string name, string appId, IEnumerable<string> steps = null, dynamic appParams = null) : this()
|
||||
{
|
||||
this.name = name;
|
||||
this.appId = appId;
|
||||
@@ -45,6 +44,7 @@ namespace ColorControl
|
||||
{
|
||||
this.steps.AddRange(steps);
|
||||
}
|
||||
AppParams = appParams;
|
||||
}
|
||||
|
||||
public LgPreset Clone()
|
||||
|
||||
@@ -1388,7 +1388,8 @@ namespace ColorControl
|
||||
if (preset == null)
|
||||
{
|
||||
var hdrEnabled = _nvService.IsHDREnabled();
|
||||
ditherBitsIndex = (int)(hdrEnabled ? NvDitherBits.Bits8 : NvDitherBits.Bits6);
|
||||
var minBits = _nvService.GetPresets().Where(p => p.HDREnabled == hdrEnabled && p.applyDithering).DefaultIfEmpty().Min(p => p?.ditheringBits);
|
||||
ditherBitsIndex = minBits.HasValue ? (int)minBits.Value : (int)(hdrEnabled ? NvDitherBits.Bits8 : NvDitherBits.Bits6);
|
||||
ditherModeIndex = (int)NvDitherMode.Temporal;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -425,6 +425,25 @@ namespace ColorControl
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static string FirstCharUpperCase(string name)
|
||||
{
|
||||
return name.Substring(0, 1).ToUpper() + name.Substring(1);
|
||||
}
|
||||
|
||||
public static string GetDescriptionByEnumName<T>(string value) where T : IConvertible
|
||||
{
|
||||
string description = null;
|
||||
|
||||
if (Enum.TryParse(typeof(T), value, out var result))
|
||||
{
|
||||
description = (result as IConvertible)?.GetDescription();
|
||||
}
|
||||
|
||||
description = description ?? FirstCharUpperCase(value);
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
public static string GetDescription<T>(this T e) where T : IConvertible
|
||||
{
|
||||
return GetDescription(e.GetType(), e);
|
||||
|
||||
@@ -584,17 +584,17 @@ namespace LgTv
|
||||
await ExecuteRequest(lunauri, @params);
|
||||
}
|
||||
|
||||
public async Task SetDeviceConfig(string id, string label)
|
||||
public async Task SetDeviceConfig(string id, string icon, string label)
|
||||
{
|
||||
var lunauri = "luna://com.webos.service.eim/setDeviceInfo";
|
||||
|
||||
var icon = label + ".png";
|
||||
var iconPng = icon + ".png";
|
||||
|
||||
var @params = new
|
||||
{
|
||||
id = id,
|
||||
//label = label,
|
||||
icon = icon
|
||||
label = label,
|
||||
icon = iconPng
|
||||
};
|
||||
|
||||
await ExecuteRequest(lunauri, @params);
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace LgTv
|
||||
ASPECT_RATIO,
|
||||
RECENT,
|
||||
RECORD,
|
||||
SCREEN_REMOTE
|
||||
SCREEN_REMOTE,
|
||||
MYAPPS
|
||||
}
|
||||
|
||||
public class LgWebOsMouseService : IDisposable
|
||||
|
||||
Reference in new issue
Block a user