/// <summary> /// Возвращает последние открытые шаблоны приложения /// </summary> /// <param name="templatesCount">Количество возвращаемых шаблонов</param> /// <returns></returns> public static RecentTemplates GetRecentTemplates(int templatesCount) { RecentTemplates result = new RecentTemplates(); if (Properties.Settings.Default.RecentTemplates != null) { int i = 0; foreach (var rt in Properties.Settings.Default.RecentTemplates) { if (System.IO.File.Exists(rt.Path)) { if (i < templatesCount) { result.Add(rt); } i++; } else { Properties.Settings.Default.RecentTemplates.Remove(rt); Properties.Settings.Default.Save(); } } } return result; }
/// <summary> /// Возвращает последние открытые шаблоны приложения /// </summary> /// <param name="templatesCount">Количество возвращаемых шаблонов</param> /// <returns></returns> public static RecentTemplates GetRecentTemplates(int templatesCount) { RecentTemplates result = new RecentTemplates(); if (Properties.Settings.Default.RecentTemplates != null) { int i = 0; foreach (var rt in Properties.Settings.Default.RecentTemplates) { if (System.IO.File.Exists(rt.Path)) { if (i < templatesCount) { result.Add(rt); } i++; } else { Properties.Settings.Default.RecentTemplates.Remove(rt); Properties.Settings.Default.Save(); } } } return(result); }