/// <summary> /// 完成对云端元数据的替换 /// </summary> /// <returns></returns> public async Task BackupDatabase() { bool isChanged = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsDatabaseChanged, "False")); if (isChanged) { var localFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("ImgMeta.db", CreationCollisionOption.OpenIfExists); using (var localStream = await localFile.OpenReadAsync()) { var cloudDb = await _appFolder.StorageFolderPlatformService.CreateFileAsync("ImgMeta.db", CreationCollisionOption.ReplaceExisting, localStream); AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "False"); } TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0); string ChangeTime = Convert.ToInt32(ts.TotalSeconds).ToString(); var temp = await WriteTempFile("LastAsyncTime", ChangeTime); using (var stream = await temp.OpenReadAsync()) { await _appFolder.StorageFolderPlatformService.CreateFileAsync("LastAsyncTime", CreationCollisionOption.ReplaceExisting, stream); } AppTools.WriteLocalSetting(AppSettings.SyncTime, ChangeTime); } }
public static async Task <List <FeedlyResult> > GetFeedlyResultFromText(string text) { string language = AppTools.GetLocalSetting(Enums.AppSettings.Language, "en_US").ToLower(); if (language.Contains("_")) { language = language.Split("_")[0]; } text = WebUtility.UrlEncode(text); double time = AppTools.DateToTimeStamp(DateTime.Now.ToLocalTime()); string url = $"https://feedly.com/v3/search/feeds?q={text}&n=50&fullTerm=false&organic=true&promoted=true&locale={language}&useV2=true&ck={time}&ct=feedly.desktop&cv=31.0.336"; var data = await AppTools.GetEntityFromUrl <WebFeedlyResult>(url); var results = new List <FeedlyResult>(); if (data != null && data.results != null && data.results.Length > 0) { foreach (var item in data.results) { // 过滤掉废弃的源 if (item.state != "dormant") { results.Add(new FeedlyResult(item)); } } } return(results); }
public Feed(RssSchema schema) { Title = schema.Title ?? ""; Summary = schema.Summary ?? ""; Content = schema.Content ?? ""; string theme = AppTools.GetLocalSetting(Enums.AppSettings.Theme, "Light").ToLower(); ImageUrl = schema.ImageUrl; if (string.IsNullOrEmpty(ImageUrl)) { ImgVisibility = Visibility.Collapsed; } else if (ImageUrl.StartsWith("//")) { ImageUrl = "http:" + ImageUrl; } ExtraImageUrl = schema.ExtraImageUrl ?? ""; MediaUrl = schema.MediaUrl ?? ""; InternalID = schema.InternalID; FeedUrl = schema.FeedUrl; Author = schema.Author ?? AppTools.GetReswLanguage("App_NoAuthor"); Date = schema.PublishDate.ToString(AppTools.GetReswLanguage("App_DateFormat")); Categories = schema.Categories; if (Categories == null || Categories.Count() == 0) { TagVisibility = Visibility.Collapsed; } }
public GroupDialog() { this.InitializeComponent(); Title = AppTools.GetReswLanguage("GroupDialogTitle"); PrimaryButtonText = AppTools.GetReswLanguage("OK"); SecondaryButtonText = AppTools.GetReswLanguage("Cancel"); var group = App.Db.Groups; foreach (var item in group) { GroupCollection.Add(item); } string selectId = AppTools.GetLocalSetting(AppSettings.SelectGroupIndex, ""); foreach (var item in GroupCollection) { if (item.GroupId == selectId) { GroupCombo.SelectedItem = item; SelectGroup = item; } } if (SelectGroup == null) { GroupCombo.SelectedItem = GroupCollection.First(); SelectGroup = GroupCollection.First(); } isInit = true; }
/// <summary> /// 分组加载 /// </summary> private async void GroupInit() { var group = App.Db.Groups; // 如果是第一次运行软件,则为其创建一个默认分组 if (group.Count() == 0) { int num = await App.OneDriveTools.AddGroupToDatabase(App.Db, new OneDriveImageGroup("Default")); if (num > 0) { GroupInit(); } } else { // 检查上一次选中的分组,如果没有,则默认选中第一个 GroupCollection.Clear(); string lastGroupId = AppTools.GetLocalSetting(AppSettings.SelectGroupIndex, ""); if (string.IsNullOrEmpty(lastGroupId)) { lastGroupId = group.First().GroupId; AppTools.WriteLocalSetting(AppSettings.SelectGroupIndex, lastGroupId); } foreach (var item in group) { GroupCollection.Add(item); if (item.GroupId == lastGroupId) { GroupCombo.SelectedItem = item; } } HistoryInit(); } }
private async void ExportOpmlButton_Click(object sender, RoutedEventArgs e) { ExportOpmlButton.IsEnabled = false; ExportOpmlButton.Content = AppTools.GetReswLanguage("Tip_Waiting"); var allList = MainPage.Current.Categories.ToList(); try { var opml = new Opml(allList); string content = opml.ToString(); string fileName = AppTools.GetLocalSetting(AppSettings.UserName, "") + "_" + DateTime.Now.ToString("yyyyMMdd_HH_mm_ss") + ".opml"; var file = await IOTools.GetSaveFile(".opml", fileName, "OPML File"); if (file != null) { await FileIO.WriteTextAsync(file, content); new PopupToast(AppTools.GetReswLanguage("Tip_ExportSuccess")).ShowPopup(); } } catch (Exception) { new PopupToast(AppTools.GetReswLanguage("Tip_ImportError"), AppTools.GetThemeSolidColorBrush(ColorType.ErrorColor)).ShowPopup(); } ExportOpmlButton.IsEnabled = true; ExportOpmlButton.Content = AppTools.GetReswLanguage("Tip_Export"); }
private void Page_Loaded(object sender, RoutedEventArgs e) { bool isJustUnread = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsJustUnread, "False")); JustNoReadSwitch.IsOn = isJustUnread; _isInit = true; }
/// <summary> /// 文章详情页面,主体是WebView /// </summary> public FeedDetailPage() { this.InitializeComponent(); Current = this; NavigationCacheMode = NavigationCacheMode.Enabled; ToolTipService.SetToolTip(AddTodoButton, AppTools.GetReswLanguage("Tip_AddTodoList")); ToolTipService.SetToolTip(RemoveTodoButton, AppTools.GetReswLanguage("Tip_DeleteTodoList")); ToolTipService.SetToolTip(AddStarButton, AppTools.GetReswLanguage("Tip_AddStarList")); ToolTipService.SetToolTip(RemoveStarButton, AppTools.GetReswLanguage("Tip_DeleteStarList")); ToolTipService.SetToolTip(ReadabilityButton, AppTools.GetReswLanguage("Tip_Readability")); bool isSideLocked = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.SideListLocked, "False")); if (!isSideLocked) { LockButton.Foreground = AppTools.GetThemeSolidColorBrush(ColorType.ImportantTextColor); } else { LockButton.Foreground = AppTools.GetThemeSolidColorBrush(ColorType.PrimaryColor); } if (_latestPoint == null) { this.PointerPressed += (_s, _e) => { }; } }
/// <summary> /// (供外部调用)重新加载分组集合 /// </summary> public void GroupCollectionReInit() { isInit = false; var groups = App.Db.Groups; GroupCollection.Clear(); string selectId = AppTools.GetLocalSetting(AppSettings.SelectGroupIndex, ""); if (string.IsNullOrEmpty(selectId)) { selectId = groups.ToList()[0].GroupId; AppTools.WriteLocalSetting(AppSettings.SelectGroupIndex, selectId); } foreach (var item in groups) { GroupCollection.Add(item); } foreach (var item in GroupCollection) { if (item.GroupId == selectId) { GroupCombo.SelectedItem = item; } } isInit = true; }
private async Task FeedReInit(RssSchema data) { bool isUnread = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsJustUnread, "False")); if (!isUnread) { ShowFeeds.Insert(0, _sourceFeed); } ShowFeeds.Remove(data); _sourceFeed = data; LoadingRing.IsActive = true; if (MainPage.Current.ChannelListView.SelectedItem != null) { var selectChannel = MainPage.Current.ChannelListView.SelectedItem as Channel; if (MainPage.Current.ReadableList.Any(c => c.Id == selectChannel.Id)) { DetailWebView.NavigateToString(""); SmartReader.Article article = await SmartReader.Reader.ParseArticleAsync(_sourceFeed.FeedUrl); if (article.IsReadable || !string.IsNullOrEmpty(article.TextContent)) { _sourceFeed.Content = article.Content; } else { new PopupToast(AppTools.GetReswLanguage("Tip_ReadError"), AppTools.GetThemeSolidColorBrush(ColorType.ErrorColor)).ShowPopup(); } } } await UpdateFeed(); LoadingRing.IsActive = false; }
/// <summary> /// 组内历史图片记录 /// </summary> public void HistoryInit() { // 这里的显示就按时间正序 string groupId = AppTools.GetLocalSetting(AppSettings.SelectGroupIndex, ""); var imgs = App.Db.Images.Where(p => p.GroupId == groupId); if (imgs.Count() > 0) { HistoryImageCollection.Clear(); foreach (var item in imgs) { HistoryImageCollection.Add(item); } HistoryNoDataTipBlock.Visibility = Visibility.Collapsed; HistoryGridView.Visibility = Visibility.Visible; } else { HistoryNoDataTipBlock.Visibility = Visibility.Visible; HistoryGridView.Visibility = Visibility.Collapsed; } IsHistoryImageInit = true; AllInitCheck(); }
private void ReduceParagraphHeightSizeButton_Click(object sender, RoutedEventArgs e) { double sourceParagraphHeight = Convert.ToDouble(AppTools.GetLocalSetting(AppSettings.ReadParagraphHeight, "0.5")); sourceParagraphHeight = sourceParagraphHeight <= 0.1 ? 0.1 : sourceParagraphHeight - 0.1; ReadParagraphHeight = sourceParagraphHeight; AppTools.WriteLocalSetting(AppSettings.ReadParagraphHeight, sourceParagraphHeight.ToString()); }
private void AddLineHeightSizeButton_Click(object sender, RoutedEventArgs e) { double sourceLineHeight = Convert.ToDouble(AppTools.GetLocalSetting(AppSettings.ReadLineHeight, "1.5")); sourceLineHeight = sourceLineHeight >= 3 ? 3 : sourceLineHeight + 0.1; ReadLineHeight = sourceLineHeight; AppTools.WriteLocalSetting(AppSettings.ReadLineHeight, sourceLineHeight.ToString()); }
public object Convert(object value, Type targetType, object parameter, string language) { if (value is string yo) { bool isShow = System.Convert.ToBoolean(AppTools.GetLocalSetting(Enums.AppSettings.IsShowNoRead, "True")); return(isShow ? Visibility.Visible : Visibility.Collapsed); } return(Visibility.Visible); }
/// <summary> /// 更新布局,获取最新资讯 /// </summary> /// <param name="page">频道数据</param> /// <returns></returns> public async Task UpdateLayout(CustomPage page, bool isForceRefresh = false) { AllFeeds.Clear(); LoadingRing.IsActive = true; JustNoReadSwitch.IsEnabled = false; AllReadButton.Visibility = Visibility.Collapsed; LastCacheTimeContainer.Visibility = Visibility.Collapsed; NoDataTipContainer.Visibility = Visibility.Collapsed; AllReadTipContainer.Visibility = Visibility.Collapsed; _sourceData = page; PageNameTextBlock.Text = _sourceData.Name; FeedCollection.Clear(); var feed = new List <RssSchema>(); if (NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable) { var schema = await IOTools.GetSchemaFromPage(_sourceData); foreach (var item in schema) { feed.Add(item); } bool isAutoCache = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.AutoCacheWhenOpenChannel, "False")); if (isAutoCache && feed.Count > 0) { await IOTools.AddCachePage(null, page); } } else { if (MainPage.Current._isCacheAlert) { new PopupToast(AppTools.GetReswLanguage("Tip_WatchingCache")).ShowPopup(); MainPage.Current._isCacheAlert = false; } var data = await IOTools.GetLocalCache(page); feed = data.Item1; _lastCacheTime = data.Item2; if (_lastCacheTime > 0) { LastCacheTimeContainer.Visibility = Visibility.Visible; LastCacheTimeBlock.Text = AppTools.TimeStampToDate(_lastCacheTime).ToString("HH:mm"); } } if (feed != null && feed.Count > 0) { AllFeeds = feed; await FeedInit(); } else { NoDataTipContainer.Visibility = Visibility.Visible; } JustNoReadSwitch.IsEnabled = true; LoadingRing.IsActive = false; }
/// <summary> /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行, /// 已执行,逻辑上等同于 main() 或 WinMain()。 /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; bool isLight = AppTools.GetLocalSetting(Models.AppSettings.Theme, "Light") == "Light"; RequestedTheme = isLight ? ApplicationTheme.Light : ApplicationTheme.Dark; this.UnhandledException += UnhandledExceptionHandle; }
/// <summary> /// 链接转换 /// </summary> /// <param name="id">回传的文件ID</param> /// <returns></returns> public string LinkConvert(string id) { string ImageAuthkey = AppTools.GetLocalSetting(AppSettings.AuthKey, ""); if (!String.IsNullOrEmpty(id) && !String.IsNullOrEmpty(ImageAuthkey)) { return($"https://storage.live.com/items/{id}?authkey={ImageAuthkey}"); } return(null); }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 从之前挂起的应用程序加载状态 } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // 当导航堆栈尚未还原时,导航到第一页, // 并通过将所需信息作为导航参数传入来配置 // 参数 if (!NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable) { rootFrame.Navigate(typeof(Pages.NetErrorPage)); } else { // 如果用户是第一次登录,那么切换到登录页 bool isFirst = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsFirstRun, "True")); if (isFirst) { rootFrame.Navigate(typeof(Pages.LoginPage)); } else { rootFrame.Navigate(typeof(MainPage), e.Arguments); } } } // 确保当前窗口处于活动状态 Window.Current.Activate(); } }
private string GetLanguage(string zh, string en) { string lan = AppTools.GetLocalSetting(CoreLib.Enums.AppSettings.Language, "en_US"); if (lan == "zh_CN") { return(zh); } else { return(en); } }
/// <summary> /// 分组列表改变时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GroupCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (GroupCombo.SelectedItem != null) { var item = (OneDriveImageGroup)GroupCombo.SelectedItem; string selectId = AppTools.GetLocalSetting(AppSettings.SelectGroupIndex, ""); if (item.GroupId != selectId) { AppTools.WriteLocalSetting(AppSettings.SelectGroupIndex, item.GroupId); GroupInit(item); HistoryInit(); } } }
private void LockButton_Click(object sender, RoutedEventArgs e) { bool isSideLocked = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.SideListLocked, "False")); if (isSideLocked) { LockButton.Foreground = AppTools.GetThemeSolidColorBrush(ColorType.ImportantTextColor); } else { LockButton.Foreground = AppTools.GetThemeSolidColorBrush(ColorType.PrimaryColor); } AppTools.WriteLocalSetting(AppSettings.SideListLocked, (!isSideLocked).ToString()); }
/// <summary> /// 上传图片至OneDrive /// </summary> /// <param name="image">图片文件</param> /// <returns></returns> public async Task <OneDriveImage> UploadImage(StorageFile image, OneDriveImageGroup group) { if (_appFolder == null) { throw new UnauthorizedAccessException("You need to complete OneDrive authorization before you can upload the image"); } var imageFolder = await GetImgSaveFolder(); var per = await image.GetBasicPropertiesAsync(); string fileId = ""; string name = ""; string extension = Path.GetExtension(image.Path); bool isAutoRename = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.AutoRename, "True")); string fileName = isAutoRename ? Guid.NewGuid() + extension : image.Name.Trim(); OneDriveStorageFile cre = null; try { // 这里要对文件大小进行判断,以4MB为分水岭,需要用不同的办法上传 if (per.Size < 4 * 1024 * 1024) { using (var stream = await image.OpenReadAsync()) { cre = await imageFolder.StorageFolderPlatformService.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting, stream); fileId = cre.OneDriveItem.Id; name = cre.OneDriveItem.Name; } } else { using (var stream = await image.OpenReadAsync()) { cre = await imageFolder.StorageFolderPlatformService.UploadFileAsync(fileName, stream, CreationCollisionOption.ReplaceExisting, 320 * 1024); fileId = cre.OneDriveItem.Id; name = cre.OneDriveItem.Name; } } string link = LinkConvert(fileId); var item = new OneDriveImage(name, await AppTools.ConvertFileToImage(image), group, link, fileId); return(item); } catch (Exception) { return(null); } }
/// <summary> /// (供外部调用)移除分组 /// </summary> /// <param name="group"></param> public void GroupCollectionRemoved(OneDriveImageGroup group) { // 待定 string selectId = AppTools.GetLocalSetting(AppSettings.SelectGroupIndex, ""); if (selectId == group.GroupId) { AppTools.WriteLocalSetting(AppSettings.SelectGroupIndex, ""); GroupCollectionReInit(); } else { GroupCollection.Remove(group); } }
private async Task FeedInit() { if (AllFeeds.Count == 0) { NoDataTipContainer.Visibility = Visibility.Visible; AllReadTipContainer.Visibility = Visibility.Collapsed; return; } bool isJustUnread = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsJustUnread, "False")); FeedCollection.Clear(); await Task.Run(async() => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { if (isJustUnread) { foreach (var item in AllFeeds) { if (!MainPage.Current.ReadIds.Contains(item.InternalID) && !MainPage.Current.TodoList.Any(p => p.InternalID == item.InternalID)) { FeedCollection.Add(item); } } } else { foreach (var item in AllFeeds) { FeedCollection.Add(item); } } bool isHasUnread = false; foreach (var item in FeedCollection) { if (!MainPage.Current.ReadIds.Contains(item.InternalID)) { isHasUnread = true; } } if (FeedCollection.Count == 0) { AllReadTipContainer.Visibility = Visibility.Visible; } AllReadButton.Visibility = isHasUnread ? Visibility.Visible : Visibility.Collapsed; }); }); }
object IValueConverter.Convert(object value, Type targetType, object parameter, string language) { if (value is string desc) { bool isShow = Convert.ToBoolean(AppTools.GetLocalSetting(Enums.AppSettings.IsShowFeedDescription, "True")); if (isShow) { return(Visibility.Visible); } else { return(Visibility.Collapsed); } } return(Visibility.Visible); }
/// <summary> /// 检测上一次同步的时间,并于本机同步时间比对 /// </summary> /// <returns>相同返回<c>True</c>,不同返回<c>False</c></returns> public async Task <bool> CheckLastAsync() { if (_appFolder == null) { throw new UnauthorizedAccessException("You need to complete OneDrive authorization before you can upload the image"); } try { var historyFile = await _appFolder.GetFileAsync("LastAsyncTime"); using (var stream = (await historyFile.StorageFilePlatformService.OpenAsync()) as IRandomAccessStream) { Stream st = WindowsRuntimeStreamExtensions.AsStreamForRead(stream); st.Position = 0; StreamReader sr = new StreamReader(st, Encoding.UTF8); string result = sr.ReadToEnd(); result = result.Replace("\0", ""); if (string.IsNullOrEmpty(result)) { return(true); } else { try { int cloudTime = Convert.ToInt32(result); int localTime = Convert.ToInt32(AppTools.GetLocalSetting(AppSettings.SyncTime, "0")); if (cloudTime != localTime) { return(false); } return(true); } catch (Exception) { return(true); } } } } catch (Exception) { await _appFolder.StorageFolderPlatformService.CreateFileAsync("LastAsyncTime", CreationCollisionOption.OpenIfExists); return(true); } }
public async Task AllRead() { var list = new List <string>(); foreach (var item in AllFeeds) { list.Add(item.InternalID); } MainPage.Current.AddReadId(list.ToArray()); AllReadButton.Visibility = Visibility.Collapsed; bool isJustUnread = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsJustUnread, "False")); if (isJustUnread) { await FeedInit(); } }
private async Task UpdateFeed() { ButtonStatusCheck(); TitleTextBlock.Text = _sourceFeed.Title; string html = await PackageHTML(_sourceFeed.Content); LoadingRing.IsActive = true; DetailWebView.NavigateToString(html); bool isSideLocked = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.SideListLocked, "False")); if (MainPage.Current.MinsizeHeaderContainer.Visibility == Visibility.Visible && !isSideLocked) { DetailSplitView.IsPaneOpen = false; } MainPage.Current.AddReadId(_sourceFeed.InternalID); await GenerateActivityAsync(_sourceFeed); }
/// <summary> /// 当文件被拖拽进上传框中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void UploadArea_Drop(object sender, DragEventArgs e) { // 如果当前有文件正在上传,则阻止当前行为 if (UploadProgressCollection.Count > 0) { string msg = AppTools.GetReswLanguage("WaitToUpload"); var tipDialog = new TipDialog(AppTools.GetReswLanguage("DefaultTipTitle"), msg); await tipDialog.ShowAsync(); return; } // 检测授权码是否存在,如不存在,则要求用户重新输入授权码 string authKey = AppTools.GetLocalSetting(AppSettings.AuthKey, ""); if (string.IsNullOrEmpty(authKey)) { var keyDialog = new AuthKeyDialog(); await keyDialog.ShowAsync(); return; } // 检测拖拽的文件 if (e.DataView.Contains(StandardDataFormats.StorageItems)) { var items = await e.DataView.GetStorageItemsAsync(); items = items.OfType <StorageFile>().ToList() as IReadOnlyList <IStorageItem>; // 对文件进行筛选,只要指定格式的图片 if (items != null && items.Any()) { var imgList = new List <StorageFile>(); foreach (var item in items) { string path = item.Path; string extends = Path.GetExtension(item.Path).Substring(1); var file = item as StorageFile; if (extends.ToLower() == "jpg" || extends.ToLower() == "png" || extends.ToLower() == "bmp" || extends.ToLower() == "gif" || extends.ToLower() == "jpeg" || extends.ToLower() == "webp") { imgList.Add(file); } } FileUpload(imgList); } } }
/// <summary> /// 包装HTML页面 /// </summary> /// <param name="content">文章主题</param> /// <returns></returns> private async Task <string> PackageHTML(string content) { bool isHideScroll = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsHideWebScroll, "True")); string html = await FileIO.ReadTextAsync(await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Template/ShowPage.html"))); string theme = AppTools.GetRoamingSetting(AppSettings.Theme, "Light"); string css = await FileIO.ReadTextAsync(await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Template/{theme}.css"))); string fontFamily = AppTools.GetLocalSetting(AppSettings.ReadFontFamily, "Tw Cen MT"); string fontSize = AppTools.GetLocalSetting(AppSettings.ReadFontSize, "16"); css = css.Replace("$FontFamily$", fontFamily).Replace("$FontSize$", fontSize); string result = html.Replace("$theme$", theme.ToLower()).Replace("$style$", css).Replace("$body$", content); result = isHideScroll ? result.Replace("$noscroll$", "style=\"-ms-overflow-style: none;\"") : result.Replace("$noscroll$", ""); result = isHideScroll ? result.Replace("$return$", "") : result.Replace("$return$", "return;"); return(result); }