Exemplo n.º 1
0
        private void ViewModelOnOpenWebView(string html, int id)
        {
            //BackNav
            ViewModelLocator.NavMgr.RegisterBackNav(PageIndex.PageArticles,
                                                    ViewModel.Articles[id].Type == MalNewsType.Article
                    ? MalArticlesPageNavigationArgs.Articles
                    : MalArticlesPageNavigationArgs.News);
            //
            _currentId = id;
            var color  = '#' + ResourceExtension.AccentColourHex.Substring(3);      //uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Accent);
            var color1 = '#' + ResourceExtension.AccentColourDarkHex.Substring(3);  //uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.AccentDark2);
            var color2 = '#' + ResourceExtension.AccentColourLightHex.Substring(3); //uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.AccentLight2);
            var css    = Css.Replace("AccentColourBase", color).
                         Replace("AccentColourLight", color2).
                         Replace("AccentColourDark", color1)
                         .Replace("BodyBackgroundThemeColor",
                                  Settings.SelectedTheme == 1 ? "#2d2d2d" : "#e6e6e6")
                         .Replace("BodyForegroundThemeColor",
                                  Settings.SelectedTheme == 1 ? "white" : "black").Replace(
                "HorizontalSeparatorColor", Settings.SelectedTheme == 1 ? "#0d0d0d" : "#b3b3b3");

            //ArticlesPageWebView.NavigateToString();

            ArticlesPageWebView.LoadDataWithBaseURL(null, css + Begin + html + "</div></body></html>", "text/html; charset=utf-8", "UTF-8", null);
        }
Exemplo n.º 2
0
 private async void ViewModelOnOpenWebView(string html, MalNewsUnitModel item)
 {
     ViewModelLocator.NavMgr.RegisterOneTimeOverride(new RelayCommand(() =>
     {
         ViewModel.WebViewVisibility      = false;
         ViewModel.ArticleIndexVisibility = true;
     }));
     _currentId = ViewModel.Articles.IndexOf(item);
     ArticlesPageWebView.LoadDataWithBaseURL(null, ResourceLocator.CssManager.WrapWithCss(html), "text/html; charset=utf-8", "UTF-8", null);
 }