Skip to content

Commit ac7506d

Browse files
committed
Replace a getter with a property
1 parent c5d0a1f commit ac7506d

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,8 +1560,7 @@ public interface ICabViewMouseControlRenderer
15601560
bool IsMouseWithin();
15611561
void HandleUserInput();
15621562
string GetControlName();
1563-
string GetControlLabel();
1564-
1563+
string ControlLabel { get; }
15651564
}
15661565

15671566
/// <summary>
@@ -2190,10 +2189,7 @@ public string GetControlName()
21902189
return (Locomotive as MSTSLocomotive).TrainControlSystem.GetDisplayString(GetControlType().ToString());
21912190
}
21922191

2193-
public string GetControlLabel()
2194-
{
2195-
return Control.Label;
2196-
}
2192+
public string ControlLabel { get { return Control.Label; } }
21972193

21982194
/// <summary>
21992195
/// Handles cabview mouse events, and changes the corresponding locomotive control values.

Source/RunActivity/Viewer3D/RollingStock/SubSystems/ETCS/DriverMachineInterface.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,7 @@ public string GetControlName()
856856
}
857857
return "";
858858
}
859-
public string GetControlLabel()
860-
{
861-
return GetControlName();
862-
}
859+
public string ControlLabel { get { return GetControlName(); } }
863860
public override void Draw(GraphicsDevice graphicsDevice)
864861
{
865862
DMI.Draw(ControlView.SpriteBatch, new Point(DrawPosition.X, DrawPosition.Y));

Source/RunActivity/Viewer3D/Viewer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ void HandleUserInput(ElapsedTime elapsedTime)
14781478
if (MousePickedControl != null & MousePickedControl != OldMousePickedControl)
14791479
{
14801480
// say what control you have here
1481-
Simulator.Confirmer.Message(ConfirmLevel.None, String.IsNullOrEmpty(MousePickedControl.GetControlLabel()) ? MousePickedControl.GetControlName() : MousePickedControl.GetControlLabel());
1481+
Simulator.Confirmer.Message(ConfirmLevel.None, String.IsNullOrEmpty(MousePickedControl.ControlLabel) ? MousePickedControl.GetControlName() : MousePickedControl.ControlLabel);
14821482
}
14831483
if (MousePickedControl != null) ActualCursor = Cursors.Hand;
14841484
else if (ActualCursor == Cursors.Hand) ActualCursor = Cursors.Default;
@@ -1637,7 +1637,7 @@ void HandleUserInput(ElapsedTime elapsedTime)
16371637
if (MousePickedControl != null & MousePickedControl != OldMousePickedControl)
16381638
{
16391639
// say what control you have here
1640-
Simulator.Confirmer.Message(ConfirmLevel.None, String.IsNullOrEmpty(MousePickedControl.GetControlLabel()) ? MousePickedControl.GetControlName() : MousePickedControl.GetControlLabel());
1640+
Simulator.Confirmer.Message(ConfirmLevel.None, String.IsNullOrEmpty(MousePickedControl.ControlLabel) ? MousePickedControl.GetControlName() : MousePickedControl.ControlLabel);
16411641
}
16421642
if (MousePickedControl != null)
16431643
{

0 commit comments

Comments
 (0)