Пример #1
0
        private void UpdateDataPointTemplates(XMRChartView instance)
        {
            if (instance.XMRChart.ActualHeight > 1 && instance.XMRChart.Height >= 1)
            {
                instance.XMRChart.Height -= 1;               
                _restoreBorder = true;
            }

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

                _firstUpdate = false;
            }
        }
Пример #2
0
        private void UpdatePoints(XMRChartView 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(XMRChartView instance, EventPattern<PropertyChangedEventArgs> handler)
 {
     if (handler.EventArgs.PropertyName.Contains("Show"))
         UpdateDataPointTemplates(instance);
 }
Пример #4
0
        private void OnAddNativeBehavior(XMRChartView 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.XMRChart.Behaviors.Add(nativeBehavior);
                    nativeBehavior.Parents.Add(currentControl.XMRChart);
                }
                catch (InvalidOperationException){}
            });

            _isObsolete = true;
        }