public ExternalEditor() { InitializeComponent(); var storage = new SqLiteStorageOptions("test"); _storage = new SqLiteBackend(storage, SystemClock.Instance); }
private async void Init(string pageLink) { var storage = new SqLiteBackend(DefaultStorageBackends.GetSqliteStorage(), SystemClock.Instance); var pages = new ObservableCollection <GenericPageHistory>(await storage.GetPageHistoryAsync(pageLink)); Pages = pages; Bindings.Update(); }
public NavigationSettingsLinkItemControl() { this.InitializeComponent(); var storage = new SqLiteStorageOptions("test"); var backend = new SqLiteBackend(storage, SystemClock.Instance); LoadPages(backend); }
private async void Export_Click(ContentDialog sender, ContentDialogButtonClickEventArgs args) { var backend = new SqLiteBackend(new SqLiteStorageOptions("test"), SystemClock.Instance); var folder = await FileSystemAccess.PickFolderAsync(); var pages = new List <GenericPage>(); if (ExportAllPages.IsChecked == true) { pages.AddRange(await backend.GetAllPagesAsync()); } else if (ExportSinglePage.IsChecked == true) { pages.Add(await backend.GetPageAsync(_id)); } var exportHtml = ExportHtml.IsChecked == true; var exportMarkdown = ExportMarkdown.IsChecked == true; foreach (var page in pages) { if (exportHtml) { var contentRenderer = new ContentRenderer(); var file = await folder.CreateFileAsync($"{page.Link.Replace(':', '_')}.html", CreationCollisionOption.ReplaceExisting); await FileIO.WriteTextAsync(file, await contentRenderer.RenderContentAsync(page.Content, ContentType.Markdown), UnicodeEncoding.Utf8); } if (exportMarkdown) { var file = await folder.CreateFileAsync($"{page.Link.Replace(':', '_')}.md", CreationCollisionOption.ReplaceExisting); await FileIO.WriteTextAsync(file, page.Content, UnicodeEncoding.Utf8); } } Hide(); }
private async void LoadPages(SqLiteBackend storage) { var pages = await storage.GetAllPagesAsync(); Pages = new ObservableCollection <GenericPage>(pages); }