/// <summary> /// Default constructor. /// </summary> public MainWindow() { InitializeComponent(); //loads configuration file. ConfigurationSet c = ConfigurationSet.GetInstance(); c.LoadConfiguration(); //try to load configured modules. string message = String.Empty; foreach (Module m in c.Modules) { if (!this.LoadModule(m)) { message += "- " + m.Name + "\n"; } } //display modules which cannot be loaded. if (message != String.Empty) { this.messageError = "The following modules cannot be loaded by PlugSPL:\n" + message; } //displays the splashscreen by 1 seconds. System.Threading.Thread.Sleep(1000); }
/// <summary> /// Singleton implementation. (Google it f****t.) /// </summary> public static ConfigurationSet GetInstance() { if (ConfigurationSet.instance == null) { ConfigurationSet.instance = new ConfigurationSet(); } return(ConfigurationSet.instance); }
/// <summary> /// Retrieve configuration object from a config file. /// </summary> public void LoadConfiguration() { this.Modules = new List <Module>(); this.Modules.Add(new Module() { Assembly = "asseeeemmmbllyy", Interface = "Interfaceeee", Name = "nameee", Type = "typeee" }); TextReader reader = new StreamReader(ConfigurationSet.filename); XmlSerializer serializer = new XmlSerializer(typeof(ConfigurationSet)); ConfigurationSet x = (ConfigurationSet)serializer.Deserialize(reader); this.Modules = x.Modules; reader.Close(); }