private void HandleNoWebView(EegeoResultModel eegeoResultModel)
        {
            m_webBrowser.Visibility = Visibility.Collapsed;
            m_webBrowserSelected    = false;

            if (eegeoResultModel.ImageUrl != null)
            {
                m_poiImage.Source = m_placeholderImage;
                DisplayPoiImage(true);
            }
            else
            {
                DisplayPoiImage(false);
            }
        }
Example #2
0
        private void HandleNoWebView(EegeoResultModel eegeoResultModel)
        {
            m_webBrowser.Visibility        = Visibility.Collapsed;
            m_webBrowserSelected           = false;
            m_poiImageContainer.Visibility = Visibility.Collapsed;
            m_webBrowserSelected           = false;
            m_poiImageContainer.Visibility = Visibility.Collapsed;

            if (eegeoResultModel.ImageUrl != null)
            {
                m_poiImageContainer.Visibility = Visibility.Visible;
                m_poiImage.Visibility          = Visibility.Visible;
                m_poiImageDivider.Visibility   = Visibility.Collapsed;
            }
        }
Example #3
0
        private void HandleNoWebView(EegeoResultModel eegeoResultModel)
        {
            m_webBrowser.LoadCompleted -= (OnWebPageLoaded);
            m_webBrowser.Visibility     = Visibility.Collapsed;
            m_poiHasWebContent          = false;
            StopWebBrowser();

            if (eegeoResultModel.ImageUrl != null)
            {
                m_poiImage.Source = m_placeholderImage;
                DisplayPoiImage(true);
            }
            else
            {
                DisplayPoiImage(false);
            }
        }
