Skip to content

Commit

Permalink
#49
Browse files Browse the repository at this point in the history
Fix compiler warning and move SelectedText to protected property.
  • Loading branch information
dsn27 committed Jan 22, 2025
1 parent 4da4ecc commit b12eac5
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 71 deletions.
6 changes: 3 additions & 3 deletions CADability/BooleanProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ private void Initialize(object ObjectWithProperty, string PropertyName, string r
MethodInfo mi = propertyInfo.GetGetMethod();
object[] prm = new Object[0];
bool val = (bool)mi.Invoke(objectWithProperty, prm);
if (val) selectedText = BooleanTextTrue;
else selectedText = BooleanTextFalse;
if (val) SelectedText = BooleanTextTrue;
else SelectedText = BooleanTextFalse;
}
public delegate void SetBooleanDelegate(bool val);
public delegate bool GetBooleanDelegate();
Expand Down Expand Up @@ -108,7 +108,7 @@ public BooleanProperty(string resourceIdLabel, string resourceIdValues)
}
base.choices = new string[] { BooleanTextTrue, BooleanTextFalse };
base.propertyLabelText = StringTable.GetString(resourceId + ".Label");
selectedText = BooleanTextTrue;
SelectedText = BooleanTextTrue;
}
/// <summary>
/// Erzeugt eine BooleanProperty, welches einen eigenen boolean Wert enthält und
Expand Down
14 changes: 7 additions & 7 deletions CADability/ColorSelectionProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public ColorSelectionProperty(string resourceId, ColorList clrTable, ColorDef se
ExtendChoices();
if (select != null)
{
selectedText = select.Name;
SelectedText = select.Name;
}
else
{
selectedText = unselectedText;
SelectedText = unselectedText;
}
unselectedText = StringTable.GetString("ColorDef.Undefined");
showUnselectedGray = true;
Expand All @@ -51,11 +51,11 @@ public ColorSelectionProperty(IColorDef iColorDef, string resourceId, ColorList
ExtendChoices();
if (selectedColor != null)
{
selectedText = selectedColor.Name;
SelectedText = selectedColor.Name;
}
else
{
selectedText = unselectedText;
SelectedText = unselectedText;
}
toWatch = iColorDef as IGeoObject; // may be null
showUnselectedGray = true;
Expand Down Expand Up @@ -96,7 +96,7 @@ public ColorSelectionProperty(object go, string propertyName, string resourceId,
ColorDef selectedColor = (ColorDef)mi.Invoke(objectWithProperty, prm);
if (selectedColor != null)
{
selectedText = selectedColor.Name;
SelectedText = selectedColor.Name;
}
selectedCD = selectedColor;
clrTable.Usage = flags;
Expand Down Expand Up @@ -160,10 +160,10 @@ private void colorList_DidModify(object sender, EventArgs args)
}
if (selectedColor != null)
{
selectedText = selectedColor.Name;
SelectedText = selectedColor.Name;
}
else if (selectedCD != null)
selectedText = selectedCD.Name;
SelectedText = selectedCD.Name;
}
public delegate void ColorDefChangedDelegate(ColorDef selected);
public event ColorDefChangedDelegate ColorDefChangedEvent;
Expand Down
10 changes: 5 additions & 5 deletions CADability/DimensionStyleSelectionProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public DimensionStyleSelectionProperty(string resourceId, DimensionStyleList lis
// sollte es den Namen schon geben, werden solange - davor und dahintergemacht, bis es den Namen mehr gibt
// while (Find(undef)!=null) undef = "-" + undef +"-";
choices[0] = undef;
if (dimensionStyle.DimensionStyle != null) selectedText = dimensionStyle.DimensionStyle.Name;
else selectedText = undef;
if (dimensionStyle.DimensionStyle != null) SelectedText = dimensionStyle.DimensionStyle.Name;
else SelectedText = undef;
}
else
{
Expand All @@ -67,7 +67,7 @@ public DimensionStyleSelectionProperty(string resourceId, DimensionStyleList lis
{
base.choices[i] = selectableStyles[i].Name;
}
if (dimensionStyle.DimensionStyle != null) base.selectedText = dimensionStyle.DimensionStyle.Name;
if (dimensionStyle.DimensionStyle != null) base.SelectedText = dimensionStyle.DimensionStyle.Name;
}
toWatch = dimensionStyle as IGeoObject;
}
Expand Down Expand Up @@ -102,8 +102,8 @@ private void GeoObjectDidChange(IGeoObject Sender, GeoObjectChange Change)
{
if ((Change as GeoObjectChange).MethodOrPropertyName == "DimensionStyle")
{
if ((toWatch as IDimensionStyle).DimensionStyle != null) base.selectedText = (toWatch as IDimensionStyle).DimensionStyle.Name;
else base.selectedText = null;
if ((toWatch as IDimensionStyle).DimensionStyle != null) base.SelectedText = (toWatch as IDimensionStyle).DimensionStyle.Name;
else base.SelectedText = null;
propertyPage.Refresh(this);
}
}
Expand Down
10 changes: 5 additions & 5 deletions CADability/HatchStyleSelectionProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public HatchStyleSelectionProperty(string ResourceId, HatchStyleList hsl, HatchS
// sollte es den Namen schon geben, werden solange "-" davor und dahintergemacht, bis es den Namen mehr gibt
while (hatchStyleList.Find(undef) != null) undef = "-" + undef + "-";
choices[0] = undef;
if (preselect != null) selectedText = preselect.Name;
else selectedText = undef;
if (preselect != null) SelectedText = preselect.Name;
else SelectedText = undef;
}
else
{
Expand All @@ -47,18 +47,18 @@ public HatchStyleSelectionProperty(string ResourceId, HatchStyleList hsl, HatchS
HatchStyle hst = hatchStyleList[i];
choices[i] = hst.Name;
}
if (preselect != null) selectedText = preselect.Name;
if (preselect != null) SelectedText = preselect.Name;
}
}
public void SetSelection(HatchStyle hatchStyle)
{
if (hatchStyle == null)
{
base.selectedText = null;
base.SelectedText = null;
}
else
{
base.selectedText = hatchStyle.Name;
base.SelectedText = hatchStyle.Name;
}
}
protected override void OnSelectionChanged(string selected)
Expand Down
12 changes: 6 additions & 6 deletions CADability/Layer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public LayerSelectionProperty(string resourceId, LayerList layerList, Layer sele
choices[i] = lay.Name;
i++;
}
if (select != null) base.selectedText = select.Name;
if (select != null) base.SelectedText = select.Name;
}

