コード例 #1
0
        // Write file with current date to json file in external download folder
        private async Task CreateBackup()
        {
            string filename = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + ".json";

            DatabaseModel dm = new DatabaseModel();

            dm.Playlists = await playlistRepository.GetAllPlaylistArrayAsync();

            dm.Positions = await positionRepository.GetAllPositionArrayAsync();

            dm.SongPlaylists = await songPlaylistRepository.GetAllArrayAsync();

            dm.SongPositions = await songPositionRepository.GetAllArrayAsync();

            dm.Songs = await songRepository.GetAllSongArrayAsync();

            var json = JsonConvert.SerializeObject(dm);

            DependencyService.Get <IWirteService>().wirteFile(filename, json);
        }