/// <summary> /// Called when [open file folder]. Deals with opening certain SkeletonGame files from filename. /// </summary> /// <param name="path">The path.</param> private void OnOpenFileFolder(string path) { Log($"Attempting to open file. {path}"); try { switch (path) { case "asset_list.yaml": case "new_score_display.yaml": case "machine.yaml": case "attract.yaml": case "game_default_data.yaml": case "game_default_settings.yaml": FileFolder.Explore(Path.Combine(_skeletonGameProvider.GameFolder, "config", path)); break; case "config.yaml": FileFolder.Explore(Path.Combine(_skeletonGameProvider.GameFolder, path)); break; default: break; } } catch (Exception ex) { Log($"Error loading file {path}. {ex.Message}", Category.Warn); } }
public void OpenDirectory(string path) { try { if (!string.IsNullOrWhiteSpace(path)) { FileFolder.Explore(path); } } catch (Exception ex) { Log($"Error opening file/folder: {path}, {ex.Message}"); } }
public FileMenuViewModel(ISkeletonGameProvider skeletonGameProvider, IGameRunnner gameRunnner, IAppSettingsModel appSettingsModel, IEventAggregator eventAggregator, IUnityContainer unityContainer, IRegionManager regionManager, ILoggerFacade loggerFacade) : base(eventAggregator, loggerFacade) { _skeletonGameProvider = skeletonGameProvider; _regionManager = regionManager; _gameRunnner = gameRunnner; _appSettingsModel = appSettingsModel; _appSettingsModel.Load(); if (_eventAggregator == null) { _eventAggregator = eventAggregator; } RecentDirectories = appSettingsModel.RecentDirectories; CreateNewGameRequest = new InteractionRequest <IRequestNewGame>(); //Recent dirs //RecentDirectories.AddRange(new string[] { @"C:\P-ROC\Games\Jaws", @"C:\P-ROC\Games\EvilDead" }); //Get the recordings stored from containers view model Recordings = unityContainer.Resolve <RecordingsViewModel>().PlaybackItemViewModels; _eventAggregator.GetEvent <OnLaunchGameEvent>().Subscribe(async(x) => { IsGameRunning = true; await OnLaunchedGame(); }); #region Commands BrowseFolderCommand = new DelegateCommand(() => FileFolder.Explore(_skeletonGameProvider.GameFolder), () => GameFolder != null); CreateNewGameCommand = new DelegateCommand(OnCreateNewGame, () => !IsGameRunning); ExportCommand = new DelegateCommand <string>(OnExport, (x) => GameFolder != null); LaunchGameCommand = new DelegateCommand(async() => { IsGameRunning = true; await OnLaunchedGame(); }, () => GameNotRunningAndFolderValid()); LaunchRecordingCommand = new DelegateCommand <string>((playbackItem) => { OnLaunchRecordings(unityContainer, playbackItem); }, (x) => GameNotRunningAndFolderValid()); LaunchToolCommand = new DelegateCommand <string>((toolName) => { OnLaunchTool(toolName); }, (x) => GameFolder != null); OpenRecentCommand = new DelegateCommand <string>(OnOpenRecent, (x) => !IsGameRunning); ReloadGameCommand = new DelegateCommand(async() => await OnReloadGame(), () => GameNotRunningAndFolderValid()); SetDirectoryCommand = new DelegateCommand(() => OnSetDirectory(), () => !IsGameRunning); NavigateCommand = new DelegateCommand <string>(OnNavigate, (x) => GameFolder != null); #endregion }