public void CopyProperties(FamilyModel copyModel)
 {
     PersonSettings = new PersonSettings();
     PersonSettings.CopyProperties(copyModel.PersonSettings);
     RelationshipSettings = new RelationshipSettings();
     RelationshipSettings.CopyProperties(copyModel.RelationshipSettings);
     Tree = new Tree();
     Tree.CopyProperties(copyModel.Tree);
     Members = new ObservableCollection<PersonModel>() { };
     Members = copyModel.Members;
     Relationships = new ObservableCollection<RelationshipModel>() { };
     Relationships = copyModel.Relationships;
 }
        public FamilyView()
        {            
            Tree = new Tree();
            Members = new ObservableCollection<PersonView> { };
            Relationships = new ObservableCollection<RelationshipView> { };            
            SelectedPerson = new PersonView();
            RecordedFamilyModels = new ObservableCollection<FamilyModel> { };
            UndoDescriptions = new ObservableCollection<string> { };
            UndoneFamilyModels = new ObservableCollection<FamilyModel> { };
            RedoDescriptions = new ObservableCollection<string> { };
            InitiateCommands();
            PropertyChanged += new PropertyChangedEventHandler(PropertyChangedHandler);
            Members.CollectionChanged += new NotifyCollectionChangedEventHandler(CollectionChangedHandler);
            Relationships.CollectionChanged += new NotifyCollectionChangedEventHandler(CollectionChangedHandler);
            CreateNewFamily();

        }
        private void RestoreFamilyModel(FamilyModel model)
        {
            
            disableChangeRecording = true;
            
            Settings.Instance.Person = new PersonSettings();
            if (model.PersonSettings != null) { Settings.Instance.Person.CopyProperties(model.PersonSettings); }

            Settings.Instance.Relationship = new RelationshipSettings();
            if (model.RelationshipSettings != null) { Settings.Instance.Relationship.CopyProperties(model.RelationshipSettings); }   
                    
            Members.Clear();
            if (model.Members != null)
            {
                foreach (PersonModel personModel in model.Members)
                {
                    PersonView personView = new PersonView(GetNextID());
                    personView.CopyBaseProperties(personModel);
                    Members.Add(personView);                                       
                }
            }

            Relationships.Clear();
            if (model.Relationships != null)
            {
                foreach (RelationshipModel relationshipModel in model.Relationships)
                {
                    RelationshipView relationshipView = new RelationshipView(relationshipModel.Id);
                    relationshipView.CopyBaseProperties(relationshipModel);
                    Relationships.Add(relationshipView);                                     
                }
            }
            Tree = new Tree();
            if (model.Tree != null)
            {
                Tree.CopyProperties(model.Tree);
            }
                 
            SelectedPerson = GetPerson(Tree.SelectedPersonId);
            if (SelectedPerson != null) { SelectedPerson.Selected = true; }

            SelectedRelationship = GetRelationship(Tree.SelectedRelationshipId);
            if (SelectedRelationship != null) { SelectedRelationship.Selected = true; }
            
            RefreshTreeLayout();
            SubscribeToEvents();
            CurrentFamilyModel = GetCurrentFamilyModel();            
            Undo.RaiseCanExecuteChanged();
            Redo.RaiseCanExecuteChanged();
            lastChangeTime = DateTime.Now;
            disableChangeRecording = false;

            FamilyTreeCursor = Cursors.Arrow;
            SelectCommandInProgressType = 0;
        }