Example #4
0
        protected override void DisplayCustomPoiInfo(Object modelObject)
        {
            ExampleApp.SearchResultModelCLI model = modelObject as ExampleApp.SearchResultModelCLI;

            EegeoResultModel eegeoResultModel = EegeoResultModel.FromResultModel(model);

            m_closing            = false;
            m_webBrowserSelected = false;
            m_titlesGrid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star);
            m_poiImageContainer.Height            = DEFAULT_WEB_VIEW_HEIGHT;
            bool webViewUrlIsValid = false;

            m_poiImageContainer.Visibility = Visibility.Visible;
            m_poiImage.Visibility          = Visibility.Collapsed;
            m_webBrowser.Visibility        = Visibility.Visible;
            m_poiImageDivider.Visibility   = Visibility.Visible;

            m_contentContainer.ScrollToTop();

            if (eegeoResultModel.WebViewUrl != null)
            {
                m_webBrowserSelected = true;
                Uri hyperlink;
                webViewUrlIsValid = Uri.TryCreate(eegeoResultModel.WebViewUrl, UriKind.Absolute, out hyperlink) &&
                                    (hyperlink.Scheme == Uri.UriSchemeHttp || hyperlink.Scheme == Uri.UriSchemeHttps);

                if (webViewUrlIsValid)
                {
                    Uri url = new Uri(eegeoResultModel.WebViewUrl);
                    m_webBrowser.Source = url;

                    if (eegeoResultModel.WebViewHeight != 0)
                    {
                        m_webBrowserOriginalHeight = eegeoResultModel.WebViewHeight;
                        m_poiImageContainer.Height = eegeoResultModel.WebViewHeight;

                        if (eegeoResultModel.WebViewHeight > MAX_WEB_VIEW_HEIGHT)
                        {
                            m_webBrowserOriginalHeight = MAX_WEB_VIEW_HEIGHT;
                            m_poiImageContainer.Height = MAX_WEB_VIEW_HEIGHT;
                        }
                    }
                    else
                    {
                        m_webBrowserOriginalHeight = DEFAULT_WEB_VIEW_HEIGHT;
                        m_poiImageContainer.Height = DEFAULT_WEB_VIEW_HEIGHT;
                    }
                }
                else
                {
                    HandleNoWebView(eegeoResultModel);
                }
            }
            else
            {
                HandleNoWebView(eegeoResultModel);
            }

            if (!m_webBrowserSelected)
            {
                Uri uri;
                if ((eegeoResultModel.ImageUrl != null || webViewUrlIsValid) && TryCreateWebLink(eegeoResultModel.ImageUrl, out uri))
                {
                    m_poiImageDivider.Visibility = Visibility.Visible;
                }
                else
                {
                    m_poiImageContainer.Visibility = Visibility.Collapsed;
                    m_poiImageDivider.Visibility   = Visibility.Collapsed;
                }
            }

            if (eegeoResultModel.Phone != null)
            {
                PhoneText = eegeoResultModel.Phone;
                m_phoneDetailsContainer.Visibility = Visibility.Visible;
            }
            else
            {
                m_phoneDetailsContainer.Visibility = Visibility.Collapsed;
            }

            if (eegeoResultModel.Address != null)
            {
                AddressText = eegeoResultModel.Address.Replace(", ", Environment.NewLine);
                m_addressDetailsContainer.Visibility = Visibility.Visible;
            }
            else
            {
                AddressText = null;
                m_addressDetailsContainer.Visibility = Visibility.Collapsed;
            }

            if (eegeoResultModel.WebUrl != null)
            {
                WebAddressText = eegeoResultModel.WebUrl;
                m_webDetailsContainer.Visibility = Visibility.Visible;
            }
            else
            {
                m_webDetailsContainer.Visibility = Visibility.Collapsed;
            }

            if (eegeoResultModel.Facebook != null)
            {
                m_facebookIcon.Visibility = Visibility.Visible;
                m_facebookText            = eegeoResultModel.Facebook;
            }
            else
            {
                m_facebookIcon.Visibility = Visibility.Collapsed;
            }

            if (eegeoResultModel.Twitter != null)
            {
                m_twitterIcon.Visibility = Visibility.Visible;
                m_twitterText            = eegeoResultModel.Twitter;
            }
            else
            {
                m_twitterIcon.Visibility = Visibility.Collapsed;
            }

            if (eegeoResultModel.Email != null)
            {
                m_emailIcon.Visibility = Visibility.Visible;
                m_emailText            = eegeoResultModel.Email;
            }
            else
            {
                m_emailIcon.Visibility = Visibility.Collapsed;
            }

            bool shouldCollapseDivider = eegeoResultModel.Facebook == null &&
                                         eegeoResultModel.Twitter == null &&
                                         eegeoResultModel.Email == null &&
                                         eegeoResultModel.Address == null &&
                                         eegeoResultModel.Phone == null &&
                                         eegeoResultModel.WebUrl == null;

            if (shouldCollapseDivider)
            {
                m_detailsDivider.Visibility = Visibility.Collapsed;
            }
            else
            {
                m_detailsDivider.Visibility = Visibility.Visible;
            }

            if (eegeoResultModel.Facebook == null && eegeoResultModel.Twitter == null && eegeoResultModel.Email == null)
            {
                m_socialLinkIconsContainer.Visibility = Visibility.Collapsed;
            }
            else
            {
                m_socialLinkIconsContainer.Visibility = Visibility.Visible;
            }

            m_linkedInIcon.Visibility = Visibility.Collapsed;
            m_slackIcon.Visibility    = Visibility.Collapsed;
            TitleText = model.Title;
            if (model.Subtitle != "")
            {
                SubTitleText = model.Subtitle;
            }
            else
            {
                m_titlesGrid.RowDefinitions[1].Height = new GridLength(0);
            }

            if (model.HumanReadableTags != null)
            {
                HumanReadableTagsText    = string.Join(", ", model.HumanReadableTags);
                m_tagsDivider.Visibility = Visibility.Visible;
            }
            else
            {
                m_tagsDivider.Visibility = Visibility.Collapsed;
            }

            if (eegeoResultModel.Description != null)
            {
                DescriptionText = eegeoResultModel.Description;
                m_descriptionContainer.Visibility = Visibility.Visible;
            }
            else
            {
                m_descriptionContainer.Visibility = Visibility.Collapsed;
            }

            TagIcon = SearchResultPoiViewIconProvider.GetIconForTag(model.IconKey);

            ShowAll();
        }