/// <summary> /// De-serializes a model hierarchy from a file name 'filename'. After the file is deserialized, each /// model in the hierarchy has its PropertyChanging event wired up to the history controller referenced /// by the 'historyController' parameter. /// /// Calling this method will clear the contents of the history controller. /// </summary> public static ModelBase DeSerialize(string filename, HistoryController historyController) { var root = DeSerialize(filename); var casted = root as Node; if (casted != null) { casted.Apply(x => { x.PropertyChanging += historyController.HandleModelPropertyChanging; }); } historyController.Clear(); return(root); }