示例#1
0
        private void UpdateDataPointTemplates(PChartView instance)
        {
            if (instance.PChart.ActualHeight > 1 && instance.PChart.Height >= 1)
            {
                instance.PChart.Height -= 1;               
                _restoreBorder = true;
            }

            if (_firstUpdate)
            {
                Observable.FromEventPattern<SizeChangedEventHandler, SizeChangedEventArgs>(
                    handler => instance.PChart.SizeChanged += handler,
                    handler => instance.PChart.SizeChanged -= handler
                ).SubscribeWeakly(this, (target, handler) =>
                {
                    if (target._restoreBorder)
                    {
                        target.PChart.Height += (handler.EventArgs.PreviousSize.Height - handler.EventArgs.NewSize.Height);
                        target._restoreBorder = false;
                    }
                });

                _firstUpdate = false;
            }
        }
示例#2
0
        private void UpdatePoints(PChartView instance, EventPattern<PropertyChangedEventArgs> handler)
        {
            if (((ChartBase)DataContext).DataSource.Count > 0)
            {
                if (handler.EventArgs.PropertyName == "USL" || handler.EventArgs.PropertyName == "LSL")
                    UpdateDataPointTemplates(instance);

                if (handler.EventArgs.PropertyName.Contains("Show"))
                    OnPropertyChanged("ShowSpecsCheckbox");
            }
        }
示例#3
0
 private void OnDataContextPropertyChanged(PChartView instance, EventPattern<PropertyChangedEventArgs> handler)
 {
     if (handler.EventArgs.PropertyName.Contains("Show"))
         UpdateDataPointTemplates(instance);
     if (handler.EventArgs.PropertyName == "AverageLimits")
         UpdateControlLimits(instance.DataContext as ChartBase);
 }
示例#4
0
        private void OnAddNativeBehavior(PChartView currentControl, EventPattern<EventArgs> eventPattern)
        {
            Dispatcher.BeginInvoke(() =>
            {
                var nativeBehavior = ((TrackballBehavior)eventPattern.Sender);

                Observable.FromEventPattern<EventHandler<TrackBallInfoEventArgs>, TrackBallInfoEventArgs>(
                    handler => nativeBehavior.TrackInfoUpdated += handler,
                    handler => nativeBehavior.TrackInfoUpdated -= handler
                ).SubscribeWeakly(this, (target, handler) => target.ChartTrackBallBehavior_TrackInfoUpdated(handler.Sender, handler.EventArgs));

                currentControl.PChart.Behaviors.Add(nativeBehavior);
                nativeBehavior.Parents.Add(currentControl.PChart);
            });
        }