Fix cloning of SettingsViewModels.
This commit is contained in:
		@@ -182,8 +182,7 @@ namespace zaaReloaded2.ViewModels
 | 
			
		||||
            foreach (Settings s in repository.SettingsList)
 | 
			
		||||
            {
 | 
			
		||||
                SettingsViewModel vm = new SettingsViewModel(s);
 | 
			
		||||
                vm.PropertyChanged += SettingsViewModel_PropertyChanged;
 | 
			
		||||
                SettingsList.Add(vm);
 | 
			
		||||
                AddSettingsViewModel(vm);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -268,8 +267,10 @@ namespace zaaReloaded2.ViewModels
 | 
			
		||||
            if (Selected != null)
 | 
			
		||||
            {
 | 
			
		||||
                SettingsViewModel copy = Selected.Clone() as SettingsViewModel;
 | 
			
		||||
                SettingsList.Add(copy);
 | 
			
		||||
                _repository.SettingsList.Add(copy.RevealModelObject() as Settings);
 | 
			
		||||
                AddSettingsViewModel(copy);
 | 
			
		||||
                Selected.IsSelected = false;
 | 
			
		||||
                copy.IsSelected = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -300,6 +301,17 @@ namespace zaaReloaded2.ViewModels
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Adds a settings view model to the collection and wires the
 | 
			
		||||
        /// PropertyChanged event.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="settingsViewModel">SettingsViewModel to add.</param>
 | 
			
		||||
        void AddSettingsViewModel(SettingsViewModel settingsViewModel)
 | 
			
		||||
        {
 | 
			
		||||
            settingsViewModel.PropertyChanged += SettingsViewModel_PropertyChanged;
 | 
			
		||||
            SettingsList.Add(settingsViewModel);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Implementation of ViewModelBase
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user