Add Library tab, replace PrintLibrary widget with Favorites bar

This commit is contained in:
John Lewin 2018-10-07 11:36:52 -07:00
parent 7159d78592
commit b67d3ad691
52 changed files with 2467 additions and 389 deletions

View file

@ -34,7 +34,9 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl.Library;
using MatterHackers.MatterControl.SlicerConfiguration;
using Newtonsoft.Json;
@ -76,6 +78,34 @@ namespace MatterHackers.MatterControl.SettingsManagement
public List<string> PreloadedLibraryFiles { get; } = new List<string>();
public ImageBuffer GetIcon(string oemName)
{
string cachePath = ApplicationController.CacheablePath("OemIcons", oemName + ".png");
try
{
if (File.Exists(cachePath))
{
return AggContext.ImageIO.LoadImage(cachePath);
}
}
catch
{
}
var imageBuffer = new ImageBuffer(16, 16).MultiplyWithPrimaryAccent();
ApplicationController.Instance.LoadRemoteImage(
imageBuffer,
ApplicationController.Instance.GetFavIconUrl(oemName),
scaleToImageX: false).ContinueWith(t =>
{
AggContext.ImageIO.SaveImageData(cachePath, imageBuffer);
});
return imageBuffer;
}
internal void SetManufacturers(IEnumerable<KeyValuePair<string, string>> unorderedManufacturers, List<string> whitelist = null)
{
// Sort manufacturers by name