Implemented MC side receive of Public Profile list and public profiles

This commit is contained in:
Matt Moening 2016-06-22 18:05:52 -07:00
parent e926186f6b
commit bc5ef8a5b3
8 changed files with 229 additions and 36 deletions

View file

@ -38,6 +38,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
using Agg;
using Localizations;
using VersionManagement;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Net;
@ -272,18 +273,14 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private static OemProfile LoadHttpOemProfile(string make, string model)
{
string url = string.Format(
"http://matterdata.azurewebsites.net/api/oemprofiles?manufacturer={0}&model={1}",
WebUtility.UrlEncode(make),
WebUtility.UrlEncode(model));
var client = new WebClient();
string profileText = client.DownloadString(url);
var printerProfile = JsonConvert.DeserializeObject<OemProfile>(profileText);
RetrievePublicProfileRequest profileRequest = new RetrievePublicProfileRequest();
string profText = profileRequest.getPrinterProfileByMakeModel(make, model);
var printerProfile = JsonConvert.DeserializeObject<OemProfile>(profText);
return printerProfile;
}
private static void Profiles_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
// Any time the list changes, persist the updates to disk