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); }
Task Share(ButtonRow arg) { var code = AppBase.Current.GetRequestCode(_node.ServiceNode, MessageServiceInfo.MessageDataChainIndex, ViewFriendSchemeAction.ActionName, _node.AccountId); UIApp.Share(code); return(Task.CompletedTask); }
public TestPage() : base("TestPage") { if (UIApp.IsUWP) { NavigationPage.SetHasNavigationBar(this, false); } AddHeaderRow(); AddButtonRow("Start", Start); AddButtonRow("Close", Close, true); AddFooterRow(); var closeItem = new ExtToolbarItem("Close", null, async() => { await Close(null); }); ToolbarItems.Add(closeItem); UIApp.Run(async() => { await Task.Delay(100); await Start(null); }); }
public void DecryptMessageRows() { UIApp.Run(async () => { var rows = Rows; foreach (var row in rows) { var message = row.Tag as DecryptedRecordData<MessageRecord>; if (message.Record == null) await message.Decrypt(); var (text, detail) = GetMessageText(message); var invalid = message.DecryptetState != DecryptedDataRecordState.Decrypted; if (invalid) { row.Label.FormattedText.Spans[0].SetColorStyle(Theme.ErrorColor); } else { row.Label.FormattedText.Spans[0].SetColorStyle(Theme.TextColor); } row.Label.FormattedText.Spans[0].Text = text; row.Label.FormattedText.Spans[1].Text = $"\n{detail}"; } _page.UpdateSuspendedLayout(); }); }
public static async Task TaskAction(ExtContentPage page, TodoTask todoTask, TodoList todoList) { var submitAccount = TodoApp.Current.GetLastUsedSubmitAccount <SubmitAccount>(todoList.ListId.ToString()); if (submitAccount == null || !todoList.IsLastUsedSecretKey(submitAccount) || todoTask.Status != TodoTaskStatusTypes.Open) { await page.Navigation.PushAsync(new TodoTaskPage(todoList, todoTask)); } else { var editItem = Tr.Get("TodoListView.EditItem"); var markDone = Tr.Get("TodoListView.MarkDone"); var result = await page.DisplayActionSheet(Tr.Get("TodoListView.ItemTitle"), Tr.Get("Common.Cancel"), null, markDone, editItem); if (result == markDone) { if (await page.ConfirmTextAsync(Tr.Get("TodoListView.ConfirmStatus"))) { page.IsBusy = true; UIApp.Run(() => TodoApp.Current.UpdateTodoItemStatus(submitAccount, TodoTaskStatusTypes.Closed, todoList, todoTask)); } } else if (result == editItem) { await page.Navigation.PushAsync(new TodoTaskPage(todoList, todoTask)); } } }
Task ServiceNodeChanged(ServiceNodeButtonRow obj) { IsBusy = true; RemoveHeaderSection("Friends"); UIApp.Run(Update); return(Task.CompletedTask); }
async Task Delete(ButtonRow button) { if (await ConfirmAsync("ConfirmDelete")) { IsBusy = true; UIApp.Run(() => TodoApp.Current.DeleteList(_submitAccount.SubmitAccount, TodoList)); } }
protected override async Task ServiceNodesLoaded(ServiceNodesLoadedEvent arg) { await base.ServiceNodesLoaded(arg); await UIApp.Current.SetFinishedLoading(); UIApp.Run(() => DownloadNoteData(false)); }
Task Copy(ButtonRow arg) { var code = AppBase.Current.GetRequestCode(_node.ServiceNode, MessageServiceInfo.MessageDataChainIndex, ViewFriendSchemeAction.ActionName, _node.AccountId); UIApp.CopyToClipboard(code); Toast("Copied"); return(Task.CompletedTask); }
async Task Unfriend(ButtonRow arg) { if (await ConfirmAsync("ConfirmUnfriend")) { IsBusy = true; UIApp.Run(() => _node.Unfriend(_friendAccountId)); } }
async Task Rename(ButtonRow arg) { IsBusy = true; if (await ConfirmAsync("RenameConfirm")) { UIApp.Run(() => _node.RenameInbox(_inboxItem.KeyIndex, _titleRow.Edit.Text)); } }
Task Submit(ButtonRow arg) { var text = _text.Edit.Text; if (!string.IsNullOrEmpty(text)) { IsBusy = true; UIApp.Run(() => _node.SendMessage(_chat, text)); } return(Task.CompletedTask); }
async Task Name(ButtonRow button) { if (!await TodoPage.CheckSecretKey(TodoList, _submitAccount.SubmitAccount, this)) { return; } var name = _nameEntry.Edit.Text; if (!string.IsNullOrEmpty(name) && !(name == TodoList.Name) && await ConfirmAsync("ConfirmName")) { IsBusy = true; UIApp.Run(() => TodoApp.Current.UpdateListName(_submitAccount.SubmitAccount, TodoList, name)); } }
public InboxesPage() : base("InboxesPage") { Subscribe <InboxRecordDownloadEvent>(InboxDownload); IsSuspendedLayout = true; AddTitleRow("Title"); AddHeaderRow("Common.ServiceNode"); _serviceNodeButton = AddRow(new ServiceNodeButtonRow(this, ServiceNodesPageSelectionFlags.ActiveRequired, "inboxes")); _serviceNodeButton.SelectionChanged = ServiceNodeChanged; AddInfoRow("Common.ServiceNodeInfo"); AddFooterRow(); IsBusy = true; UIApp.Run(Update); }
public override void UpdateSubmitAccounts() { var index = NoteServiceInfo.NoteIndex; foreach (var serviceNode in ServiceNodeManager.Current.ServiceNodes) { foreach (var serviceAccount in serviceNode.ServiceAccounts.Values) { var keyIndex = serviceAccount.KeyIndex; if (!serviceNode.HasSubmitAccount(keyIndex, index)) { serviceNode.AddSubmitAccount(new SubmitAccount(serviceNode, keyIndex, index, true)); } } } UIApp.Run(GenerateDefaultSecretKeys); }
async Task Inbox(ButtonRow arg) { var node = _node; if (node == null) { return; } var edit = T("EditName"); var share = T("Share"); var copy = T("Copy"); var cancel = Tr.Get("Common.Cancel"); var actions = new List <string> { edit, copy }; if (UIApp.CanShare) { actions.Add(share); } var record = arg.Tag as InboxNameRecordInfo; var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, actions.ToArray()); if (result == edit) { await Navigation.PushAsync(new EditInboxPage(node, arg.Tag as InboxNameRecordInfo)); } else if (result == copy) { var code = AppBase.Current.GetRequestCode(node.ServiceNode, MessageServiceInfo.MessageDataChainIndex, ViewFriendSchemeAction.ActionName, node.AccountId, record.KeyIndex); UIApp.CopyToClipboard(code); Toast("Copied"); } else if (result == share) { var code = AppBase.Current.GetRequestCode(_node.ServiceNode, MessageServiceInfo.MessageDataChainIndex, ViewFriendSchemeAction.ActionName, _node.AccountId, record.KeyIndex); UIApp.Share(code); } }
public SettingsPage() { IsSuspendedLayout = true; UIApp.Run(Update); }
public override void OnOpen() { IsBusy = true; UIApp.Run(Update); }
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); }
Task ServiceNodeChanged(ServiceNodeButtonRow obj) { IsBusy = true; UIApp.Run(Update); return(Task.CompletedTask); }
public ContactPage(MessageNode node, long friendAccountId, short keyIndex = -1, Chat chat = null) : base("ContactPage") { Subscribe <ProfileDataResultEvent>(ProfileData); Subscribe <UnfriendEvent>(Unfriend); _node = node; _chat = chat; _friendAccountId = friendAccountId; _friendKeyIndex = keyIndex; AddTitleRow("Title"); if (!_self) { if (_chat == null) { var friend = node.GetFriend(friendAccountId); var invitation = node.GetInvitation(friendAccountId); if (invitation != null) { AddHeaderRow("PendingInvitation"); if (invitation.HasFriendAccountApproval) { var row = AddButtonRow("ApproveButton", Approve); row.SetDetailViewIcon(Icons.UserPlus); row.Tag = invitation; } if (invitation.HasAccountApproval) { var row = AddButtonRow("AwaitingApprovalButton", Awaiting); row.SetDetailViewIcon(Icons.UserClock); row.Tag = invitation; } AddInfoRow("PendingInvitationInfo"); AddFooterRow(); } if (friend == null && invitation == null) { AddHeaderRow("Invitation"); var b = AddButtonRow("InviteButton", Invite); b.SetDetailViewIcon(Icons.UserPlus); AddInfoRow("InvitationInfo"); AddFooterRow(); } var chats = _node.GetChats(_friendAccountId); if (chats.Count > 0) { AddHeaderRow("Chats"); foreach (var c in chats) { var b = AddButtonRow(Time.DateTimeString(c.LastTimestamp), OpenChat); b.SetDetailViewIcon(Icons.Comments); b.Tag = c; } AddFooterRow(); } if (friend != null) { AddHeaderRow("Misc"); var button = AddButtonRow("Unfriend", Unfriend); button.RowStyle = Theme.CancelButton; button.SetDetailViewIcon(Icons.UserSlash); AddFooterRow(); } } else { AddHeaderRow("NofificationHeader"); var _notification = AddSwitchRow("Notification"); _notification.Switch.IsToggled = UIApp.Current.IsPushChannelSubscribed(_chat.Index); _notification.Switch.ToggledAsync = Notification_Toggled; _notification.SetDetailViewIcon(Icons.Bell); AddFooterRow(); AddHeaderRow("Misc"); var button = AddButtonRow("ViewInboxes", ViewInboxes); button.SetDetailViewIcon(Icons.Inbox); button = AddButtonRow("ManageSecretKeys", ManageSecretKeys); button.SetDetailViewIcon(Icons.Key); button = AddButtonRow("RemoveChat", RemoveChat); button.SetDetailViewIcon(Icons.CommentSlash); button = AddButtonRow("Unfriend", Unfriend); button.RowStyle = Theme.CancelButton; button.SetDetailViewIcon(Icons.UserSlash); AddFooterRow(); } } else { AddHeaderRow("Misc"); AddButtonRow("InboxesPage.Inboxes", Inboxes).SetDetailViewIcon(Icons.Inbox); if (UIApp.CanShare) { var b = AddButtonRow("Share", Share); b.SetDetailViewIcon(Icons.Share); } var button = AddButtonRow("Copy", Copy); button.SetDetailViewIcon(Icons.Copy); AddFooterRow(); } IsBusy = true; UIApp.Run(Update); }