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); }