Skip to content

Commit

Permalink
Helios Panels - Fix for interactions on template based panels (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
linknetx committed Nov 4, 2021
1 parent 848416c commit f0f9e63
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions Helios/Controls/HeliosPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,11 @@ public override void WriteXml(XmlWriter writer)
writer.WriteEndElement();
}

writer.WriteStartElement("Interaction");
writer.WriteElementString("AllowInteractionFull", AllowInteractionFull.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("AllowInteractionNone", AllowInteractionNone.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("AllowInteractionLegacy", AllowInteractionLegacy.ToString(CultureInfo.InvariantCulture));
writer.WriteEndElement();
}

public override void ReadXml(XmlReader reader)
Expand Down Expand Up @@ -409,13 +411,15 @@ public override void ReadXml(XmlReader reader)
DrawBorder = false;
}

try
if (reader.Name.Equals("Interaction"))
{
reader.ReadStartElement();
AllowInteractionFull = bool.Parse(reader.ReadElementString("AllowInteractionFull"));
AllowInteractionNone = bool.Parse(reader.ReadElementString("AllowInteractionNone"));
AllowInteractionLegacy = bool.Parse(reader.ReadElementString("AllowInteractionLegacy"));
reader.ReadEndElement();
}
catch
else
{
AllowInteractionFull = false;
AllowInteractionNone = false;
Expand Down
10 changes: 5 additions & 5 deletions Helios/Controls/ImageTranslucent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,11 @@ public override void ReadXml(XmlReader reader)
BorderThickness = 0d;
}

try
if (reader.Name.Equals("Interaction"))
{
reader.ReadStartElement("Interaction");
AllowInteraction = bool.Parse(reader.ReadElementString("AllowInteraction"));
}
catch
{
AllowInteraction = false;
reader.ReadEndElement();
}

// Load base after image so size is properly persisted.
Expand All @@ -330,7 +328,9 @@ public override void WriteXml(XmlWriter writer)
writer.WriteElementString("Color", colorConverter.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, BorderColor));
writer.WriteEndElement();
}
writer.WriteStartElement("Interaction");
writer.WriteElementString("AllowInteraction", AllowInteraction.ToString(CultureInfo.InvariantCulture));
writer.WriteEndElement();

