private FrameworkElement GetElement(string name, string val = "") { var element = new FrameworkElement { Width = 24 }; switch (name) { case "speed": element = new Image { Width = 32, HorizontalAlignment = HorizontalAlignment.Center, Source = new BitmapImage(new Uri("/DTCDev.Client.Cars.Controls;component/Assets/Content/Images/speed.png", UriKind.Relative)) }; break; case "satelites": element = new Image { Width = 24, HorizontalAlignment = HorizontalAlignment.Center, Source = new BitmapImage(new Uri("/DTCDev.Client.Cars.Controls;component/Assets/Content/Images/satellite-dish-icon.png", UriKind.Relative)) }; break; case "XChart": element = new TextBlock { Width = 24, Text = "X", FontSize = 16, FontWeight = FontWeights.Bold, HorizontalAlignment = HorizontalAlignment.Stretch }; break; case "YChart": element = new TextBlock { Width = 24, Text = "Y", FontSize = 16, FontWeight = FontWeights.Bold, HorizontalAlignment = HorizontalAlignment.Stretch }; break; case "ZChart": element = new TextBlock { Width = 24, Text = "Z", FontSize = 16, FontWeight = FontWeights.Bold, HorizontalAlignment = HorizontalAlignment.Stretch }; break; default: Sensors.OBD.OBDSensorDetector detector = new Sensors.OBD.OBDSensorDetector(); return(detector.GetControl(name, val)); } return(element); }
private void RefreshView() { if (_obdCode.Length < 1 || _displayParams.Count() < 1) { return; } Sensors.OBD.OBDSensorDetector detector = new Sensors.OBD.OBDSensorDetector(); UIElement elm = detector.GetControl(_obdCode, _displayParams[0].Vol.ToString()); if (elm == null) { return; } grdControl.Children.Add(elm); CreateGraph(); }