コード例 #1
0
        private void SensorValues_VectorChanged(Windows.Foundation.Collections.IObservableVector <StationSensor> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event)
        {
            uint idx = @event.Index;

            Windows.Foundation.Collections.IObservableVector <StationSensor> sensors = sender  as Windows.Foundation.Collections.IObservableVector <StationSensor>;
            if (sensors != null)
            {
                updateChartAsync(sensors, @event);
            }
        }
コード例 #2
0
        private void _view_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs e)
        {
            if (_props == null || _props.Count == 0 || _itemType != GetItemType(_view))
            {
                if (_itemType == null || !Utils.IsPrimitive(_itemType))
                {
                    if (GetItemType(_view) != typeof(object))
                    {
                        OnItemsSourceChanged();
                        return;
                    }
                }
            }

            // handle the collection change
            OnViewChanged(sender, e);
        }
コード例 #3
0
        private async void Items_VectorChanged(Windows.Foundation.Collections.IObservableVector <MediaPlaybackItem> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event)
        {
            if (disposed)
            {
                return;
            }

            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (disposed)
                {
                    return;
                }

                HandlePlaybackListChanges(sender);
            });
        }
コード例 #4
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;
                        }
                    }
                }
            }
        }
コード例 #5
0
        private void insertintoChart(Windows.Foundation.Collections.IObservableVector <StationSensor> SennsorValue, LineSeries lineseries, int Idx)
        {
            if (Idx >= SennsorValue.Count)
            {
                return;
            }


            StationSensor sensor = SennsorValue[Idx];
            double        YValue = 0;

            Telerik.UI.Xaml.Controls.Chart.PropertyNameDataPointBinding Ybinding = lineseries.ValueBinding as Telerik.UI.Xaml.Controls.Chart.PropertyNameDataPointBinding;
            if (Ybinding != null)
            {
                if (Ybinding.PropertyName == "Temperature")
                {
                    YValue = sensor.Temperature;
                }
                else if (Ybinding.PropertyName == "FillingLevel")
                {
                    YValue = sensor.FillingLevel;
                }
                else if (Ybinding.PropertyName == "FillingVolume")
                {
                    YValue = sensor.FillingVolume;
                }
                else if (Ybinding.PropertyName == "Pressure")
                {
                    YValue = sensor.PressurehPaSeaLevel;
                }
                else if (Ybinding.PropertyName == "HCSR04MeasTime")
                {
                    YValue = sensor.HCSR04MeasTime;
                }
                else if (Ybinding.PropertyName == "HCSR04MeasTimeDistance")
                {
                    YValue = sensor.HCSR04MeasTimeDistance;
                }
                else if (Ybinding.PropertyName == "Distance")
                {
                    YValue = sensor.Distance;
                }
                else if (Ybinding.PropertyName == "Humidity")
                {
                    YValue = sensor.Humidity;
                }
                else
                {
                    YValue = 0;
                }
            }

            ChartViewType viewType = (ChartViewType)ChartViewCombo.SelectedItem;

            if (viewType != null)
            {
                viewType.ActValue = YValue;
            }

            DateTime dt = FillingLevelApp.Helpers.DateTimeConverter.UnixTimeStampToUTCDateTime(sensor.UnixTime).ToLocalTime();

            lineseries.DataPoints.Add(new CategoricalDataPoint()
            {
                Category = dt, Value = YValue
            });
        }
コード例 #6
0
 void View_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event)
 {
     UpdateCompanyStatus();
 }