using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.VectorMath; using MatterHackers.MatterControl.DataStorage; using MatterHackers.Localizations; namespace MatterHackers.MatterControl { public class LanguageSelector : StyledDropDownList { Dictionary languageDict; public LanguageSelector() : base("Default") { //string pathToModels = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PrinterSettings", manufacturer); //if (Directory.Exists(pathToModels)) //{ // foreach (string manufacturerDirectory in Directory.EnumerateDirectories(pathToModels)) // { // string model = Path.GetFileName(manufacturerDirectory); // ModelDropList.AddItem(model); // } //} this.MinimumSize = new Vector2(this.LocalBounds.Width, this.LocalBounds.Height); CreateLanguageDict(); string languageCode = UserSettings.Instance.get("Language"); foreach (KeyValuePair entry in languageDict) { AddItem(entry.Key, entry.Value); } foreach (KeyValuePair entry in languageDict) { if (languageCode == entry.Value) { SelectedLabel = entry.Key; break; } } } private void CreateLanguageDict() { languageDict = new Dictionary(); languageDict["Default"] = "EN"; languageDict["English"] = "EN"; languageDict["Español"] = "ES"; languageDict["Français"] = "FR"; languageDict["Deutsch"] = "DE"; } } }