Skip to content

Instantly share code, notes, and snippets.

@PureWeen
Last active July 6, 2019 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PureWeen/cf994a7c160ce7f274d03d12cf3da1d2 to your computer and use it in GitHub Desktop.
Save PureWeen/cf994a7c160ce7f274d03d12cf3da1d2 to your computer and use it in GitHub Desktop.
public FormsView
{
  Func<Point, bool> _setInitialTransformationCallBack;
  
  // could hide this behind explicit interface
  public void RegisterCallBack(Func<Point, bool> callback)
  {
    _setInitialTransformationCallBack = callback;
  }
  
  public bool SetInitialTransformation(Point screenLocation)
  {
      return _setInitialTransformationCallBack(screenLocation);
  }
}
public abstract class RendererBase
{
  public void OnElementChanged(FormsView view)
  {
      view.RegisterCallBack(SetInitialTransformation);
  }
  
  public abstract bool SetInitialTransformation(Point screenLocation);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment