Beispiel #1
0
        private void updateChartAsync(Windows.Foundation.Collections.IObservableVector <StationSensor> SennsorValue, Windows.Foundation.Collections.IVectorChangedEventArgs @event)
        {
            { // your code should be here
              //must be same instance, so quit if it doesn't exist

                uint idx = @event.Index;

                // StationLib.StationSensorValues SennsorValue;

                for (int i = 0; i < m_SensorMaps.Count; i++)
                {
                    SensorMapToScatterLine map = m_SensorMaps[i];

                    if (map.Sensors == SennsorValue)
                    {
                        CollectionChange ch = @event.CollectionChange;
                        switch (ch)
                        {
                        case CollectionChange.ItemChanged:
                            break;

                        case CollectionChange.ItemInserted:
                            insertintoChart(SennsorValue, map.LineSeries, (int)idx);
                            break;

                        case CollectionChange.ItemRemoved:
                        {
                            //
                            if (idx < map.LineSeries.DataPoints.Count)
                            {
                                map.LineSeries.DataPoints.RemoveAt((int)idx);
                            }
                        }
                        break;

                        case CollectionChange.Reset:
                            break;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void ChartView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            StationLib.StationSocketListener plistener;

            {
                ComboBox combo = sender as ComboBox;

                if (combo == null)
                {
                    return;
                }
                plistener = combo.DataContext as StationLib.StationSocketListener;
                if (plistener != null)
                {
                    for (int i = 0; i < m_SensorMaps.Count; i++)
                    {
                        SensorMapToScatterLine            map          = m_SensorMaps[i];
                        LineSeries                        lineseries   = map.LineSeries;
                        IObservableVector <StationSensor> SennsorValue = map.Sensors;

                        for (int k = 0; k < plistener.StationSensors.SensorValues.Count; k++)
                        {
                            StationLib.StationSensors sensors = plistener.StationSensors;
                            if (sensors.SensorValues == SennsorValue)
                            {
                                Telerik.UI.Xaml.Controls.Chart.PropertyNameDataPointBinding Ybinding = lineseries.ValueBinding as Telerik.UI.Xaml.Controls.Chart.PropertyNameDataPointBinding;
                                ChartViewType viewType = (ChartViewType)combo.SelectedItem;

                                if (Ybinding.PropertyName != viewType.ViewPropertyName)
                                {
                                    Ybinding.PropertyName = viewType.ViewPropertyName;
                                    fillChart(SennsorValue, lineseries);
                                }

                                break;
                            }
                        }
                    }
                }
            }
        }