コード例 #1
0
        public StatusAccountPage(ProfileDataResult profileData, ServiceNode serviceNode, long accountId, StatusAccountProfileType profileType, long transactionId) : base("StatusAccountPage")
        {
            Subscribe <SubscriptionEvent>(Subscription);
            Subscribe <ProfileDataResultEvent>(ProfileData);

            StackLayout.Suspended = true;

            _transactionId = transactionId;
            _profileType   = profileType;
            _serviceNode   = serviceNode;
            _status        = StatusApp.Current.GetStatus(serviceNode);
            _accountId     = accountId;
            _accountIndex  = Chain.Index.New().Add(_accountId).Build();

            _messagesDownload = new AccountIndexTransactionDownload(accountId, StatusServiceInfo.MessageIndex, serviceNode.GetTransactionDownloadManager(StatusServiceInfo.StatusDataChainIndex))
            {
                Count = 10
            };

            AddTitleRow("Title");

            if (profileType == StatusAccountProfileType.Small || transactionId > 0)
            {
                var row = new StatusProfileButtonRow(serviceNode, _accountId, profileData?.ProfileInfo, profileData, async(button) =>
                {
                    await Navigation.PushAsync(new StatusAccountPage(profileData, serviceNode, accountId, StatusAccountProfileType.Big, transactionId));
                }, false);

                AddRow(row);
            }

            if (profileType == StatusAccountProfileType.Big && transactionId <= 0)
            {
                if (_status != null)
                {
                    AddHeaderRow("Subscription");

                    _subscribe = AddSwitchRow("Subscribe");
                    _subscribe.Switch.IsToggled    = _status.IsSubscribed(_accountId);
                    _subscribe.Switch.ToggledAsync = Subscribe_Toggled;
                    _subscribe.SetDetailViewIcon(Icons.Check);

                    _notification = AddSwitchRow("Notification");
                    _notification.Switch.IsToggled    = UIApp.Current.IsPushChannelSubscribed(_accountIndex);
                    _notification.Switch.ToggledAsync = Notification_Toggled;
                    _notification.SetDetailViewIcon(Icons.Bell);

                    AddFooterRow();
                }

                if (profileData == null || profileType == StatusAccountProfileType.Big)
                {
                    UIApp.Run(() => ProfileManager.Current.GetProfileData(_accountId, ProfileDownloadType.ForceDownload, true));
                }
            }

            IsBusy = true;
        }
コード例 #2
0
        public static async Task OpenStatusAccountPage(ExtContentPage page, ServiceNode serviceNode, long accountId, StatusAccountProfileType profileType, long transactionId = 0)
        {
            var profile = await ProfileManager.Current.GetProfileData(accountId, ProfileDownloadType.QueryStoredData, false);

            await page.Navigation.PushAsync(new StatusAccountPage(profile, serviceNode, accountId, profileType, transactionId));
        }