private async void UpdatePlotWithServerResponse() { string responseText = await Server.GETwithClient(); ServerData resposneJson = JsonConvert.DeserializeObject <ServerData>(responseText); UpdatePlot(resposneJson.x, resposneJson.y); }
private async void UpdateTableWithServerResponse() { string responseText = await Server.GETwithClient(); ServerData resposneJson = JsonConvert.DeserializeObject <ServerData>(responseText); UpdateTable(unitFlag, resposneJson); }
private async void UpdatePlotWithServerResponse() { string responseText = await Server.GETwithClient(); ServerData resposneJson = JsonConvert.DeserializeObject <ServerData>(responseText); if (buttonFlag == "Roll") { UpdatePlot(timeStamp / 1000.0, resposneJson.roll); } if (buttonFlag == "Pitch") { UpdatePlot(timeStamp / 1000.0, resposneJson.pitch); } if (buttonFlag == "Yaw") { UpdatePlot(timeStamp / 1000.0, resposneJson.yaw); } timeStamp += deserialized.sampleTime; }
private async void UpdatePlotWithServerResponse() { string responseText = await Server.GETwithClient(); ServerData resposneJson = JsonConvert.DeserializeObject <ServerData>(responseText); if (buttonFlag == "Temperature") { UpdatePlot(timeStamp / 1000.0, resposneJson.temperature); } if (buttonFlag == "Pressure") { UpdatePlot(timeStamp / 1000.0, resposneJson.pressure); } if (buttonFlag == "Humidity") { UpdatePlot(timeStamp / 1000.0, resposneJson.humidity); } timeStamp += deserialized.sampleTime; }
private async void UpdateLabelsWithServerResponse() { labelFlag = 1; string responseText = await Server.GETwithClient(); //przypisanie wartości null co by mozna było je porównać nullableServerData responseJson = new nullableServerData(); responseJson.temperature = null; responseJson.humidity = null; responseJson.pressure = null; responseJson.pitch = null; responseJson.roll = null; responseJson.yaw = null; responseJson.y = null; responseJson.x = null; responseJson.mid = null; responseJson = JsonConvert.DeserializeObject <nullableServerData>(responseText); #region calc&assignVals //temperature if (responseJson.temperature != null) { double normaDouble = responseJson.temperature ?? 0; double temporaryTemp = Math.Round(normaDouble, dec); if (unitFlag == "basicUnits") { tempString = "Temperature: " + temporaryTemp.ToString() + " [°C]"; } if (unitFlag == "otherUnits") { temporaryTemp = temporaryTemp * 1.8 + 32; temporaryTemp = Math.Round(temporaryTemp, dec); tempString = "Temperature: " + temporaryTemp.ToString() + " [°F]"; } UpdateString(tempString); labelFlag++; } if (responseJson.temperature == null) { //doNothing } //humidity if (responseJson.humidity != null) { double normaDouble = responseJson.humidity ?? 0; double temporary = Math.Round(normaDouble, dec); if (unitFlag == "basicUnits") { tempString = "Humidity: " + temporary.ToString() + " [%rH]"; } if (unitFlag == "otherUnits") { temporary = temporary / 100; temporary = Math.Round(temporary, dec); tempString = "Humidity: " + temporary.ToString() + " [0-1]"; } UpdateString(tempString); labelFlag++; } if (responseJson.humidity == null) { //doNothing } //pressure if (responseJson.pressure != null) { double normaDouble = responseJson.pressure ?? 0; double temporary = Math.Round(normaDouble, dec); if (unitFlag == "basicUnits") { tempString = "Pressure: " + temporary.ToString() + " [hPa]"; } if (unitFlag == "otherUnits") { temporary = temporary * 0.750062; temporary = Math.Round(temporary, dec); tempString = "Pressure: " + temporary.ToString() + " [mmHg]"; } UpdateString(tempString); labelFlag++; } if (responseJson.pressure == null) { //doNothing } //roll if (responseJson.roll != null) { double normaDouble = responseJson.roll ?? 0; double temporaryTemp = Math.Round(normaDouble, dec); if (unitFlag == "basicUnits") { tempString = "Roll: " + temporaryTemp.ToString() + " [DRG]"; } if (unitFlag == "otherUnits") { temporaryTemp = temporaryTemp * Math.PI / 180; temporaryTemp = Math.Round(temporaryTemp, dec); tempString = "Roll: " + temporaryTemp.ToString() + " [RAD]"; } UpdateString(tempString); labelFlag++; } if (responseJson.roll == null) { //doNothing } //pitch if (responseJson.pitch != null) { double normaDouble = responseJson.pitch ?? 0; double temporaryTemp = Math.Round(normaDouble, dec); if (unitFlag == "basicUnits") { tempString = "Pitch: " + temporaryTemp.ToString() + " [DRG]"; } if (unitFlag == "otherUnits") { temporaryTemp = temporaryTemp * Math.PI / 180; temporaryTemp = Math.Round(temporaryTemp, dec); tempString = "Pitch: " + temporaryTemp.ToString() + " [RAD]"; } UpdateString(tempString); labelFlag++; } if (responseJson.pitch == null) { //doNothing } //yaw if (responseJson.yaw != null) { double normaDouble = responseJson.yaw ?? 0; double temporaryTemp = Math.Round(normaDouble, dec); if (unitFlag == "basicUnits") { tempString = "Yaw: " + temporaryTemp.ToString() + " [DRG]"; } if (unitFlag == "otherUnits") { temporaryTemp = temporaryTemp * Math.PI / 180; temporaryTemp = Math.Round(temporaryTemp, dec); tempString = "Yaw: " + temporaryTemp.ToString() + " [RAD]"; } UpdateString(tempString); labelFlag++; } if (responseJson.yaw == null) { //doNothing } //x if (responseJson.x != null) { int normalInt = responseJson.x ?? 0; tempString = "X: " + normalInt.ToString(); UpdateString(tempString); labelFlag++; } if (responseJson.x == null) { //doNothing } //y if (responseJson.y != null) { int normalInt = responseJson.y ?? 0; tempString = "Y: " + normalInt.ToString(); UpdateString(tempString); labelFlag++; } if (responseJson.y == null) { //doNothing } //mid if (responseJson.mid != null) { int normalInt = responseJson.mid ?? 0; tempString = "MID: " + normalInt.ToString(); UpdateString(tempString); labelFlag++; } if (responseJson.mid == null) { //doNothing } #endregion }