コード例 #1
0
        private static ObservableCollection <CoverCard> GetDefaultList()
        {
            CoverCard card1 = new CoverCard()
            {
                ImgUrl   = "https://resources.tidal.com/images/19e4f65c/97f5/43b3/b0ff/7855f0646f95/320x320.jpg",
                Title    = "1989 (Deluxe Edition)",
                SubTitle = "Taylor Swift",
                Url      = "https://listen.tidal.com/album/121444594",
            };
            CoverCard card2 = new CoverCard()
            {
                ImgUrl   = "https://resources.tidal.com/images/5ea6c02a/938d/4641/8fd9/8de90df7d087/320x320.jpg",
                Title    = "Happy End",
                SubTitle = "Back Number",
                Url      = "https://listen.tidal.com/album/103578093",
            };
            CoverCard card3 = new CoverCard()
            {
                ImgUrl   = "https://resources.tidal.com/images/bf3796e4/52f2/4d4b/896c/e39ce41a17df/320x320.jpg",
                Title    = "Doo-Wops & Hooligans",
                SubTitle = "Bruno Mars",
                Url      = "https://listen.tidal.com/album/4935184",
            };
            ObservableCollection <CoverCard> pCards = new ObservableCollection <CoverCard>();

            pCards.Add(card1);
            pCards.Add(card2);
            pCards.Add(card3);

            string sjson = JsonHelper.ConverObjectToString <ObservableCollection <CoverCard> >(pCards);

            FileHelper.Write(sjson, true, "./covercards.json");

            return(pCards);
        }
コード例 #2
0
        public static T ReadWrite <T>(string path, T wObj = default(T))
        {
            string sText;

            if (wObj == null)
            {
                sText = FileHelper.Read(path);
                T rObj = JsonHelper.ConverStringToObject <T>(sText);
                return(rObj);
            }

            sText = JsonHelper.ConverObjectToString <T>(wObj);
            FileHelper.Write(sText, true, path);
            return(default(T));
        }
コード例 #3
0
        public bool Save()
        {
            string data = JsonHelper.ConverObjectToString <UserSettings>(this, true);

            return(FileHelper.Write(data, true, Global.PATH_USERSETTINGS));
        }