public LevelEditor(XElement xml) { TypeLookup.Rehydrate(xml); _properties = xml.Element(@"LevelProperties").DeserializedAs <LevelProperties>( ); _previousContentRootFolder = _properties.ContentRootFolder; if (!Directory.Exists(_properties.ContentRootFolder)) { string message = @"The level file has a content root folder that does not exist. It says the content root is at ""{0}"". Images specified in this level file are relative to this folder so you should change it in order to load this level file correctly. Would you like to change it?".FormatWith(_properties.ContentRootFolder); if (MessageBox.Show(message, @"Content root folder not found.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var folderBrowserDialog = new Ookii.Dialogs.VistaFolderBrowserDialog( ); DialogResult dialogResult = folderBrowserDialog.ShowDialog( ); if (dialogResult == DialogResult.OK) { _properties.ContentRootFolder = folderBrowserDialog.SelectedPath; } } } if (_properties.ContentRootFolder != _previousContentRootFolder) { //ObjectFactory.GetInstance<IEventHub>().Publish(new ContentRootChanged(_previousContentRootFolder, _properties.ContentRootFolder)); } Behaviours = new BehaviourCollection(_properties, xml); Layers = new List <LayerEditor>(xml.CertainElement(@"Layers").Elements(@"Layer").Select(x => LayerEditor.FromXml(this, x))); ActiveLayer = Layers.FirstOrDefault( ); }