public LayerSelectionProperty(ILayer ObjectWithLayer, string resourceId, LayerList ll) :
Expand All @@ -565,11 +565,11 @@ public LayerSelectionProperty(ILayer ObjectWithLayer, string resourceId, LayerLi
objectWithLayer = ObjectWithLayer;
if (objectWithLayer != null && objectWithLayer.Layer != null)
{
selectedText = objectWithLayer.Layer.Name;
SelectedText = objectWithLayer.Layer.Name;
}
else
{
selectedText = undef;
SelectedText = undef;
}
}
else
Expand All @@ -583,7 +583,7 @@ public LayerSelectionProperty(ILayer ObjectWithLayer, string resourceId, LayerLi
}
objectWithLayer = ObjectWithLayer;
if (objectWithLayer != null && objectWithLayer.Layer != null)
selectedText = objectWithLayer.Layer.Name;
SelectedText = objectWithLayer.Layer.Name;
}
toWatch = objectWithLayer as IGeoObject;
}
Expand Down Expand Up @@ -623,8 +623,8 @@ private void GeoObjectDidChange(IGeoObject Sender, GeoObjectChange Change)
if ((Change as GeoObjectChange).MethodOrPropertyName == "Layer" ||
(Change as GeoObjectChange).MethodOrPropertyName == "Style")
{
if (toWatch.Layer != null) base.selectedText = toWatch.Layer.Name;
else base.selectedText = null;
if (toWatch.Layer != null) base.SelectedText = toWatch.Layer.Name;
else base.SelectedText = null;
propertyPage.Refresh(this);
}
}
Expand Down
16 changes: 8 additions & 8 deletions CADability/LinePatternSelectionProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public LinePatternSelectionProperty(string ResourceID, LinePatternList linePatte
choices[0] = undef;
if (select != null)
{
base.selectedText = select.Name;
base.SelectedText = select.Name;
}
else
{
base.selectedText = undef;
base.SelectedText = undef;
}
}
else
Expand All @@ -49,7 +49,7 @@ public LinePatternSelectionProperty(string ResourceID, LinePatternList linePatte
}
if (select != null)
{
base.selectedText = select.Name;
base.SelectedText = select.Name;
}
}
}
Expand All @@ -71,11 +71,11 @@ public LinePatternSelectionProperty(string ResourceID, LinePatternList linePatte
choices[0] = undef;
if (select != null)
{
base.selectedText = select.Name;
base.SelectedText = select.Name;
}
else
{
base.selectedText = undef;
base.SelectedText = undef;
}
}
else
Expand All @@ -87,7 +87,7 @@ public LinePatternSelectionProperty(string ResourceID, LinePatternList linePatte
}
if (select != null)
{
base.selectedText = select.Name;
base.SelectedText = select.Name;
}
}
this.iLinePattern = iLinePattern;
Expand Down Expand Up @@ -127,8 +127,8 @@ private void GeoObjectDidChange(IGeoObject Sender, GeoObjectChange Change)
if ((Change as GeoObjectChange).MethodOrPropertyName == "LinePattern" ||
(Change as GeoObjectChange).MethodOrPropertyName == "Style")
{
if ((toWatch as ILinePattern).LinePattern != null) base.selectedText = (toWatch as ILinePattern).LinePattern.Name;
else base.selectedText = null;
if ((toWatch as ILinePattern).LinePattern != null) base.SelectedText = (toWatch as ILinePattern).LinePattern.Name;
else base.SelectedText = null;
propertyPage.Refresh(this);
}
}
Expand Down
16 changes: 8 additions & 8 deletions CADability/LineWidthSelectionProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public LineWidthSelectionProperty(string ResourceId, LineWidthList lineWidthList
choices[0] = undef;
if (select != null)
{
base.selectedText = select.Name;
base.SelectedText = select.Name;
}
else
{
base.selectedText = undef;
base.SelectedText = undef;
}
}
else
Expand All @@ -48,7 +48,7 @@ public LineWidthSelectionProperty(string ResourceId, LineWidthList lineWidthList
}
if (select != null)
{
base.selectedText = select.Name;
base.SelectedText = select.Name;
}
}
}
Expand All @@ -70,11 +70,11 @@ public LineWidthSelectionProperty(string ResourceId, LineWidthList lineWidthList
choices[0] = undef;
if (select != null)
{
base.selectedText = select.Name;
base.SelectedText = select.Name;
}
else
{
base.selectedText = undef;
base.SelectedText = undef;
}
}
else
Expand All @@ -86,7 +86,7 @@ public LineWidthSelectionProperty(string ResourceId, LineWidthList lineWidthList
}
if (select != null)
{
base.selectedText = select.Name;
base.SelectedText = select.Name;
}
}
this.iLineWidth = iLineWidth;
Expand Down Expand Up @@ -126,8 +126,8 @@ private void GeoObjectDidChange(IGeoObject Sender, GeoObjectChange Change)
if ((Change as GeoObjectChange).MethodOrPropertyName == "LineWidth" ||
(Change as GeoObjectChange).MethodOrPropertyName == "Style")
{
if ((toWatch as ILineWidth).LineWidth != null) base.selectedText = (toWatch as ILineWidth).LineWidth.Name;
else base.selectedText = null;
if ((toWatch as ILineWidth).LineWidth != null) base.SelectedText = (toWatch as ILineWidth).LineWidth.Name;
else base.SelectedText = null;
propertyPage.Refresh(this);
}
}
Expand Down
Loading

0 comments on commit b12eac5

Please sign in to comment.