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(); }
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(); }