예제 #1
0
        public MessagePage(Chat chat, DecryptedRecordData <MessageRecord> message) : base("MessagePage")
        {
            Subscribe <NewSecretKeyEvent>(NewSecretKey);

            _chat    = chat;
            _message = message;

            var transaction = message.Transaction;

            AddTitleRow("Title");

            AddHeaderRow("Message");

            var(text, detail) = ChatListView.GetMessageText(message);
            _text             = AddTextRow(null);
            _text.SetMultilineText(text, detail);

            AddFooterRow();

            AddHeaderRow("SecretKeyInfo");
            _keyView = new SecretKeyView(message.EncryptedRecord?.KeyInfo, true);
            AddViewRow(_keyView);
            AddButtonRow("Import", Import);
            AddFooterRow();

            AddHeaderRow("TransactionInfo");
            AddViewRow(new DataTransactionView(transaction));
            AddFooterRow();

            IsBusy = true;
            UIApp.Run(Update);
        }
예제 #2
0
        async Task Update()
        {
            await _message.Decrypt();

            var(text, detail) = ChatListView.GetMessageText(_message);
            _text.Label.FormattedText.Spans[0].Text = text;
            _text.Label.FormattedText.Spans[1].Text = $"\n{detail}";

            IsBusy = false;
        }
예제 #3
0
        public ChatPage(Chat chat) : base("ChatPage")
        {
            Subscribe <MessageSentEvent>(MessageSent);
            Subscribe <ChatMessageDownloadEvent>(MessagesDownloaded);

            IsSuspendedLayout = true;

            _node = chat.Node;
            _chat = chat;

            var title = AddTitleRow("Title");

            var friend = chat.Node.GetFriend(chat.FriendAccountId);
            var name   = friend?.Profile?.RealName;

            if (name == null)
            {
                name = $"Account {chat.FriendAccountId}";
            }

            title.Label.Text = name;
            SetTitle(name);

            _text = new EntryRow(Icons.StickyNote);
            _text.Edit.Placeholder = T("TypeText");
            _text.SetDetailViewIcon(Icons.Pencil);

            _text.RowLayout.Children.Remove(_text.FontIcon);
            _text.RowLayout.Children.Remove(_text.Label);

            _text.VerticalOptions   = LayoutOptions.FillAndExpand;
            _text.HorizontalOptions = LayoutOptions.FillAndExpand;

            _submit                 = new ButtonRow(Icons.RowSubmit, Submit);
            _submit.RowStyle        = Theme.SubmitButton;
            _submit.FontIcon.Margin = new Thickness(0, 0, 0, 0);
            _submit.WidthRequest    = _submit.HeightRequest = 40;

            AbsoluteLayout.SetLayoutBounds(_submit.FontIcon, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            Status.AddBusyView(_submit);
            Status.AddBusyView(_text);

            _text.Edit.TextChanged += Edit_TextChanged;
            Edit_TextChanged(_text.Edit, null);

            var layout = new StackLayout();

            layout.Orientation = StackOrientation.Horizontal;

            layout.Children.Add(_text);
            layout.Children.Add(_submit);

            AddView(layout);

            _listView = new ChatListView(chat, this, layout);

            ToolbarItems.Add(new ExtToolbarItem(T("Info"), null, Info));

            IsBusy = true;
            UIApp.Run(Update);
        }