void MainWindow_Initialized(object sender, EventArgs e) { m_cmdHandler = new MainWindowCommandHandler(this); GameData.Data.GameModeChanged += OnGameModeChanged; GameData.Data.FocusedObjectChanged += OnFocusedObjectChanged; this.ToolMode = ClientToolMode.Info; this.MapControl.GotSelection += MapControl_GotSelection; // for some reason this prevents the changing of focus from mapcontrol with cursor keys KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Once); // add default commands m_cmdHandler.AddCommandBindings(GameMode.Undefined); this.KeyboardHandler = new KeyboardHandler(this.MapControl); }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); m_cmdHandler = new MainWindowCommandHandler(this); AddHandler(UI.MapControl.MouseClickedEvent, new MouseButtonEventHandler(OnMouseClicked)); var dpd = DependencyPropertyDescriptor.FromProperty(GameData.WorldProperty, typeof(GameData)); dpd.AddValueChanged(GameData.Data, OnWorldChanged); }