mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Conditions - Fixed static input border margin
Databinding modifiers - Fixed default parameter values for value types not being set
This commit is contained in:
parent
0f5c2b80c4
commit
f2e21bfe37
@ -109,6 +109,14 @@ namespace Artemis.Core
|
||||
$"it does not support this data binding's type {targetType.Name}");
|
||||
|
||||
ModifierType = modifierType;
|
||||
|
||||
// Ensure the right parameter static value is never null when the parameter type is a value type
|
||||
if (ParameterType == ProfileRightSideType.Static && modifierType.ParameterType != null)
|
||||
{
|
||||
if (modifierType.ParameterType.IsValueType && ParameterStaticValue == null)
|
||||
UpdateParameterStatic(modifierType.ParameterType.GetDefault());
|
||||
}
|
||||
|
||||
ValidateParameter();
|
||||
}
|
||||
|
||||
@ -200,7 +208,7 @@ namespace Artemis.Core
|
||||
ParameterPath = new DataModelPath(null, Entity.ParameterPath);
|
||||
}
|
||||
// Static parameter
|
||||
else if (ParameterType == ProfileRightSideType.Static && Entity.ParameterStaticValue != null && ParameterStaticValue == null)
|
||||
else if (ParameterType == ProfileRightSideType.Static && Entity.ParameterStaticValue != null)
|
||||
{
|
||||
// Use the target type so JSON.NET has a better idea what to do
|
||||
Type parameterType = ModifierType?.ParameterType ?? DirectDataBinding.DataBinding.GetTargetType();
|
||||
@ -217,7 +225,14 @@ namespace Artemis.Core
|
||||
staticValue = Activator.CreateInstance(parameterType);
|
||||
}
|
||||
|
||||
UpdateParameterStatic(staticValue);
|
||||
try
|
||||
{
|
||||
UpdateParameterStatic(staticValue);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DeserializationLogger.LogModifierDeserializationFailure(GetType().Name, new JsonSerializationException("The JSON deserialized into a mismatching type", e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -220,8 +220,7 @@ namespace Artemis.Core.Services
|
||||
Type pluginType = pluginTypes.Single();
|
||||
try
|
||||
{
|
||||
IParameter[] parameters = new IParameter[]
|
||||
{
|
||||
IParameter[] parameters = {
|
||||
new Parameter("PluginInfo", pluginInfo, false)
|
||||
};
|
||||
pluginInfo.Kernel = new ChildKernel(_kernel);
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
Visibility="{Binding InputViewModel, Converter={StaticResource NullToVisibilityConverter}}"
|
||||
CornerRadius="3"
|
||||
Padding="3"
|
||||
Margin="0 -3"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="140">
|
||||
<ContentControl s:View.Model="{Binding InputViewModel}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
|
||||
|
||||
@ -220,8 +220,7 @@ namespace Artemis.UI.Shared.Services
|
||||
if (initialValue != null && initialValue.GetType() != registration.SupportedType)
|
||||
initialValue = Convert.ChangeType(initialValue, registration.SupportedType);
|
||||
|
||||
IParameter[] parameters = new IParameter[]
|
||||
{
|
||||
IParameter[] parameters = {
|
||||
new ConstructorArgument("targetDescription", description),
|
||||
new ConstructorArgument("initialValue", initialValue)
|
||||
};
|
||||
|
||||
@ -28,8 +28,7 @@ namespace Artemis.UI.Shared.Services
|
||||
|
||||
public async Task<bool> ShowConfirmDialog(string header, string text, string confirmText = "Confirm", string cancelText = "Cancel")
|
||||
{
|
||||
IParameter[] arguments = new IParameter[]
|
||||
{
|
||||
IParameter[] arguments = {
|
||||
new ConstructorArgument("header", header),
|
||||
new ConstructorArgument("text", text),
|
||||
new ConstructorArgument("confirmText", confirmText.ToUpper()),
|
||||
@ -41,8 +40,7 @@ namespace Artemis.UI.Shared.Services
|
||||
|
||||
public async Task<bool> ShowConfirmDialogAt(string identifier, string header, string text, string confirmText = "Confirm", string cancelText = "Cancel")
|
||||
{
|
||||
IParameter[] arguments = new IParameter[]
|
||||
{
|
||||
IParameter[] arguments = {
|
||||
new ConstructorArgument("header", header),
|
||||
new ConstructorArgument("text", text),
|
||||
new ConstructorArgument("confirmText", confirmText.ToUpper()),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user