public GameManagerViewModel(GenericGameManager gameManager) { // Create the properties Random = new Random(); GameManager = gameManager; // Create the commands LoadSavedPositionCommand = new RelayCommand(LoadSavedPosition); SavePositionCommand = new RelayCommand(SavePosition); ReloadLevelCommand = new RelayCommand(() => GameManager.ReloadLevel()); LoadRandomLevelCommand = new RelayCommand(LoadRandomLevel); }
public MainViewModel(GenericGameManager gameManager) { GameManager = gameManager; // Instantiate view models GameManagerVm = new GameManagerViewModel(GameManager); BookmarksVm = new BookmarksViewModel(GameManager); // Create commands ToggleMinimizedUiCommand = new RelayCommand(ToggleMinimizedUi); // Set full UI as default WindowProperties = new WindowProperties { ResizeMode = ResizeMode.CanResize }; SetFullView(); // Setup keyboard hook GlobalKeyboardHook = new GlobalKeyboardHook(); GlobalKeyboardHook.KeyboardPressed += OnKeyPressed; HotkeysToggleTooltip = "Enables hotkeys:\nR - reload level\nK - previous level\nL - next level\nP - save position\nO - load position\nB - add bookmark"; }
public BookmarksViewModel(GenericGameManager gameManager) { // Set properties GameManager = gameManager; BookmarkFile = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), GameManager.BookmarkFileName + ".xml"); BookmarkItems = new ObservableCollection <BookmarkItemViewModel>(); AllBookmarkItems = new List <BookmarkItemViewModel>(); SelectedBookmarkIndex = -1; // Enable collection synchronization so the collection can be updated from another thread BindingOperations.EnableCollectionSynchronization(BookmarkItems, this); // Create commands AddBookmarkCommand = new RelayCommand(AddBookmark); RenameBookmarkCommand = new RelayCommand(RenameBookmark); DeleteBookmarkCommand = new RelayCommand(DeleteBookmark); LoadBookmarkCommand = new RelayCommand(LoadBookmark); // Load existing bookmarks LoadBookmarks(); Task.Run(RefreshAsync); }