private void OnOpen() { if (SelectedMap == null) { return; } var n = string.Format("({0}) {1}: {2}", SelectedMap.Id, SelectedMap.RegionPlaceName, SelectedMap.PlaceName); try { var t = SelectedMap.GetTerritory(); if (t == null) { System.Windows.MessageBox.Show(string.Format("Could not find territory data for {0}.", n), "Territory not found", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); } else { Parent.EngineHelper.OpenInNew(n, (e) => new SaintCoinach.Graphics.Viewer.Content.ContentTerritory(e, t)); } } catch (Exception e) { System.Windows.MessageBox.Show(string.Format("Error reading territory for {0}:{1}{2}", n, Environment.NewLine, e), "Failure to read territory", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); } }