/// <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.Media.AlignmentX ConvertTo(this PositionH source) { switch (source) { case PositionH.Left: return(System.Windows.Media.AlignmentX.Left); case PositionH.Center: return(System.Windows.Media.AlignmentX.Center); case PositionH.Right: return(System.Windows.Media.AlignmentX.Right); } return(System.Windows.Media.AlignmentX.Right); }
public static HorizontalAlignment ConvertToHorizontalAlignment(this PositionH source) { switch (source) { case PositionH.Left: return(HorizontalAlignment.Left); case PositionH.Center: return(HorizontalAlignment.Center); case PositionH.Right: return(HorizontalAlignment.Right); } return(HorizontalAlignment.Right); }
public static AlignmentX ConvertTo(this PositionH source) { switch (source) { case PositionH.Left: return(AlignmentX.Left); case PositionH.Center: return(AlignmentX.Center); case PositionH.Right: return(AlignmentX.Right); } return(AlignmentX.Right); }