/// <summary> /// Domoticz get Graph data /// </summary> public async Task <GraphModel> GetGraphData(string idx, string type, ConstantValues.GraphRange range = ConstantValues.GraphRange.Day) { if (Server == null) { return(null); } var url = await App.ConnectionService.ConstructGetUrlAsync(Server, ConstantValues.Url.Log.GRAPH) + idx; url += ConstantValues.Url.Log.GRAPH_RANGE + range.ToString().ToLower(); url += ConstantValues.Url.Log.GRAPH_TYPE + type; App.AddLog("JSON Call: " + url); try { Response = await App.ConnectionService.Client.GetAsync(new Uri(url)); if (Response.IsSuccessStatusCode) { var content = await Response.Content.ReadAsStringAsync(); if (App.AppSettings.EnableJSONDebugging) { App.AddLog("JSON: " + content.Replace(Environment.NewLine, "")); } return(JsonConvert.DeserializeObject <GraphModel>(content)); } } catch (Exception ex) { App.AddLog(ex.Message); } return(null); }
public GraphPage(Device device, string sensor = "temp", ConstantValues.GraphRange showRange = ConstantValues.GraphRange.Day) { Title = device.Name; _range = showRange; _selectedDevice = device; _type = sensor; InitializeComponent(); InitGraphData(); if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS) { CrossDeviceOrientation.Current.OrientationChanged += OrientationChanged; } }