How to get the robot name
How to get the robot name
18 Jul 2014, 20:54
how to get the name of a robot defines
[Robot ("Name", TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class TrailCutII: Robot ...
from the base type Robot?
Replies
aysos75
19 Jul 2014, 20:52
RE: RE:
Abdallah_Hacid said:
Abdallah_Hacid said:
how to get the name of a robot defines
[Robot ("Name", TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class TrailCutII: Robot ...from the base type Robot?
If suffit de faire :
///
/// Obtient le nom du robot ///
///L'instance du robot actuel /// Le nom du type dérivé de Robot et définissant une nouvelle instance de Robot public static string name(this Robot robot) { return robot.ToString(); }
Par contre comment obtenir le nom définit dans l'atribut
[Robot ("Name", TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class TrailCutII: Robot ...
@aysos75
Invalid
21 Jul 2014, 09:13
you can do smth like:
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)] public class TrailCutII : Robot { protected override void OnStart() { var name = this.GetName(); } } public static class AlgoExtensions { public static string GetName(this Robot robot) { return robot.GetType().Name; } }
@Invalid
aysos75
19 Jul 2014, 20:50
RE:
Abdallah_Hacid said:
If suffit de faire :
@aysos75