コード例 #1
0
        void SetupPage()
        {
            StackLayout.Children.Clear();

            AddTitleRow("Title");

            var profileData = ProfileManager.Current.GetCachedProfileData(WalletApp.CurrentAccountId);

            ProfilePageSections.AddProfileSections(this, profileData, "Profile");

            AddHeaderRow("Profiles");

            if (WalletApp.IsCoreAccountUnlocked)
            {
                if (UIAppSettings.JoinedProfile)
                {
                    AddButtonRow("Edit", EditProfile);
                }
                else
                {
                    AddTextRow("JoinInfo").Label.ColorStyle = Theme.InfoColor;
                    AddLinkRow("Common.LearnMore", Tr.Get("Link.Profile"));
                    AddSubmitRow("Join", Join, false);
                }
            }
            else
            {
                AddTextRow("Common.Unlock").Label.ColorStyle = Theme.InfoColor;
            }

            AddButtonRow("ViewProfile", ViewProfile);
            AddFooterRow();

            UpdateSuspendedLayout();
        }
コード例 #2
0
        Task ProfileData(ProfileDataResultEvent arg)
        {
            if (arg.AccountId == _accountId && _profileType == StatusAccountProfileType.Big)
            {
                var profileData = arg.ProfileData;
                if (profileData.ProfileInfoResult == ProfileDownloadResult.Available)
                {
                    if (ProfilePageSections.HasProfileSections(this))
                    {
                        if (ProfilePageSections.UpdateProfileSections(this, arg.ProfileData))
                        {
                            UpdateSuspendedLayout();
                        }
                    }
                    else
                    {
                        AddIndex = GetRow("Title");
                        ProfilePageSections.AddProfileSections(this, arg.ProfileData, "Profile", _profileType == StatusAccountProfileType.Big);
                        UpdateSuspendedLayout();
                    }
                }
            }

            return(Task.CompletedTask);
        }
コード例 #3
0
        async Task UpdateProfileData(ProfileDataResultEvent arg)
        {
            foreach (var row in _updates)
            {
                var info = row.Tag as SubscriptionInfo;
                if (info.AccountId == arg.AccountId)
                {
                    var profileData = await ProfileManager.Current.GetProfileData(info.AccountId, ProfileDownloadType.DownloadIfNotAvailable, false);

                    ProfilePageSections.UpdateProfileRow(row, info.AccountId, profileData, info.Profile);
                    row.Tag = info;

                    break;
                }
            }
        }
コード例 #4
0
        async Task ProfileItemSelect(ButtonRow button)
        {
            var result = await DisplayProfileItemAction();

            if (result == ProfileItemActions.Edit)
            {
                await Navigation.PushAsync(new ProfileItemPage(this, button.Tag as ProfileItemJson));
            }
            else if (result == ProfileItemActions.Delete)
            {
                Status.RemoveBusyView(button);
                RemoveView(button);
            }
            else if (result == ProfileItemActions.MoveUp || result == ProfileItemActions.MoveDown)
            {
                var idx = StackLayout.Children.IndexOf(button);
                if (idx > 0)
                {
                    var hasNext = (StackLayout.Children[idx + 1] as StackRow)?.Tag is ProfileItemJson;
                    var hasPrev = (StackLayout.Children[idx - 1] as StackRow)?.Tag is ProfileItemJson;

                    if (hasNext && result == ProfileItemActions.MoveDown)
                    {
                        StackLayout.Children.RemoveAt(idx);
                        StackLayout.Children.Insert(idx + 1, button);
                    }
                    else if (hasPrev && result == ProfileItemActions.MoveUp)
                    {
                        StackLayout.Children.RemoveAt(idx);
                        StackLayout.Children.Insert(idx - 1, button);
                    }
                }
            }
            else if (result == ProfileItemActions.Invoke)
            {
                await ProfilePageSections.ProfileItemHandler(button);
            }
        }
コード例 #5
0
        Task ProfileAvailable(ProfileDataResultEvent profileEvent)
        {
            if (profileEvent.AccountId == WalletApp.CurrentAccountId)
            {
                switch (profileEvent.ProfileData.ProfileJsonResult)
                {
                case ProfileDownloadResult.Available:
                    ProfilePageSections.UpdateProfileSections(this, profileEvent.ProfileData);
                    UpdateSuspendedLayout();
                    _hasDownloaded = true;
                    break;

                case ProfileDownloadResult.NotAvailable:
                    _hasDownloaded = true;
                    break;

                case ProfileDownloadResult.NetworkError:
                    break;
                }
            }

            return(Task.CompletedTask);
        }