コード例 #1
0
        public static RecentListModel ReadRecentList(string recentFileName)
        {
            string filePath = GetRecentFilePath(recentFileName);

            if (!File.Exists(filePath))
            {
#if DEBUG
                //var recentList = new RecentListModel();
                //recentList.Add(new RecentItem() { QuotationNo = "1234567", NRIC = "XXX-YYY" });
                //recentList.Add(new RecentItem() { QuotationNo = "1234568", NRIC = "YYY-ZZZ" });
                //recentList.Add(new RecentItem() { QuotationNo = "1234569", NRIC = "XXX-ZZZ" });
                //return recentList;
#else
                //return new RecentListModel();
#endif
                return(new RecentListModel());
            }
            try
            {
                RecentListModel recentListModel = XmlParser.ConvertFromXml <RecentListModel>(filePath);
                return(recentListModel);
            }
            catch
            {
                return(new RecentListModel());
            }
        }
コード例 #2
0
        public static void AddRecentData(RecentItem recentItem, string recentFileName)
        {
            RecentListModel recentListModel = null;
            string          filePath        = GetRecentFilePath(recentFileName);

            if (!File.Exists(filePath))
            {
                recentListModel = new RecentListModel();
            }
            try
            {
                recentListModel = XmlParser.ConvertFromXml <RecentListModel>(filePath);
            }
            catch
            {
                recentListModel = new RecentListModel();
            }

            recentListModel.Add(recentItem);
            XmlParser.ConvertToXml <RecentListModel>(recentListModel, filePath);
        }
コード例 #3
0
        internal static void SaveRecentData(RecentListModel recentListModel, string recentFileName)
        {
            string filePath = GetRecentFilePath(recentFileName);

            XmlParser.ConvertToXml <RecentListModel>(recentListModel, filePath);
        }