private void SaveSettings() { var settings = new SearchSettings() { InitialDirectory = InitialDirTBx.Text, TemplateName = TemplateNameTBx.Text, ContentFile = ContentFileTBx.Text, IsFilterByContent = ContentFileCBx.Checked, IsFilterByTemplate = TemplateNameCBx.Checked }; using (var stream = new FileStream("settings.xml", FileMode.Create, FileAccess.Write, FileShare.Read)) { xmlSerializer.Serialize(stream, settings); } }
private void LoadSettings() { using (var stream = new FileStream("settings.xml", FileMode.Open, FileAccess.Read)) { globalSetting = (SearchSettings)xmlSerializer.Deserialize(stream); } InitialDirTBx.Text = globalSetting.InitialDirectory; TemplateNameTBx.Text = globalSetting.TemplateName; ContentFileTBx.Text = globalSetting.ContentFile; ContentFileCBx.Checked = globalSetting.IsFilterByContent; TemplateNameCBx.Checked = globalSetting.IsFilterByTemplate; }