public Bookmarks() { InitializeComponent(); BindingContext = new BookmarksVM(); IocManager.Container.Resolve <IMessageBus>().Subscribe <BookmarksChangedMessage>(BookmarksChangedSubsciber); }
public void OnKeyPressed(object sender, GlobalKeyboardHookEventArgs e) { var manager = new Rayman2Manager(); if (!AppVM.HotkeysEnabled || Application.Current.Windows.Count > 1 || manager.IsRayman2Paused() || !manager.IsRayman2Focused() && !Application.Current.MainWindow.IsActive) { e.Handled = false; return; } // Only handle key down if (e.KeyboardState != GlobalKeyboardHook.KeyboardState.KeyDown) { return; } // O to load position if (e.KeyboardData.VirtualCode == 0x4F) { GameManagerVM.LoadSavedPosition(); } // P to save position else if (e.KeyboardData.VirtualCode == 0x50) { GameManagerVM.SavePosition(); } // K for previous level else if (e.KeyboardData.VirtualCode == 0x4B) { GameManagerVM.LoadOffsetLevel(-1); } // L for next level else if (e.KeyboardData.VirtualCode == 0x4C) { GameManagerVM.LoadOffsetLevel(1); } // R for reload level else if (e.KeyboardData.VirtualCode == 0x52) { manager.ReloadLevel(); } // B to add bookmark else if (e.KeyboardData.VirtualCode == 0x42) { BookmarksVM.AddBookmark(); } }
private void MainWindow_OnClosing(object sender, CancelEventArgs e) { Dispose(); BookmarksVM.SaveBookmarks(); }