public SectionZoomManager(
			InputReference inputReference,
			TimeAxis timeAxis,
			IDoubleAxesGroupPool axesGroupPool,
			IDrawingAreaInfo drawingAreaInfo,
			IOnlineMode onlineMode)
        {
            _timeAxis = timeAxis;
            _axesGroupPool = axesGroupPool;
            _drawingAreaInfo = drawingAreaInfo;

            _onlineMode = onlineMode;
            // TODO: abhängen
            _onlineMode.IsOnlineChanged += (s, e) =>
                {
                    if (_onlineMode.IsOnline)
                        IsActive = false;
                };

            InitializeComponent();

            // Preview-Event ist wichtig, damit alle anderen Elemente nicht informiert werden
            inputReference.InputElement.PreviewMouseLeftButtonDown += InputElement_PreviewMouseLeftButtonDown;
            MouseMove += this_MouseMove;
            MouseLeftButtonUp += this_MouseLeftButtonUp;
        }
Example #2
0
        public TimeScale(
			TimeAxis timeAxis,
			IHDynamicRulerEventBroker dynamicRulerEventBroker,
			HStepHelper hStepHelper,
			IOnlineMode onlineMode)
        {
            _timeAxis = timeAxis;
            _timeAxis.BoundsChanged += (s, e) => UpdateSectionLabels();
            _timeAxis.BoundsChanged += (s, e) => UpdateDynamicRulerLabel();

            _hStepHelper = hStepHelper;
            _hStepHelper.StepsChanged += (s, e) =>
            {
                CreateSectionLabels();
                UpdateSectionLabels();
            };

            _onlineMode = onlineMode;
            _onlineMode.IsOnlineChanged += (s, e) => OnPropertyChanged("IsInOfflineMode");

            IntervalLeftCommand = new RelayCommand(IntervalLeft);
            IntervalRightCommand = new RelayCommand(IntervalRight);

            InitializeComponent();

            MouseEnter += (s, e) => UpdateVisualStates();
            MouseLeave += (s, e) => UpdateVisualStates();

            var uiMoveHelper = new UiMoveHelper(MoveScaleSurface, Cursors.ScrollWE, onlineMode);
            uiMoveHelper.Moved += uiMoveHelper_Moved;

            var scaleZoomHelper = new ScaleZoomHelper(MoveScaleSurface, true);
            scaleZoomHelper.Scrolled += scaleZoomHelper_Scrolled;

            dynamicRulerEventBroker.ShowRuler += ShowDynamicRulerLabel;
            dynamicRulerEventBroker.HideRuler += HideDynamicRulerLabel;

            _updateRulerObservable = Observable
                .FromEventPattern<DynamicRulerChangedEventArgs>(dynamicRulerEventBroker, "UpdateRuler")
                .ObserveOn(SynchronizationContext.Current)
                .Subscribe(evt => UpdateDynamicRuler(evt.EventArgs));

            CreateSectionLabels();
            UpdateSectionLabels();
        }
        public HStaticRulerControl(
			HStaticRuler staticRuler,
			IStaticRulerManager staticRulerManager,
			IHStaticRulerSurface rulerSurface,
			TimeAxis timeAxis,
			ICurvePool curvePool,
			IOnlineMode onlineMode,
			IDrawingAreaInfo drawingAreaInfo)
        {
            _timeAxis = timeAxis;
            _timeAxis.BoundsChanged += (s, e) =>
                {
                    UpdatePosition();
                    UpdateDiffs();
                };

            _drawingAreaInfo = drawingAreaInfo;
            _drawingAreaInfo.DrawingSizeChanged += (s, e) =>
                {
                    UpdatePosition();
                    UpdateDiffs();
                };

            _staticRuler = staticRuler;
            _staticRuler.PositionUpdated += (s, e) => UpdatePosition();

            _staticRulerManager = staticRulerManager;
            _staticRulerManager.ReferenceRulerChanged += () =>
                {
                    OnPropertyChanged("IsReference");
                    UpdateDiffs();
                };

            _rulerSurface = rulerSurface;

            RemoveCommand = new RelayCommand(Remove);
            SetAsReferenceCommand = new RelayCommand(_staticRuler.ToggleReference);

            _onlineMode = onlineMode;

            _curvePool = curvePool;
            _curvePool.SelectedCurveChanged += (s, e) => UpdateDiffs();

            InitializeComponent();

            _moveHelper = new UiMoveHelper(backgroundGrid, Cursors.ScrollWE, _onlineMode);
            _moveHelper.Moved += moveHelper_Moved;
            _moveHelper.IsCapturedChanged += MenuStateChanged;

            MouseEnter += (s, e) =>
                {
                    MenuStateChanged();
                    UpdateZIndex();
                };
            MouseLeave += (s, e) =>
                {
                    MenuStateChanged();
                    UpdateZIndex();
                };
            menuPopup.MouseEnter += (s, e) => MenuStateChanged();
            menuPopup.MouseLeave += (s, e) => MenuStateChanged();

            UpdatePosition();
            UpdateDiffs();
        }