Пример #1
0
        Task InboxDownload(InboxRecordDownloadEvent arg)
        {
            if (arg.Node == _node && _node.AccountId == arg.AccountId)
            {
                AddInboxes(this, arg.Node.AccountId, Inbox, arg);
            }

            return(Task.CompletedTask);
        }
Пример #2
0
        void AddInboxes(StackPage page, long accountId, Func <ButtonRow, Task> action, InboxRecordDownloadEvent downloadResult)
        {
            page.RemoveHeaderSection("Inboxes");

            page.AddIndex = page.GetRow("Title");
            page.AddIndex = page.AddHeaderRow("Inboxes");

            var result = downloadResult;

            //if(result == null)
            //result = await node.DownloadInboxRecords(accountId);

            if (result.Result == MessageNodeEventResultTypes.Ok)
            {
                foreach (var item in result.InboxRecords)
                {
                    var button = page.AddButtonRow(null, action);
                    page.AddIndex = button;

                    var inboxName = item.InboxRecord?.Title;
                    if (inboxName == null)
                    {
                        inboxName = Tr.Get("Common.Inbox");
                    }

                    button.SetMultilineText(inboxName, Tr.Get("Common.InboxName", accountId, item.KeyIndex));
                    button.SetDetailViewIcon(Icons.Inbox);
                    button.Tag = item;
                }
            }
            else
            {
                if (result.Result == MessageNodeEventResultTypes.InvalidAccount)
                {
                    page.AddIndex = page.AddInfoRow("InvalidAccount");
                }
                else
                {
                    page.AddIndex = page.AddInfoRow("DownloadFailed");
                }
            }

            page.AddIndex = page.AddFooterRow();
        }