public TraceSourceOptionsViewModel() { var settings = PhxStudio.Properties.Settings.Default; Model = settings.TraceSourceOptions.Clone(); Model.PropertyChanged += ModelSourceSettingPropertyChanged; foreach (var source_setting in Model.SourceSettings) { source_setting.PropertyChanged += ModelSourceSettingPropertyChanged; } }
public TraceSourceSettings Clone() { var copy = new TraceSourceSettings(); copy.MaxTraceListItems = this.MaxTraceListItems; foreach (var src_setting in this.SourceSettings) { var dst_setting = src_setting.Clone(); copy.SourceSettings.Add(dst_setting); } return(copy); }
public void Sync(TraceSourceSettings src) { if (this.SourceSettings.Count != src.SourceSettings.Count) { throw new ArgumentException("Counts are not equal"); } this.MaxTraceListItems = src.MaxTraceListItems; for (int x = 0; x < SourceSettings.Count; x++) { var src_setting = src.SourceSettings[x]; var dst_setting = this.SourceSettings[x]; if (src_setting.Name != dst_setting.Name) { throw new ArgumentException("Setting names are not equal"); } dst_setting.Sync(src_setting); } }