using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Settings; namespace Tango.PPC.Jobs { /// /// Represents the jobs module settings. /// /// public class JobsModuleSettings : SettingsBase { public class RecentCatalog { public String Guid { get; set; } public List RecentItems { get; set; } public RecentCatalog() { RecentItems = new List(); } } /// /// Gets or sets the recent catalogs items. /// public List RecentCatalogsItems { get; set; } /// /// Gets or sets the last job color space. /// public ColorSpaces? LastJobColorSpace { get; set; } /// /// Gets or sets the new job last type. /// public JobTypes? LastJobType { get; set; } /// /// Gets or sets the last selected catalog unique identifier. /// public String LastSelectedCatalogGuid { get; set; } /// /// Adds a catalog item to the recent list. /// /// The catalog. /// The catalog item. public void AddRecentCatalogItem(ColorCatalog catalog, ColorCatalogsItem item) { var recentCatalog = RecentCatalogsItems.FirstOrDefault(x => x.Guid == catalog.Guid); if (recentCatalog == null) { recentCatalog = new RecentCatalog(); recentCatalog.Guid = catalog.Guid; RecentCatalogsItems.Add(recentCatalog); } if (recentCatalog.RecentItems.Exists(x => x == item.Guid)) { recentCatalog.RecentItems.Remove(item.Guid); } recentCatalog.RecentItems.Insert(0, item.Guid); if (recentCatalog.RecentItems.Count > 20) { recentCatalog.RecentItems.RemoveAt(recentCatalog.RecentItems.Count - 1); } } /// /// Initializes a new instance of the class. /// public JobsModuleSettings() { RecentCatalogsItems = new List(); } } }