public ConfigEditor(Config c) { InitializeComponent(); this.nud_AdultCheckOutPeriod.Value = c.AdultPeriodInDays; this.nud_DVDPeriod.Value = c.DvdPeriodInDays; this.nud_ChildrenCheckOutPeriod.Value = c.ChildrenPeriodInDays; this.nub_VideoCheckOutPeriod.Value = c.VideoTapePeriodInDays; this.nud_AdultBookLimit.Value = c.AdultBookLimit; this.numericUpDown1.Value = c.ChildrenBookLimit; this.numericUpDown2.Value = 0; this.numericUpDown3.Value = 0; this.numericUpDown4.Value = c.AdultChildrenAgeDelimiter; }
private void ConfigLoader( ) { configPathBase = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),"librarysim"); s = new XmlSerializer( typeof( Config) ); //Check if directory exists if(!Directory.Exists(configPathBase)) { Directory.CreateDirectory(configPathBase); } if(File.Exists(Path.Combine(configPathBase,"librarysim.xml"))) { // Deserialization + Import configuration TextReader r = new StreamReader( Path.Combine(configPathBase,"librarysim.xml") ); conf = (Config)s.Deserialize( r ); r.Close(); } else { //Create New Config conf = new Config(); } }