public CurveDrawingSurface( ICurvePool curvePool, InputReference inputReference) { RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.Linear); // Wichtig für "Pan" und "Zoom" ClipToBounds = true; _curvePool = curvePool; _curvePool.CurveAdded += OnCurveAdded; _curvePool.CurveRemoved += OnCurveRemoved; inputReference.InputElement.MouseMove += (s, e) => HandleMouseMove(e); inputReference.InputElement.MouseLeave += (s, e) => HandleMouseLeave(e); inputReference.InputElement.MouseLeftButtonUp += (s, e) => HandleMouseLeftButtonUp(e); inputReference.InputElement.MouseLeftButtonDown += (s, e) => HandleMouseLeftButtonDown(e); inputReference.InputElement.MouseRightButtonUp += (s, e) => HandleMouseRightButtonUp(e); inputReference.InputElement.MouseRightButtonDown += (s, e) => HandleMouseRightButtonDown(e); _redrawSubject = new Subject<object>(); _redrawSubject //.Skip(1) .Throttle(TimeSpan.FromMilliseconds(50)) .Subscribe(it => _redrawEvent.Set()); _redrawThread = new Thread(RedrawThreadProc); _redrawThread.IsBackground = true; _redrawThread.SetApartmentState(ApartmentState.STA); _redrawThread.Start(); }
public TableLegendViewModel( ICurvePool curvePool, IStaticRulerManager staticRulerManager, RefRulerColumnCollection refRulerColumnCollection, Func<int, RulerColumnCollection> createRulerColumnCollection) { _curvePool = curvePool; // TODO: Wenn sich die Kurven-Daten ändern, müssen die Rulers ebenfalls upgedatet werden _curvePool.CurveAdded += CurveAdded; _curvePool.CurveRemoved += CurveRemoved; _curvePool.Curves .OfType<TimeDoubleCurve>() .ForEachElement(it => _curves.Add(new TableLegendItemViewModel(it))); _staticRulerManager = staticRulerManager; _staticRulerManager.RulersChanged += ResetRulerColumns; _staticRulerManager.ReferenceRulerChanged += ResetRulerColumns; _updateRulerObservable = _updateRulerValuesSubject .Sample(TimeSpan.FromMilliseconds(100)) .ObserveOn(SynchronizationContext.Current) .Subscribe(o => UpdateRulerColumns()); _refRulerColumnCollection = refRulerColumnCollection; _createRulerColumnCollection = createRulerColumnCollection; }
internal Curve( IRedrawRequest redrawRequest, ICurveContextMenuSurface curveContextMenuSurface, ICurvePool curvePool, ContextMenuControl contextMenuControl) { _curveContextMenuSurface = curveContextMenuSurface; _curvePool = curvePool; RedrawRequest = redrawRequest; Description = new CurveDescription(); Description.PropertyChanged += (s, e) => OnPropertyChanged("Description." + e.PropertyName); _contextMenuControl = contextMenuControl; _curveContextMenuSurface.Register(_contextMenuControl); NeedsRedraw = true; }
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(); }