/// <summary> /// Creates a square image and attaches an event handler to the layout changed event that /// adds the the square in the upper right-hand corner of the TextView via the adornment layer /// </summary> /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param> /// <param name="imageProvider">The <see cref="IImageProvider"/> which provides bitmaps to draw</param> /// <param name="setting">The <see cref="Setting"/> contains user image preferences</param> public ClaudiaIDE(IWpfTextView view, IImageProvider imageProvider, Setting setting) { try { _dispacher = Dispatcher.CurrentDispatcher; _imageProvider = imageProvider; _view = view; _positionHorizon = setting.PositionHorizon; _positionVertical = setting.PositionVertical; _imageOpacity = setting.Opacity; _fadeTime = setting.ImageFadeAnimationInterval; _image = new Image { Opacity = setting.Opacity, IsHitTestVisible = false }; _adornmentLayer = view.GetAdornmentLayer("ClaudiaIDE"); _view.ViewportHeightChanged += delegate { RepositionImage(); }; _view.ViewportWidthChanged += delegate { RepositionImage(); }; _view.ViewportLeftChanged += delegate { RepositionImage(); }; _imageProvider.NewImageAvaliable += delegate { _dispacher.Invoke(ChangeImage); }; ChangeImage(); } catch (Exception) { } }
public static System.Windows.VerticalAlignment ConvertToVerticalAlignment(this PositionV source) { switch (source) { case PositionV.Bottom: return(System.Windows.VerticalAlignment.Bottom); case PositionV.Center: return(System.Windows.VerticalAlignment.Center); case PositionV.Top: return(System.Windows.VerticalAlignment.Top); } return(System.Windows.VerticalAlignment.Bottom); }
public static System.Windows.Media.AlignmentY ConvertTo(this PositionV source) { switch (source) { case PositionV.Bottom: return(System.Windows.Media.AlignmentY.Bottom); case PositionV.Center: return(System.Windows.Media.AlignmentY.Center); case PositionV.Top: return(System.Windows.Media.AlignmentY.Top); } return(System.Windows.Media.AlignmentY.Bottom); }
public static AlignmentY ConvertTo(this PositionV source) { switch (source) { case PositionV.Bottom: return(AlignmentY.Bottom); case PositionV.Center: return(AlignmentY.Center); case PositionV.Top: return(AlignmentY.Top); } return(AlignmentY.Bottom); }