Exemplo n.º 1
0
        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();
            };
        }
Exemplo n.º 2
0
        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();
            };
        }
Exemplo n.º 3
0
        protected override void OnElementChanged(ElementChangedEventArgs <Frame> ev)
        {
            base.OnElementChanged(ev);

            SwipeableFrame = (SwipeableFrame)ev.NewElement;
        }