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

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

                _firstUpdate = false;
            }
        }
示例#2
0
        private void UpdatePoints(StDevChartView 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(StDevChartView instance, EventPattern<PropertyChangedEventArgs> handler)
 {
     if (handler.EventArgs.PropertyName.Contains("Show"))
         UpdateDataPointTemplates(instance);
 }
示例#4
0
        private void OnAddNativeBehavior(StDevChartView 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));

                try
                {
                    currentControl.StDevChart.Behaviors.Add(nativeBehavior);
                    nativeBehavior.Parents.Add(currentControl.StDevChart);
                }
                catch(InvalidOperationException){}                
            });

            _isObsolete = true;
        }