void Initialize([NotNull] World world, int dimension) { var view = _view; DisplayName = "Starting Up - Editor"; var sharpDxElement = view.SharpDx; var game = new EditorGameFactory().Create(sharpDxElement, IoC.GetAll <IGameComponent>(), world, dimension); _game = game; Deactivated += ExitGame; // this is an extremely dirty hack. SharpDxElement will dispose when Unloaded is called, // but that can be triggered by avalondock, while the control should still be kept alive. // We can't prevent disposing because SharpDxElement is sealed, and the methods are private. // The only option then is to remove the event handler via reflection. // We select the method with the matching name and remove it. var handlers = GetRoutedEventHandlers(sharpDxElement, FrameworkElement.UnloadedEvent); var sharpDxElementDisposer = handlers.FirstOrDefault(b => b.Handler.Method.Name == "HandleUnloaded"); sharpDxElement.RemoveHandler(FrameworkElement.UnloadedEvent, sharpDxElementDisposer.Handler); _game = game; _aggregator.Publish(new EditorOpenedMessage(game)); _aggregator.Publish(new EditorGainedFocusMessage(game)); DisplayName = String.Format("{0} - Editor", world.Title); }
protected EditorMessage([NotNull] IEditorGameFacade editorGame) { if (editorGame == null) { throw new ArgumentNullException("editorGame"); } EditorGame = editorGame; }
public EditorClosingMessage([NotNull] IEditorGameFacade editorGame) : base(editorGame) { }
public EditorOpenedMessage([NotNull] IEditorGameFacade editorViewModel) : base(editorViewModel) { }
public EditorGainedFocusMessage([NotNull] IEditorGameFacade editorGame) : base(editorGame) { }