// Save base after image so size is properly persisted.
base.WriteXml(writer);
Expand Down
2 changes: 1 addition & 1 deletion Helios/Templates/Base/Panels/Empty Panel.htpl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<ControlTemplate><Name>Empty Panel</Name><Category>Panels</Category><TypeIdentifier>Helios.Panel</TypeIdentifier><Template><TemplateValues><Location>0,0</Location><Size>300,300</Size><Hidden>False</Hidden><Background /></TemplateValues></Template></ControlTemplate>
<ControlTemplate><Name>Empty Panel</Name><Category>Panels</Category><TypeIdentifier>Helios.Panel</TypeIdentifier><Template><TemplateValues><Location>0,0</Location><Size>300,300</Size><Hidden>False</Hidden><Background /><Interaction><AllowInteractionFull>False</AllowInteractionFull><AllowInteractionNone>True</AllowInteractionNone><AllowInteractionLegacy>False</AllowInteractionLegacy></Interaction></TemplateValues></Template></ControlTemplate>
2 changes: 1 addition & 1 deletion Helios/Templates/Base/Panels/Generic Backplate.htpl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<ControlTemplate><Name>Generic Backplate</Name><Category>Panels</Category><TypeIdentifier>Helios.Panel</TypeIdentifier><Template><TemplateValues><Location>687,19</Location><Size>300,300</Size><Hidden>False</Hidden><Background><Color>#FF1E1E1E</Color><Image /></Background><Border><TopLeftCorner>{Helios}/Images/Panels/panel-backplate-top-left.png</TopLeftCorner><TopBorder>{Helios}/Images/Panels/panel-top.png</TopBorder><TopRightCorner>{Helios}/Images/Panels/panel-backplate-top-right.png</TopRightCorner><RightBorder>{Helios}/Images/Panels/panel-right.png</RightBorder><BottomRightCorner>{Helios}/Images/Panels/panel-backplate-bottom-right.png</BottomRightCorner><BottomBorder>{Helios}/Images/Panels/panel-bottom.png</BottomBorder><BottomLeftCorner>{Helios}/Images/Panels/panel-backplate-bottom-left.png</BottomLeftCorner><LeftBorder>{Helios}/Images/Panels/panel-left.png</LeftBorder></Border></TemplateValues></Template></ControlTemplate>
<ControlTemplate><Name>Generic Backplate</Name><Category>Panels</Category><TypeIdentifier>Helios.Panel</TypeIdentifier><Template><TemplateValues><Location>687,19</Location><Size>300,300</Size><Hidden>False</Hidden><Background><Color>#FF1E1E1E</Color><Image /></Background><Border><TopLeftCorner>{Helios}/Images/Panels/panel-backplate-top-left.png</TopLeftCorner><TopBorder>{Helios}/Images/Panels/panel-top.png</TopBorder><TopRightCorner>{Helios}/Images/Panels/panel-backplate-top-right.png</TopRightCorner><RightBorder>{Helios}/Images/Panels/panel-right.png</RightBorder><BottomRightCorner>{Helios}/Images/Panels/panel-backplate-bottom-right.png</BottomRightCorner><BottomBorder>{Helios}/Images/Panels/panel-bottom.png</BottomBorder><BottomLeftCorner>{Helios}/Images/Panels/panel-backplate-bottom-left.png</BottomLeftCorner><LeftBorder>{Helios}/Images/Panels/panel-left.png</LeftBorder></Border><Interaction><AllowInteractionFull>False</AllowInteractionFull><AllowInteractionNone>True</AllowInteractionNone><AllowInteractionLegacy>False</AllowInteractionLegacy></Interaction></TemplateValues></Template></ControlTemplate>
2 changes: 1 addition & 1 deletion Helios/Templates/Base/Panels/Generic Screws.htpl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<ControlTemplate><Name>Generic Screws</Name><Category>Panels</Category><TypeIdentifier>Helios.Panel</TypeIdentifier><Template><TemplateValues><Location>364,19</Location><Size>300,300</Size><Hidden>False</Hidden><Background><Color>#FF1E1E1E</Color><Image /></Background><Border><TopLeftCorner>{Helios}/Images/Panels/panel-screws-top-left.png</TopLeftCorner><TopBorder>{Helios}/Images/Panels/panel-top.png</TopBorder><TopRightCorner>{Helios}/Images/Panels/panel-screws-top-right.png</TopRightCorner><RightBorder>{Helios}/Images/Panels/panel-right.png</RightBorder><BottomRightCorner>{Helios}/Images/Panels/panel-screws-bottom-right.png</BottomRightCorner><BottomBorder>{Helios}/Images/Panels/panel-bottom.png</BottomBorder><BottomLeftCorner>{Helios}/Images/Panels/panel-screws-bottom-left.png</BottomLeftCorner><LeftBorder>{Helios}/Images/Panels/panel-left.png</LeftBorder></Border></TemplateValues></Template></ControlTemplate>
<ControlTemplate><Name>Generic Screws</Name><Category>Panels</Category><TypeIdentifier>Helios.Panel</TypeIdentifier><Template><TemplateValues><Location>364,19</Location><Size>300,300</Size><Hidden>False</Hidden><Background><Color>#FF1E1E1E</Color><Image /></Background><Border><TopLeftCorner>{Helios}/Images/Panels/panel-screws-top-left.png</TopLeftCorner><TopBorder>{Helios}/Images/Panels/panel-top.png</TopBorder><TopRightCorner>{Helios}/Images/Panels/panel-screws-top-right.png</TopRightCorner><RightBorder>{Helios}/Images/Panels/panel-right.png</RightBorder><BottomRightCorner>{Helios}/Images/Panels/panel-screws-bottom-right.png</BottomRightCorner><BottomBorder>{Helios}/Images/Panels/panel-bottom.png</BottomBorder><BottomLeftCorner>{Helios}/Images/Panels/panel-screws-bottom-left.png</BottomLeftCorner><LeftBorder>{Helios}/Images/Panels/panel-left.png</LeftBorder></Border><Interaction><AllowInteractionFull>False</AllowInteractionFull><AllowInteractionNone>True</AllowInteractionNone><AllowInteractionLegacy>False</AllowInteractionLegacy></Interaction></TemplateValues></Template></ControlTemplate>

0 comments on commit f0f9e63

Please sign in to comment.