December 2018
Intermediate to advanced
416 pages
10h 30m
English
We need to add code in the Exit() method to raise the events we created earlier:
private void Exit(){ Device.BeginInvokeOnMainThread(async () => { var direction = photo.TranslationX < 0 ? -1 : 1; if (direction > 0) { OnLike?.Invoke(this, new EventArgs()); } if (direction < 0) { OnDeny?.Invoke(this, new EventArgs()); } await photo.TranslateTo(photo.TranslationX + (_screenWidth * direction), photo.TranslationY, 200, Easing.CubicIn); var parent = Parent as Layout<View>; parent?.Children.Remove(this); });}
Here, we inject the code to check whether we are liking or disliking an image. We then raise the correct event based on this information. ...
Read now
Unlock full access