Esempio n. 1
0
        public void Execute(object parameter)
        {
            var(stream, path) = _filePicker.GetFileToSave(_windowProvider.GetMainWindow());

            using (stream)
            {
                using var stringWriter = new StreamWriter(stream);
                _gameStateService.CreateNewGame();

                var jsonSerializer = JsonSerializer.Serialize(_gameStateService.GetData());

                _gameStateService.ApplicationSettings.ProjectFile = path;


                stringWriter.Write(jsonSerializer);
            }

            var pathBase = Path.GetDirectoryName(path);

            CreateCards(pathBase);
        }
Esempio n. 2
0
        public void Execute(object parameter)
        {
            var(stream, path) = _filePicker.GetFileToSave(_windowProvider.GetMainWindow());

            using (stream)
            {
                var gameData = _gameStateService.GetData();
                gameData.Name          = _projectSettingsViewModel.ProjectName;
                gameData.Author        = _projectSettingsViewModel.Author;
                using var stringWriter = new StreamWriter(stream);

                var jsonSerializer = JsonSerializer.Serialize(gameData);

                _gameStateService.ApplicationSettings.ProjectFile = path;


                stringWriter.Write(jsonSerializer);
            }

            var pathBase = Path.GetDirectoryName(path);
        }