Inheritance: IUriToStreamResolver
Example #1
0
        public AlertPresenter()
        {
            this.InitializeComponent();

            Messenger.Default.Register <string>(this, (message) =>
            {
                if (message.Contains("alert"))
                {
                    Uri url = webView.BuildLocalStreamUri("Alert", message);
                    StreamUriResolver resolver = new StreamUriResolver();
                    webView.NavigateToLocalStreamUri(url, resolver);
                    webView.Visibility = Visibility.Visible;
                }
            });

            Messenger.Default.Register <NotificationMessage>(this, (message) =>
            {
                if (message.Notification == "navigating")
                {
                    webView.Visibility = Visibility.Collapsed;
                }
            });

            DataContextChanged += (s, e) =>
            {
                ViewModel = DataContext as ActionsViewModel;
            };
        }
Example #2
0
        public AlertPresenter()
        {
            this.InitializeComponent();

            Messenger.Default.Register <AlertMessage>(this, (message) =>
            {
                if (message.Id == Alert.Id && !string.IsNullOrEmpty(message.Path))
                {
                    Uri url = webView.BuildLocalStreamUri("Alert", message.Path);
                    StreamUriResolver resolver = new StreamUriResolver();
                    //Edge Mobile doesn't render fb-video posts, so must fake browser as IE11 for those posts on mobile devices
                    if (Alert.BodyHTML.Contains("fb-video") && (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile"))
                    {
                        HttpRequestMessage httpRequestMessage = new HttpRequestMessage(
                            HttpMethod.Post, url);
                        var add = "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko";
                        httpRequestMessage.Headers.Add("User-Agent", add);
                        webView.NavigateWithHttpRequestMessage(httpRequestMessage);
                    }
                    else
                    {
                        webView.NavigateToLocalStreamUri(url, resolver);
                    }
                    Debug.WriteLine(Windows.Storage.ApplicationData.Current.TemporaryFolder.Path + "\\" + message.Path);
                }
            });

            Messenger.Default.Register <AlertMessage>(this, (message) =>
            {
                if (message.Id == Alert.Id && string.IsNullOrEmpty(message.Path))
                {
                    webView.Visibility      = Visibility.Collapsed;
                    ProgressRing.Visibility = Visibility.Visible;
                }
                if (message.Id != Alert.Id)
                {
                    webView.Visibility = Visibility.Collapsed;
                }
            });

            DataContextChanged += (s, e) =>
            {
                ViewModel = DataContext as ActionsViewModel;
            };
        }
        public AlertPresenter()
        {
            this.InitializeComponent();

            Messenger.Default.Register<AlertMessage>(this, (message) =>
            {
                if (message.Id == Alert.Id && !string.IsNullOrEmpty(message.Path))
                {
                    Uri url = webView.BuildLocalStreamUri("Alert", message.Path);
                    StreamUriResolver resolver = new StreamUriResolver();
                    //Edge Mobile doesn't render fb-video posts, so must fake browser as IE11 for those posts on mobile devices
                    if (Alert.BodyHTML.Contains("fb-video") && (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile"))
                    {
                        HttpRequestMessage httpRequestMessage = new HttpRequestMessage(
                            HttpMethod.Post, url);
                        var add = "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko";
                        httpRequestMessage.Headers.Add("User-Agent", add);
                        webView.NavigateWithHttpRequestMessage(httpRequestMessage);
                    }
                    else
                    {
                        webView.NavigateToLocalStreamUri(url, resolver);
                    }
                    Debug.WriteLine(Windows.Storage.ApplicationData.Current.TemporaryFolder.Path + "\\" + message.Path);
                }
            });

            Messenger.Default.Register<AlertMessage>(this, (message) =>
            {
                if (message.Id == Alert.Id && string.IsNullOrEmpty(message.Path))
                {
                    webView.Visibility = Visibility.Collapsed;
                    ProgressRing.Visibility = Visibility.Visible;
                }
                if (message.Id != Alert.Id)
                {
                    webView.Visibility = Visibility.Collapsed;
                }
            });

            DataContextChanged += (s, e) =>
            {
                ViewModel = DataContext as ActionsViewModel;
            };
        }