(I didn't really know how to properly title this post)
Do you guys have a better alternative to this code? I feel like I could accomplish more with a dictionary combined with my JsonSerialized class.
WillyTC config = new WillyTC();
switch (GetCurrentLanguage().ToLower())
{
case "french":
PerimetreExterne = GetSolidworksProp(config.PerimetreExterne_Fr);
PerimetreInterne = GetSolidworksProp(config.PerimetreInterne_Fr);
break;
case "english":
PerimetreExterne = GetSolidworksProp(config.PerimetreExterne_En);
PerimetreInterne = GetSolidworksProp(config.PerimetreInterne_En);
break;
default:
throw new Exception("Non-Handled");
}
My Json serializable class - here's the definition of the class used for JSONserialization:
public class WillyTC
{
public WillyProperties WillyCustomProperties;
public WillyTC()
{
WillyCustomProperties = new WillyProperties();
}
public class WillyProperties
{
public readonly string PerimetreExterne_Fr = "Longueur à découper extérieure";
public readonly string PerimetreExterne_En = "Cutting Length-Outer";
public readonly string PerimetreInterne_Fr = "Longueur à découper des boucles intérieures";
public readonly string PerimetreInterne_En = "Cutting Length-Inner";
public readonly string NbDecoupeInterne_Fr = "Découpes";
public readonly string NbDecoupeInterne_En = "Cut Outs";
public readonly string AireBrut_Fr = "Surface du flanc de tôle";
public readonly string AireBrut_En = "Bounding Box Area";
public readonly string AirePiece_Fr = "Surface du flanc de tôle brut";
public readonly string AirePiece_En = "Bounding Box Area-Blank";
public readonly string Pliages_Fr = "Plis";
public readonly string Pliages_En = "Bends";
public readonly string Epaisseur_Fr = "Epaisseur de tôlerie";
public readonly string Epaisseur_En = "Sheet Metal Thickness";
public readonly string LongueurRect_Fr = "Longueur du flanc de tôle";
public readonly string LongueurRect_En = "Bounding Box Length";
public readonly string LargeurRect_Fr = "Largeur du flanc de tôle";
public readonly string LargeurRect_En = "Bounding Box Width";
public readonly string NumeroMateriel = "NumeroMateriel";
public readonly string RPliage = "RPliage";
public readonly string VPliage = "VPliage";
}
}
Thanks!