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()); } }
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); }
internal static void SaveRecentData(RecentListModel recentListModel, string recentFileName) { string filePath = GetRecentFilePath(recentFileName); XmlParser.ConvertToXml <RecentListModel>(recentListModel, filePath); }