Skip to content

Commit c80e80a

Browse files
authored
Merge pull request #232 from FriendsOfCADability/ShowProperty_FixCS3005
Fix CS3005 for labelText and subEntries
2 parents 2feabec + c6fb726 commit c80e80a

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

CADability/CheckProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private int CheckState
8686
{
8787
MethodInfo mi = propertyInfoSetBool;
8888
object[] prm = new Object[2];
89-
prm[0] = labelText;
89+
prm[0] = labelTextInternal;
9090
if (value == 1) prm[1] = true;
9191
else prm[1] = false;
9292
mi.Invoke(objectWithProperty, prm);
@@ -133,7 +133,7 @@ public override void ButtonClicked(PropertyEntryButton button)
133133
if (cs != 2) cs = 1 - cs;
134134
CheckState = cs;
135135
propertyPage?.Refresh(this);
136-
CheckStateChangedEvent?.Invoke(labelText, (
136+
CheckStateChangedEvent?.Invoke(labelTextInternal, (
137137
CheckState)cs);
138138
}
139139
}

CADability/IShowProperty.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ public class IShowPropertyImpl : IShowProperty, IPropertyEntry
275275
/// Overrides the label text, which is normally retrieved from the <see cref="StringTable"/>
276276
/// with the <see cref="resourceId"/>
277277
/// </summary>
278-
protected string labelText;
278+
protected string labelTextInternal;
279+
279280
/// <summary>
280281
/// The resourceId specifies both the label text and the tooltip text. The label text
281282
/// is loaded from the <see cref="StringTable"/> with the ID resourceId+".Label" the
@@ -423,19 +424,19 @@ public virtual void Select()
423424
}
424425
/// <summary>
425426
/// Implementation of <see cref="IShowProperty.LabelText"/>, returns either
426-
/// <see cref="labelText"/> (if not null) or <see cref="StringTable.GetString"/>(resourceId+".Label")
427-
/// Whe set, <see cref="labelText"/> is set.
427+
/// <see cref="labelTextInternal"/> (if not null) or <see cref="StringTable.GetString"/>(resourceId+".Label")
428+
/// Whe set, <see cref="labelTextInternal"/> is set.
428429
/// </summary>
429430
public virtual string LabelText
430431
{
431432
get
432433
{
433-
if (labelText != null) return labelText;
434+
if (labelTextInternal != null) return labelTextInternal;
434435
return StringTable.GetString(resourceId + ".Label");
435436
}
436437
set
437438
{
438-
labelText = value;
439+
labelTextInternal = value;
439440
}
440441
}
441442
/// <summary>
@@ -805,7 +806,7 @@ protected void PropertyEntryChangedState(StateChangedArgs args)
805806

806807
public virtual IPropertyEntry FindSubItem(string helpResourceID)
807808
{ // also check for LabeText, which would be the name of an item in the list
808-
if (ResourceId == helpResourceID || (string.IsNullOrEmpty(ResourceId) && labelText == helpResourceID)) return this;
809+
if (ResourceId == helpResourceID || (string.IsNullOrEmpty(ResourceId) && labelTextInternal == helpResourceID)) return this;
809810
for (int i = 0; i < SubItems.Length; i++)
810811
{
811812
IPropertyEntry found = SubItems[i].FindSubItem(helpResourceID);
@@ -826,24 +827,24 @@ public class ShowPropertyGroup : PropertyEntryImpl
826827
public ShowPropertyGroup(string resourceId)
827828
{
828829
base.resourceId = resourceId;
829-
subEntries = new IPropertyEntry[0];
830+
subEntriesInternal = new IPropertyEntry[0];
830831
}
831-
protected IPropertyEntry[] subEntries;
832+
protected IPropertyEntry[] subEntriesInternal;
832833
public void ClearSubEntries()
833834
{
834-
subEntries = new IPropertyEntry[0];
835+
subEntriesInternal = new IPropertyEntry[0];
835836
}
836837
public void AddSubEntry(IPropertyEntry ToAdd)
837838
{
838-
ArrayList al = new ArrayList(subEntries);
839+
ArrayList al = new ArrayList(subEntriesInternal);
839840
al.Add(ToAdd);
840-
subEntries = (IPropertyEntry[])al.ToArray(typeof(IPropertyEntry));
841+
subEntriesInternal = (IPropertyEntry[])al.ToArray(typeof(IPropertyEntry));
841842
}
842843
public void AddSubEntries(params IPropertyEntry[] ToAdd)
843844
{
844-
ArrayList al = new ArrayList(subEntries);
845+
ArrayList al = new ArrayList(subEntriesInternal);
845846
al.AddRange(ToAdd);
846-
subEntries = (IPropertyEntry[])al.ToArray(typeof(IPropertyEntry));
847+
subEntriesInternal = (IPropertyEntry[])al.ToArray(typeof(IPropertyEntry));
847848
}
848849
public override PropertyEntryType Flags => PropertyEntryType.GroupTitle | PropertyEntryType.HasSubEntries;
849850
/// <summary>
@@ -854,7 +855,7 @@ public override IPropertyEntry[] SubItems
854855
{
855856
get
856857
{
857-
return subEntries;
858+
return subEntriesInternal;
858859
}
859860
}
860861

CADability/PropertyEntryImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace CADability.UserInterface
88
public abstract class PropertyEntryImpl : IPropertyEntry, IShowProperty
99
{
1010
protected string resourceId;
11-
protected string labelText;
11+
private string labelText;
1212
private IFrame frame;
1313
private readonly IShowPropertyImpl dumy = null; // will never be set. Dummy implementation of IShowProperty
1414

0 commit comments

Comments
 (0)