Ejemplo n.º 1
0
        async void SetText()
        {
            UkName.Text = Settings.MobileSettings.main_name;
            if (!string.IsNullOrWhiteSpace(Settings.Person.companyPhone))
            {
                LabelPhone.Text = "+" + Settings.Person.companyPhone.Replace("+", "");
            }
            else
            {
                IconViewLogin.IsVisible = false;
                LabelPhone.IsVisible    = false;
            }
            LabelTitle.Text = newsInfo.Header;
            LabelDate.Text  = newsInfo.Created;
            newsInfoFull    = await _server.GetNewsFull(newsInfo.ID.ToString());

            //LabelText.Text = newsInfoFull.Text;
            //LabelText.FormattedText = (FormattedString)(new HtmlTextConverter()).Convert(newsInfoFull.Text, null);

            //var new_text = System.Text.RegularExpressions.Regex.Replace(newsInfoFull.Text, @"width=\""[0-9]*\""", "width=\"100%\"");

            //newsInfoFull.Text = System.Text.RegularExpressions.Regex.Replace(new_text, @"height=\""[0-9]*\""", "");
            MainText.Source = new HtmlWebViewSource {
                Html = newsInfoFull.Text
            };
            MainText.FlowDirection = FlowDirection.MatchParent;
            MainText.Navigated    += (s, e) =>
            {
                if (!navigated)
                {
                    (s as WebView).Source = new UrlWebViewSource()
                    {
                        Url = e.Url
                    };
                    navigated = true;
                }
            };
            Color hexColor = (Color)Application.Current.Resources["MainColor"];

            IconViewLogin.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);
            Pancake.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent);
            PancakeViewIcon.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent); { if (AppInfo.PackageName == "rom.best.saburovo" || AppInfo.PackageName == "sys_rom.ru.tsg_saburovo")
                                                                                                              {
                                                                                                                  PancakeViewIcon.Padding = new Thickness(0);
                                                                                                              }
            }
            //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.Black);
            //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.Black);
            if (Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet)
            {
                Device.BeginInvokeOnMainThread(async() => await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorNoInternet, "OK"));
                return;
            }

            Files.IsVisible = newsInfoFull.HasImage;
        }