示例#1
0
        protected override async Task onOpenItem()
        {
            if (App.Navigator.GetOpenedPage(typeof(GameHostPage)) != null)
            {
                return;
            }

            var page = new GameHostPage(false, false);

            page.OpenGameHost(this.item.ID);
            await App.Navigator.NavPage.Navigation.PushAsync(page);

            page.Disappearing += (s1, e1) =>
            {
                if (page.AnythingChanged)
                {
                    this.fireNeedsARefresh();
                }
            };
        }
示例#2
0
        async Task openGameHostPage(int gameHostID)
        {
            if (this.IgnoreSingleItemTaps)
            {
                return;
            }
            if (App.Navigator.GetOpenedPage(typeof(GameHostPage)) != null)
            {
                return;
            }

            var page = new GameHostPage(false, false);
            await page.OpenGameHost(gameHostID);

            await App.Navigator.NavPage.Navigation.PushAsync(page);

            page.Disappearing += (s1, e1) =>
            {
                if (this.UserChangedSomething != null && page.AnythingChanged)
                {
                    this.UserChangedSomething(this, EventArgs.Empty);
                }
            };
        }
示例#3
0
        public async Task <bool> ProcessOpenUrl(string url)
        {
            if (App.LoginAndRegistrationLogic.RegistrationStatus != RegistrationStatusEnum.Registered)
            {
                return(false);
            }

            // for URL Schemas: 2015/09/25: read this: http://riccardo-moschetti.org/2014/10/03/opening-a-mobile-app-from-a-link-the-xamarin-way-url-schemas/
            // for Universal links: https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html

            url = url.ToLower();

            if (!(url.StartsWith("https://snookerbyb.com") || // universal links
                  url.StartsWith("snookerbyb.com") ||         // universal links
                  url.StartsWith("snookerbyb:")))             // app links / URL schemas
            {
                return(false);
            }

            try
            {
                // remove everything after "?"
                int indexQ = url.IndexOf('?');
                if (indexQ >= 0)
                {
                    url = url.Substring(0, indexQ);
                }

                // parse the id
                int index = url.LastIndexOf("/");
                if (index < 0)
                {
                    return(false);
                }
                string strID = url.Substring(index + 1, url.Length - index - 1);
                int    id;
                if (!int.TryParse(strID, out id))
                {
                    return(false);
                }

                if (url.Contains("/athlete") || url.Contains("/player"))
                {
                    await this.GoToPersonProfile(id);

                    return(true);
                }
                if (url.Contains("/venue"))
                {
                    await this.GoToVenueProfile(id);

                    return(true);
                }
                else if (url.Contains("/comment"))
                {
                    this.OpenNewsfeedItemPage(id);
                    return(true);
                }
                else if (url.Contains("/gamehost") || url.Contains("/invite"))
                {
                    bool isExpectedToAcceptInvitation = false;
                    //if (url.Contains("/gamehost/accept"))
                    //	isExpectedToAcceptInvitation = true;

                    var page = new GameHostPage(isExpectedToAcceptInvitation);
                    await this.NavPage.Navigation.PushModalAsync(page);

                    await page.OpenGameHost(id);

                    return(true);
                }
                else if (url.Contains("/sync"))
                {
                    this.StartSyncAndCheckForNotifications();
                    await this.GoToMyProfile(ProfilePersonStateEnum.Matches, false);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }