public LeagueMatchPage(Match match) { match.GameEvents.CollectionChanged += async(sender, e) => { await LocalStorage.Write(match); }; var orientationHandler = DependencyService.Get <IOrientationHandler>(); orientationHandler.ForceLandscape(); MatchVM = new LeagueMatchVM(match); var swipableFrame = new SwipeableFrame { Content = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { TopStack(), BottomStack(), } } }; Content = swipableFrame; swipableFrame.SwipedLeft += async(sender, e) => { if (MatchVM.ActivePlayer == MatchVM.Player2) { MatchVM.Miss(); await Notify("Miss"); } }; swipableFrame.SwipedRight += async(sender, e) => { if (MatchVM.ActivePlayer == MatchVM.Player1) { MatchVM.Miss(); await Notify("Miss"); } }; this.Appearing += (sender, e) => { orientationHandler.PreventLock(); }; this.Disappearing += (sender, e) => { orientationHandler.AllowLock(); }; }
public QuickMatchPage(Match match) { match.GameEvents.CollectionChanged += async(sender, e) => { await LocalStorage.Write(match); }; var orientationHandler = DependencyService.Get <IOrientationHandler>(); orientationHandler.ForceLandscape(); MatchVM = new QuickMatchVM(match); var swipableFrame = new SwipeableFrame { Content = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { TopStack(), BottomStack(), } } }; Content = swipableFrame; this.Appearing += (sender, e) => { orientationHandler.PreventLock(); }; this.Disappearing += (sender, e) => { orientationHandler.AllowLock(); }; }