void SetupPage() { AddTitleRow("Title"); if (!ServiceNodeManager.Current.HadUnlockedServiceNode) { AddInfoRow("NotesPage.Info", Tr.Get("App.FullName")); ServiceNodesPage.AddAuthorizeSection(ServiceNodeManager.Current.NewDefaultServiceNode, this, false); } else { var editor = AddEditorRow("", "Text"); editor.Edit.TextChanged += Edit_TextChanged; FocusElement = editor.Edit; var submit = AddSubmitRow("Submit", Submit, true); submit.IsEnabled = false; AddHeaderRow("Common.SubmitAccount"); _submitAccount = AddRow(new SubmitAccountButtonRow(NoteApp.Current.GetLastUsedSubmitAccount <SubmitAccount>(), this, SelectSubmitAccount)); AddInfoRow("Common.SubmitAccountInfo"); AddFooterRow(); } }
void SetupPage() { _more = null; _listView = null; StackLayout.Children.Clear(); var title = AddTitleRow("Title"); if (!ServiceNodeManager.Current.HadUnlockedServiceNode) { AddInfoRow("Info", Tr.Get("App.FullName")); AddSubmitRow("Add", Add); } else { if (!UIAppSettings.AppReady) { AddInfoRow("Info", Tr.Get("App.FullName")); AddSubmitRow("Add", Add); } _listView = new NoteListView(this, title); ToolbarItems.Add(new ExtToolbarItem(Tr.Get("Common.Refresh"), null, async() => { IsBusy = true; await NoteApp.Current.DownloadNoteData(false); })); AddFooterRow(); IsBusy = true; } }
Assembly AssemblyResolve(object sender, ResolveEventArgs args) { if (Config.AssemblyResolveInfo) { Log.Warn(Tr.Get("Runtime.AssemblyResolve", args.Name, args.RequestingAssembly)); } try { var assemblyName = args.Name.Split(',')[0]; foreach (var di in _assemblyDirectories) { var assemblyPath = $"{di.FullName}/{assemblyName}.dll"; if (File.Exists(assemblyPath)) { return(Assembly.LoadFrom(assemblyPath)); } } } catch (Exception ex) { Log.Error(Tr.Get("Runtime.AssemblyResolveException", args.Name, args.RequestingAssembly, ex.Message)); return(null); } Log.Error(Tr.Get("Runtime.AssemblyResolveFailed", args.Name, args.RequestingAssembly)); return(null); }
async Task <ProfileItemActions> DisplayProfileItemAction() { var cancel = Tr.Get("Common.Cancel"); var moveUp = Tr.Get("Common.MoveUp"); var moveDown = Tr.Get("Common.MoveDown"); var edit = Tr.Get("Common.Edit"); var delete = Tr.Get("Common.Delete"); var invoke = T("Invoke"); var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, moveUp, moveDown, edit, delete, invoke); if (result == moveUp) { return(ProfileItemActions.MoveUp); } if (result == moveDown) { return(ProfileItemActions.MoveDown); } if (result == edit) { return(ProfileItemActions.Edit); } if (result == delete) { return(ProfileItemActions.Delete); } if (result == invoke) { return(ProfileItemActions.Invoke); } return(ProfileItemActions.Cancel); }
void SetupPage() { StackLayout.Children.Clear(); AddTitleRow("Title"); if (!ServiceNodeManager.Current.HadUnlockedServiceNode) { AddInfoRow("Auth", Tr.Get("App.FullName")); ServiceNodesPage.AddAuthorizeSection(ServiceNodeManager.Current.NewDefaultServiceNode, this, false); } else { if (UIAppSettings.AppReady) { IsBusy = true; if (ServiceNodeManager.Current.Ready) { UpdateChats(); } } else { ShowInfo(); } } UpdateSuspendedLayout(); }
public void Update(VerifyFileJson verifyItem) { if (verifyItem == null) { Reset(); return; } _filename.Text = verifyItem.name; _hash.Text = verifyItem.hash; _hashtype.Text = Tr.Get($"HashTypes.{verifyItem.hashtype}"); _size.Text = Tr.Get("VerifyFileView.SizeInfo", verifyItem.length); if (_link != null) { if (string.IsNullOrEmpty(verifyItem.link)) { _link.Text = "-"; } else { _link.Text = verifyItem.link; } } }
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)); } } }
void SetupPage() { if (!ServiceNodeManager.Current.HadUnlockedServiceNode) { AddTitleRow("VerifyPage.Title"); AddInfoRow("AddVerificationPage.VerifyInfo"); ServiceNodesPage.AddAuthorizeSection(ServiceNodeManager.Current.NewDefaultServiceNode, this, false); } else { AddTitleRow("Title"); ToolbarItems.Add(new ExtToolbarItem(Tr.Get("Common.Refresh"), null, () => { Download(false); return(Task.CompletedTask); })); AddHeaderRow("RecentTransactions"); AddFooterRow(); Download(); } }
public static (string, string) GetMessageText(DecryptedRecordData<MessageRecord> message) { /* var accountId = message.Transaction.AccountId; string name = null; if (accountId == _chat.AccountId) { name = _chat.Node.ProfileInfo?.RealName; } else { var friend = _chat.Node.GetFriend(_chat.FriendAccountId); name = friend?.Profile?.RealName; } if (name == null) name = $"Account {accountId}"; */ var text = message.Record?.Text ?? "*"; var state = message.DecryptetState; if (state == DecryptedDataRecordState.SecretKeyMissing) text = Tr.Get("Common.MessageSecretKeyMissing"); else if (state == DecryptedDataRecordState.DecryptionError) text = Tr.Get("Common.MessageDecryptionError"); var timestamp = message.Transaction.Timestamp; var detail = $"{(Time.PassedDays(timestamp) > 1 ? Time.DateTimeString(timestamp) : Time.TimeString(timestamp))}"; return (text, detail); }
void SetupPage() { StackLayout.Children.Clear(); AddTitleRow("Title"); if (WalletApp.IsCoreAccountUnlocked) { ToolbarItems.Add(new ExtToolbarItem(Tr.Get("Common.Refresh"), null, () => { Download(false); return(Task.CompletedTask); })); AddHeaderRow("RecentTransactions"); AddFooterRow(); } else { AddHeaderRow("RecentTransactions"); AddTextRow("Common.Unlock").Label.ColorStyle = Theme.InfoColor; AddFooterRow(); } UpdateSuspendedLayout(); }
public (FileInfo, string) GetScriptFileInfo(string name) { var path = _options.ScriptPath; if (!string.IsNullOrWhiteSpace(name)) { var fileInfo = new FileInfo(Path.Combine(path, name)); if (fileInfo.Exists) { return(fileInfo, null); } fileInfo = new FileInfo(Path.Combine(path, $"{name}.rosi")); if (fileInfo.Exists) { return(fileInfo, null); } fileInfo = new FileInfo(Path.Combine(path, $"{name}.cs")); if (fileInfo.Exists) { return(fileInfo, null); } } var error = Tr.Get("ScriptParser.ScriptNotFound", Path.Combine(path, name)); Log.Error(error, this); return(null, error); }
void SetupPage() { StackLayout.Children.Clear(); AddTitleRow("Title"); if (WalletApp.IsCoreAccountUnlocked) { AddHeaderRow("ChainKeys"); _import = AddButtonRow("ImportKey", ImportKey); AddFooterRow(); AddHeaderRow("NewChain"); AddTextRow("ChainInfo").Label.ColorStyle = Theme.InfoColor; AddLinkRow("Common.LearnMore", Tr.Get("Link.Chain")); AddButtonRow("NewChainButton", NewChain); AddFooterRow(); UpdateChainKeys(); } else { AddHeaderRow("ChainKeys"); AddTextRow("Common.Unlock").Label.ColorStyle = Theme.InfoColor; AddFooterRow(); } UpdateSuspendedLayout(); }
async Task <ChainKeyAction> DisplayKeyAction(bool canEditChain = false) { var cancel = Tr.Get("Common.Cancel"); var editChain = T("EditChain"); var export = T("ExportKey"); var actions = new List <string>(); if (canEditChain) { actions.Add(editChain); } actions.Add(export); var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, actions.ToArray()); if (result == editChain) { return(ChainKeyAction.EditChain); } else if (result == export) { return(ChainKeyAction.Export); } return(ChainKeyAction.Cancel); }
void SetupPage() { StackLayout.Children.Clear(); AddTitleRow("Title"); var profileData = ProfileManager.Current.GetCachedProfileData(WalletApp.CurrentAccountId); ProfilePageSections.AddProfileSections(this, profileData, "Profile"); AddHeaderRow("Profiles"); if (WalletApp.IsCoreAccountUnlocked) { if (UIAppSettings.JoinedProfile) { AddButtonRow("Edit", EditProfile); } else { AddTextRow("JoinInfo").Label.ColorStyle = Theme.InfoColor; AddLinkRow("Common.LearnMore", Tr.Get("Link.Profile")); AddSubmitRow("Join", Join, false); } } else { AddTextRow("Common.Unlock").Label.ColorStyle = Theme.InfoColor; } AddButtonRow("ViewProfile", ViewProfile); AddFooterRow(); UpdateSuspendedLayout(); }
protected virtual void Update() { (var text, var link) = GetMessage(); _link = link; text = text ?? Tr.Get("Common.MessageMissing"); var message = new Span { Text = text }; message.SetStyle(Theme.TextFont, Theme.TextColor); var formattedString = new FormattedString { Spans = { message } }; if (HasAllAttachements) { var date = new Span { Text = (_link != null) ? $"\n {Time.DateTimeString(Transaction.Transaction.Timestamp)}, {_link}" : $"\n {Time.DateTimeString(Transaction.Transaction.Timestamp)}" }; date.SetStyle(Theme.DetailFont, Theme.TextColor); formattedString.Spans.Add(date); } TextLabel.FormattedText = formattedString; }
public SettingsPage() { AddTitleRow("Title"); AddHeaderRow().Label.Text = Tr.Get("App.FullName"); AddButtonRow(ServiceNodesPage.PageTitle, async(button) => { if (!ServiceNodeManager.Current.Ready) { await MessageAsync("ServiceNodeManagerNotReady"); return; } await Navigation.PushAsync(new ServiceNodesPage()); }).SetDetailViewIcon(ServiceNodesPage.PageIcon); AddButtonRow("RevenuePage.Title", async(button) => { if (!ServiceNodeManager.Current.Ready) { await MessageAsync("ServiceNodeManagerNotReady"); return; } await Navigation.PushAsync(new RevenuePage()); }).SetDetailViewIcon(Icons.MoneyCheckEdit); var request = AddButtonRow("RequestInvitationPage.Title", async(button) => { await Navigation.PushAsync(new RequestInvitationPage()); }); request.SetDetailViewIcon(Icons.UserPlus); AddButtonRow(HandleRequestPage.HandleRequestTranslation, async(button) => { await Navigation.PushAsync(new HandleRequestPage()); }).SetDetailViewIcon(HandleRequestPage.HandleRequestIcon); AddButtonRow("About", async(button) => { await Navigation.PushAsync(new AboutPage()); }).SetDetailViewIcon(Icons.Info); AddFooterRow(); AddAppInfoSection(AppInfoType.Todo); AddThemeSection(); //AddNotificationSection(); #if DEBUG AddButtonRow("Icons", async(button) => { await Navigation.PushAsync(new IconsPage()); }); #endif }
Task DownloadTransactions(TransactionDownloadEvent <Transaction> downloadEvent) { AddIndexBefore = false; AddIndex = GetRow("Notes"); var rows = GetHeaderSectionRows("Notes"); IsBusy = false; foreach (var item in downloadEvent.Items) { if (!item.Result.Ok) { UIApp.Toast(Tr.Get("TransactionDownloadResult.DownloadFailed", item.ServiceNode.GetName())); } } var transactions = downloadEvent.GetSortedTransactions(TransactionSortMode.TimestampDescening); if (transactions.Count > 0 && _listView != null) { RemoveView(GetRow("Info")); RemoveView(GetRow("Add")); if (!UIAppSettings.AppReady) { UIAppSettings.AppReady = true; UIApp.Current.SaveSettings(); } _listView.Update(transactions); UIApp.Run(UpdateNotes); if (downloadEvent.HasMore) { if (_more == null) { _more = AddButtonRow("MoreButton", More); } } else { RemoveView(_more); _more = null; } } else { if (ServiceNodeManager.Current.HadUnlockedServiceNode && UIAppSettings.AppReady) { Toast("NoNotes"); } } return(Task.CompletedTask); }
public async Task Button(ButtonLayoutRow button) { var cancel = Tr.Get("Common.Cancel"); var download = Tr.Get("Common.MessageDownload"); var link = Tr.Get("Common.MessageLink"); var share = Tr.Get("Common.Share"); var copy = Tr.Get("Common.CopyShareLink"); var items = new List <string>(); if (!string.IsNullOrWhiteSpace(_link)) { items.Add(link); } if (!HasAllAttachements) { items.Add(download); } if (UIApp.CanShare) { items.Add(share); } items.Add(copy); if (items.Count == 0) { return; } var result = await Page.DisplayActionSheet(null, cancel, null, items.ToArray()); if (result == download) { await Transaction.TransactionManager.DownloadTransactionAttachement(Transaction); if (!HasAllAttachements) { await Page.ErrorAsync("MessageDownloadFailed"); } Update(); } else if (result == link) { UIApp.OpenUrl(new Uri(_link)); } else if (result == share) { UIApp.Share(StatusApp.Current.GetRequestCode(Transaction.Tag as ServiceNode, StatusServiceInfo.StatusDataChainIndex, ViewMessageSchemeAction.ActionName, Transaction.Transaction.AccountId, Transaction.Transaction.TransactionId)); } else if (result == copy) { UIApp.CopyToClipboard(StatusApp.Current.GetRequestCode(Transaction.Tag as ServiceNode, StatusServiceInfo.StatusDataChainIndex, ViewMessageSchemeAction.ActionName, Transaction.Transaction.AccountId, Transaction.Transaction.TransactionId)); UIApp.Toast(Tr.Get("Common.CopiedToClipboard")); } }
public TodoItemHistoryView(IRecordStorage storage) : base("TodoHistoryView") { if (storage.GetRecordType() == TodoRecordTypes.Task) { AddRow("Item", (storage as TodoRecordStorage <TodoTaskRecord>).Record.Text); } else if (storage.GetRecordType() == TodoRecordTypes.TaskStatus) { AddRow("Status", Tr.Get("ItemStatusTypes." + (storage as TodoRecordStorage <TodoTaskStatusRecord>).Record.Status)); } AddLastRow("Timestamp", Time.DateTimeString(storage.Timestamp)); }
public void Update(PurchaseInfo purchase) { if (purchase != null) { _desc.Text = purchase.Description; _price.Text = Currency.ToString(purchase.Price); _type.Text = Tr.Get("PurchaseTypes." + purchase.PurchaseType); _dur.Text = (purchase.PurchaseType == PurchaseTypes.Subscription) ? Time.ToDays(purchase.Duration).ToString() : "-"; } else { Reset(); } }
async Task EditFile(ButtonViewRow <VerifyFileView> button) { var cancel = Tr.Get("Common.Cancel"); var moveUp = Tr.Get("Common.MoveUp"); var moveDown = Tr.Get("Common.MoveDown"); var edit = Tr.Get("Common.Edit"); var delete = Tr.Get("Common.Delete"); var openlink = T("OpenLink"); var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, moveUp, moveDown, edit, delete, openlink); if (result == edit) { await VerificationFilePage.Open(this, button.Tag as VerifyFileJson); } else if (result == delete) { Status.RemoveBusyView(button); RemoveView(button); Status.ReValidate(); } else if (result == moveUp || result == moveDown) { var idx = StackLayout.Children.IndexOf(button); if (idx > 0) { var hasNext = (StackLayout.Children[idx + 1] as StackRow)?.Tag is VerifyFileJson; var hasPrev = (StackLayout.Children[idx - 1] as StackRow)?.Tag is VerifyFileJson; if (hasNext && result == moveDown) { StackLayout.Children.RemoveAt(idx); StackLayout.Children.Insert(idx + 1, button); } else if (hasPrev && result == moveUp) { StackLayout.Children.RemoveAt(idx); StackLayout.Children.Insert(idx - 1, button); } } } else if (result == openlink) { if (button.Tag is VerifyFileJson verify && !string.IsNullOrEmpty(verify.link)) { UIApp.OpenUrl(new Uri(verify.link)); } } }
public NewTodoListPage() : base("NewTodoListPage") { Subscribe <TodoListRegistrationEvent>(TodoListRegistration); AddTitleRow("Title"); AddInfoRow("TodoPage.Info", Tr.Get("App.FullName")); AddSubmitRow("Submit", NewTodoList); AddHeaderRow("Common.SubmitAccount"); _submitAccount = AddRow(new SubmitAccountButtonRow(this, () => ServiceNodeManager.Current.GetSubmitAccounts <SubmitAccount>(TodoServiceInfo.TodoSubmitIndex))); AddInfoRow("Common.SubmitAccountInfo"); AddFooterRow(); }
async Task DisplayKeyAction(ButtonViewRow <ClientAccountView> button) { var cancel = Tr.Get("Common.Cancel"); var export = T("ExportButton"); var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, export); if (result == export) { var ac = WalletApp.CurrentCoreAccount; if (ac != null) { await Navigation.PushAsync(new ExportAccountPage(ac, WalletApp.MinPasswordLength)); } } }
Task Update() { AddTitleRow("Title"); AddHeaderRow().Label.Text = Tr.Get("App.FullName"); AddButtonRow("InboxesPage.Inboxes", Inboxes).SetDetailViewIcon(Icons.Inbox); AddButtonRow(ServiceNodesPage.PageTitle, async(button) => { if (!ServiceNodeManager.Current.Ready) { await MessageAsync("ServiceNodeManagerNotReady"); return; } await Navigation.PushAsync(new ServiceNodesPage()); }).SetDetailViewIcon(ServiceNodesPage.PageIcon); AddButtonRow(HandleRequestPage.HandleRequestTranslation, async(button) => { await Navigation.PushAsync(new HandleRequestPage()); }).SetDetailViewIcon(HandleRequestPage.HandleRequestIcon); AddButtonRow("About", async(button) => { await Navigation.PushAsync(new AboutPage()); }).SetDetailViewIcon(Icons.Info); AddFooterRow(); AddAppInfoSection(); AddPushNotificationSection(); AddThemeSection(); //AddNotificationSection(); #if DEBUG AddButtonRow("Icons", async(button) => { await Navigation.PushAsync(new IconsPage()); }); #endif UpdateSuspendedLayout(); return(Task.CompletedTask); }
async Task <AddActions> DisplayAddAction() { var cancel = Tr.Get("Common.Cancel"); var mail = Tr.Get("Common.Email"); var website = Tr.Get("Common.Website"); var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, mail, website); if (result == mail) { return(AddActions.Mail); } if (result == website) { return(AddActions.Website); } return(AddActions.Cancel); }
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(); }
async Task <ChainItemAction> ItemAction(params ChainItemAction[] itemactions) { string delete = null; var cancel = Tr.Get("Common.Cancel"); var edit = Tr.Get("Common.Edit"); var revoke = Tr.Get("Common.Revoke"); var actions = new List <string>(); foreach (var item in itemactions) { switch (item) { case ChainItemAction.Delete: delete = Tr.Get("Common.Delete"); break; case ChainItemAction.Edit: actions.Add(edit); break; case ChainItemAction.Revoke: actions.Add(revoke); break; } } var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, delete, actions.ToArray()); if (result == delete) { return(ChainItemAction.Delete); } else if (result == edit) { return(ChainItemAction.Edit); } else if (result == revoke) { return(ChainItemAction.Revoke); } return(ChainItemAction.Cancel); }
public static string GetErrorMessage(this HeleusClientResponse response) { if (response.ResultType != HeleusClientResultTypes.Ok) { return(Tr.Get("HeleusClientResultTypes." + response.ResultType)); } if (response.TransactionResult == TransactionResultTypes.FeatureCustomError) { return(Tr.Get(Feature.GetFeatureErrorString(response.UserCode))); } if (response.TransactionResult == TransactionResultTypes.ChainServiceErrorResponse) { return(Tr.Get("VerifyUserCodes", Tr.Get("VerifyUserCodes." + (VerifyUserCodes)response.UserCode), response.UserCode)); } return(Tr.Get("TransactionResult", Tr.Get("TransactionResultTypes." + response.TransactionResult))); }
async Task <VerifyFileAction> DisplayVerifyFileAction() { var cancel = Tr.Get("Common.Cancel"); var verify = T("Verify"); var openlink = T("OpenLink"); var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, verify, openlink); if (result == verify) { return(VerifyFileAction.Verify); } if (result == openlink) { return(VerifyFileAction.OpenLink); } return(VerifyFileAction.Cancel); }
public async Task UpdateFromScheme(ServiceNode serviceNode, long verificationId) { if (_transactionId != null && _serviceNode != null) { if (serviceNode != _serviceNode.ServiceNode) { if (!await ConfirmTextAsync(Tr.Get("Messages.SwitchServiceNode", serviceNode.Name ?? serviceNode.Endpoint.AbsoluteUri))) { return; } _serviceNode.ServiceNode = serviceNode; VerifyApp.Current.SetLastUsedServiceNode(serviceNode); } _transactionId.Edit.Text = verificationId.ToString(); UIApp.Run(() => Search(null)); } }