Files
huehuehue/HueUWP/APIHandler.cs
T
2015-11-27 13:36:08 +01:00

37 lines
882 B
C#
Executable File

using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
namespace HueUWP
{
class APIHandler
{
NetworkHandler nwh;
public APIHandler(NetworkHandler nwh)
{
this.nwh = nwh;
}
private JObject ObjectifyfJson(string json)
{
json = json.Replace("[", "").Replace("]", "");
return JObject.Parse(json);
}
public async void Register()
{
var json = await nwh.RegisterName("Hue", "Kenneth&Yorick");
JObject o = ObjectifyfJson(json);
string id= o["success"]["username"].ToString();
MainPage.LOCAL_SETTINGS.Values["id"] = id;
}
}
}