コード例 #1
0
        public async static Task initializeAsync()
        {
            await readDayMediaAsync();

            loadMediaIntoCollection();

            string mediaLinkManagerPath = Path.Combine(FilePaths.rootPath, "AllMediaLinkManager");

            if (File.Exists(mediaLinkManagerPath))
            {
                mediaLinkManager = JSONSerialManager.deserialize <LinkManager>(Path.Combine(FilePaths.rootPath,
                                                                                            "AllMediaLinkManager"));
            }
            if (mediaLinkManager == null)
            {
                mediaLinkManager = new LinkManager();
            }

            string favoriteManagerPath = Path.Combine(FilePaths.rootPath, "AllMediaFavoriteManager");

            if (File.Exists(favoriteManagerPath))
            {
                favoriteManager = JSONSerialManager.deserialize <FavoriteManager>(Path.Combine(FilePaths.rootPath,
                                                                                               "AllMediaFavoriteManager"));
            }
            if (favoriteManager == null)
            {
                favoriteManager = new FavoriteManager();
            }
        }
コード例 #2
0
        private async static Task <List <AbMediaContent> > deserializeContactFilesAsyc(IFolder dir)
        {
            IList <IFile> files = await dir.GetFilesAsync();

            List <AbMediaContent> filesRead = new List <AbMediaContent>(files.Count);

            foreach (IFile file in files)
            {
                ContactMediaContent media = JSONSerialManager.deserialize <ContactMediaContent>(file.Path);
                if (media != null)
                {
                    // Unfortunately ContactMedia fileds are not loaded when its JSON constructor is called
                    media.initialize(media.name, media.phoneNumber, media.imageFilePath);
                    filesRead.Add(media);
                }
            }
            return(filesRead);
        }