示例#1
0
        private async void Currently_Tapped(object sender, EventArgs e)
        {
            if (currentlyAt == null)
            {
                return;
            }

            var page = new CurrentlyAtPage(currentlyAt);
            await Navigation.PushAsync(page, true);
        }
示例#2
0
        private async void GetCurrently()
        {
            var AuthService = DependencyService.Get <IAuthService>();

            JObject jsonAuth = new JObject {
                { "login", AuthService.UserName },
                { "password", AuthService.Password },
                { "db", ServerAuth.DB }
            };

            JObject jsonDataObject = new JObject {
                { "auth", jsonAuth }
            };

            JObject jsonData = new JObject {
                { "params", jsonDataObject }
            };

            await WebService.Instance.PostAsync <CurrentlyAtResponse>(ApiUri.BASE_URL + ApiUri.CURRENTLY_AT, content : jsonData, onSuccess : async(res) =>
            {
                if (res.result != null)
                {
                    if (res.result.success)
                    {
                        currentlyAt = res.result;

                        currentlyStatus.Text = currentlyAt.Host;

                        var page = new CurrentlyAtPage(currentlyAt);
                        await Navigation.PushAsync(page, true);
                    }
                    else if (!string.IsNullOrWhiteSpace(res.result.message))
                    {
                        UserDialogs.Instance.Toast(new ToastConfig(res.result.message));
                        currentlyAt = default;
                    }
                    else
                    {
                        currentlyAt = default;
                    }
                }
                else
                {
                    currentlyAt = default;
                }
            });

            listPlatforms.EndRefresh();
        }