private void ApplyTransformModel(TransformModel transformModel) { if (transformModel == null) { throw new ArgumentNullException("transformModel"); } this.Model = transformModel; this.TextAppSettings.Text = this.BuildStringFrom(this.Model.AppSettings); this.TextConnectionStrings.Text = this.BuildStringFrom(this.Model.ConnectionStrings); this.TextConfigContents.Text = this.Model.ConfigContents; this.InvalidateVisual(); }
public static TransformModel BuildFromCurrent() { TransformModel tm = new TransformModel(); foreach (string key in ConfigurationManager.AppSettings.AllKeys) { tm.AppSettings.Add(key, ConfigurationManager.AppSettings[key]); } foreach (ConnectionStringSettings cn in ConfigurationManager.ConnectionStrings) { tm.ConnectionStrings.Add(cn.Name, cn.ConnectionString); } Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); tm.ConfigContents = File.ReadAllText(config.FilePath); return tm; }
public static TransformModel BuildFromCurrent() { TransformModel tm = new TransformModel(); foreach (string key in ConfigurationManager.AppSettings.AllKeys) { tm.AppSettings.Add(key, ConfigurationManager.AppSettings[key]); } foreach (ConnectionStringSettings cn in ConfigurationManager.ConnectionStrings) { tm.ConnectionStrings.Add(cn.Name, cn.ConnectionString); } Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); tm.ConfigContents = File.ReadAllText(config.FilePath); return(tm); }
private void WindowOnLoad(object sender, RoutedEventArgs e) { this.ApplyTransformModel(TransformModel.BuildFromCurrent()); }