예제 #1
0
 private void Browser_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     if (!args.IsSuccess)
     {
         Debug.WriteLine("Navigation to this page failed, check your internet connection.");
     }
 }
예제 #2
0
 private void Web_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     if (args.IsSuccess)
     {
         Value.Text = args.Uri.ToString();
     }
 }
예제 #3
0
 private void WebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     //this.webView.AllowedScriptNotifyUris.Add(new Uri("ms-appx-web:///Resources/HTMLPage1.html"));
     
     //gridManager.Move(7, 12, this.webView);
     gridManager.Move(0, 0, this.webView);
 }
        private async void WebViewer_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            // Check if new location is redirect uri
            if (args.Uri.AbsoluteUri.IndexOf(App.RedirectUri) == 0)
            {
                // Get parameters
                var encoder = new WwwFormUrlDecoder(args.Uri.AbsoluteUri.Replace('#', '&')); // Replacing # with ? to make GetFirstValueByName() work
                var accessToken = encoder.GetFirstValueByName("access_token");
                var expires = encoder.GetFirstValueByName("expires");
                if (!String.IsNullOrEmpty(accessToken))
                {
                    // Success
                    App.AccessToken = accessToken;
                    App.Expires = expires;

                    Frame.GoBack();
                    var successDialog = new MessageDialog("Successfully logged in.", "Success!");
                    await successDialog.ShowAsync();
                    return;
                }

                // Show error message, if something went wrong
                var errorDialog = new MessageDialog("Whoops, we could not log you in successfully. Sorry for that!", "Something went wrong...");
                await errorDialog.ShowAsync();
                Frame.GoBack();
            }
        }
예제 #5
0
 private async void myWebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     string pagecontent = await myWebView.InvokeScriptAsync("eval", new string[] { "document.documentElement.innerHTML;" });
     myWebView.Visibility = Visibility.Collapsed;
     //Debug.WriteLine(pagecontent);
     refreshUI(pagecontent);
     await library.writeFile("artist" + artist.sublink, pagecontent);
 }
        private void WebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            _isLoading = false;

            if (args.IsSuccess)
                _browserWindow.events.emit("NKE.DidFinishLoad", _id);
            else
                _browserWindow.events.emit("NKE.DidFailLoading", new Tuple<int, string>(_id, args.WebErrorStatus.ToString()));
        }
 private void webView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     if (!args.IsSuccess)
     {
         Debug.WriteLine("Failed: {0}", args.WebErrorStatus.ToString());
         return;
     }
     ProgressRing.Visibility = Visibility.Collapsed;
     webView.Visibility = Visibility.Visible;
 }
예제 #8
0
 private async void TopicWebViewOnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     TopicWebView.NavigationCompleted -= TopicWebViewOnNavigationCompleted;
     if (!string.IsNullOrEmpty(Loc.Topic.CurrentTopic.TopicReponseId))
     {
         await TopicWebView.InvokeScriptAsync("scrollTo", new string[1]
         {
             Loc.Topic.CurrentTopic.TopicReponseId
         });
     }
 }
예제 #9
0
        private async void Web_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            if (args.IsSuccess)
            {
                Value.Text = args.Uri.ToString();

                string result = await this.Display.InvokeScriptAsync("eval", new string[]
                { "window.alert = function (AlertMessage) {window.external.notify(AlertMessage)}" });

       
            }
        }
예제 #10
0
 /// <summary>
 /// Webs the view_ on navigation completed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The <see cref="WebViewNavigationCompletedEventArgs"/> instance containing the event data.</param>
 private async void WebView_OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     await WebView.InvokeScriptAsync("eval", new[]
     {
         "var signButton=document.getElementById(\"MyButton\");" +
         "if (signButton.addEventListener) {" +
             "signButton.addEventListener(\"click\", MyButtonClicked, false);" +
         "} else {" +
             "signButton.attachEvent('onclick', MyButtonClicked);" +
         "}  " +
         "function MyButtonClicked(){" +
             " window.external.notify('%%' + location.href);"+
          "}"
     });
 }
예제 #11
0
        private async void webView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            //var arguments = new List<string>
            //{
            //    "$(document).ready(function(){$(\'[href$=\".jpg\"]\').click (function() {window.external.notify(this.href+'|'+this.title); return false;});});"
             
            //};
            //await webView.InvokeScriptAsync("eval", arguments);

            var arguments1 = new List<string>
            {

                 "$(document).ready(function(){$('a').click (function() {window.external.notify(this.href+'|'+$(this).html()); return false;});});"
            };
            await webView.InvokeScriptAsync("eval", arguments1);
        }
        private void InternetTest_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
            if (args.IsSuccess)
            {
                InternetAvailable = true;

                networkStatus.Text = loader.GetString("128_CS_Text1");
                networkStatus.Foreground = new SolidColorBrush(Colors.Green);
                InternetTest.Stop();

            }
            else
            {
                InternetAvailable = false;
            }

        }
예제 #13
0
        private async void Browser_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            if (!args.IsSuccess)
            {
                Debug.WriteLine("Navigation to this page failed, check your internet connection.");
            }

            if (RedirectedToAuthPage(args.Uri.ToString()))
            {
                if (QueryContainsAuthorizationCode(args.Uri.Query))
                {
                    var token = await CheckAuthorizationCodeResult(args);
                }
                else if(FragmentContainsAccessToken(args.Uri.Fragment)) //implicit oauth returns info in fragment and not query
                {
                    var token = await CheckImplicitResult(args.Uri.Fragment);
                    Client.SetBearerAuthorizationHeader(token);
                    var activities = await Client.GetUserActivityLogs(new DateTime(2015, 6, 30));
                }
            }
        }
예제 #14
0
        private async void OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            _isHtmlLoaded = true;

            await _webView.LoadScriptAsync("AppStudio.Uwp.Controls.HtmlViewer.HtmlViewerScript.js");

            _currentHeaderHeight = 0;

            await SetFontSize();
            await SetForeground();
            await SetContentAlignment(this.ContentAlignment);

            _documentSize = ParseRect(await _webView.InvokeScriptAsync("getHtmlDocumentRect"));
            await SetHtmlDocumentMargin();

            _documentSize = ParseRect(await _webView.InvokeScriptAsync("getHtmlDocumentRect"));
            await OnDocumentResize(_documentSize);

            _progress.IsActive = false;
            _progress.Visibility = Visibility.Collapsed;
            _frame.FadeIn(250);
        }
예제 #15
0
        private void Browser_OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            if(!args.Uri.OriginalString.StartsWith(RequestGenerator.EndUrl))
                return;

            IsSuccess = args.IsSuccess;

            if(args.IsSuccess)
            {
                Match m = regex.Match(args.Uri.OriginalString);
                if(m.Success)
                    Code = m.Groups[1].Value;
                else
                    ErrorMessage = "Can not extract token";
            }
            else
                ErrorMessage = args.WebErrorStatus.ToString();

            asyncDialog.Cancel();

            manualResetEvent.Set();
        }
예제 #16
0
 private async void Webview_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     string js = "document.getElementsByClassName('header')[0].style.display='none';";
     if (args.Uri.ToString() == "http://m.kugou.com/loginReg.php?act=login&url=http://m.kugou.com")
     {
         title.Text = "登录";
     }
     if (args.Uri.ToString() == "http://m.kugou.com/loginReg.php?act=reg&url=http://m.kugou.com")
     {
         title.Text = "注册";
     }
     if (args.Uri.ToString()== "http://m.kugou.com/")
     {
         js = "window.external.notify(document.cookie)";
     }
     try
     {
         await sender.InvokeScriptAsync("eval", new string[] { js });
     }
     catch (Exception)
     {
         
     }
 }
        private void HandleNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            progressBar.Visibility = Visibility.Collapsed;
            progressBar.IsIndeterminate = false;

            var uri = args.Uri;
            var error = args.WebErrorStatus;
            if (args.IsSuccess)
            {
                UnityPlayer.AppCallbacks.Instance.InvokeOnAppThread(() =>
                {
                    if (_onFinished != null)
                        _onFinished(uri, _state);
                }, false);
            }
            else
            {
                UnityPlayer.AppCallbacks.Instance.InvokeOnAppThread(() =>
                {
                    if (_onError != null)
                        _onError(uri, (int)error, _state);
                }, false);
            }
        }
 private void ShareWebView_NavigationCompleted(object sender, WebViewNavigationCompletedEventArgs e)
 {
     ShareWebView.Visibility = Windows.UI.Xaml.Visibility.Visible;
     BlockingRect.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
     LoadingProgressRing.IsActive = false;
 }
예제 #19
0
        private void WebView_OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            var command = new ThreadDomContentLoadedCommand();

            command.Execute(ThreadFullView);
        }
예제 #20
0
 private void WebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     Progress.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
 }
예제 #21
0
 private async void WebView_OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
 }
        async void webView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            if (args.Uri.AbsolutePath.EndsWith("/userauth/index.html"))
            {
                if (args.IsSuccess)
                {
                    webView.Visibility            = Visibility.Visible;
                    progressRing.Visibility       = Visibility.Collapsed;
                    progressRing.IsActive         = false;
                    RetryHintTextBlock.Visibility = Visibility.Collapsed;
                }
                else
                {
                    AuthPageLoadFailedHint.Visibility = Visibility.Visible;
                }
            }
            else if (args.Uri.AbsolutePath.EndsWith("getautha.html"))
            {
                var content = await webView.InvokeScriptAsync("eval", new string[] { "document.body.innerHTML;" });

                if (content.Contains("验证失败"))
                {
                    webView.Visibility            = Visibility.Collapsed;
                    progressRing.IsActive         = true;
                    RetryHintTextBlock.Visibility = Visibility.Visible;
                    progressRing.Visibility       = Visibility.Visible;
                    if (webView.CanGoBack)
                    {
                        webView.GoBack(); // Try Again
                        webView.Refresh();
                    }
                    else
                    {
                        WebViewNavigate(new Uri("http://www.linovel.com/userauth/index.html"));
                    }
                }
                else
                {
                    var           resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
                    MessageDialog dialog         = new MessageDialog(resourceLoader.GetString("AuthSucceedDialogContent"), resourceLoader.GetString("AuthSucceedDialogTitle"));

                    //HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
                    var ua = await webView.InvokeScriptAsync("eval", new string[] { "navigator.userAgent;" });

                    AppGlobal.SetAccountUserAgent(ua);

                    await dialog.ShowAsync();

                    Frame.GoBack(); // Return to HubPage

                    //var resulst = await LightKindomHtmlClient.ValidateLoginAuth();
                    //using (var client = LightKindomHtmlClient.NewUserHttpClient(UserAgentType.Account))
                    //{
                    //    var str = await client.GetStringAsync(new Uri("http://www.linovel.com/main/login.html?from=www.linovel.com/"));
                    //    Debug.WriteLine(str);
                    //}
                }

                //.CaptureSelectedContentToDataPackageAsync();
                //var text = await datapackage.GetView().GetTextAsync();
                //webView.Navigate(new Uri("http://www.linovel.com/main/login.html?from=www.linovel.com/"));
                //var filter = new HttpBaseProtocolFilter();
                //var cookieManager = filter.CookieManager;
                //var cookies = cookieManager.GetCookies(new Uri("http://www.linovel.com/"));
                //var ci_session = cookies.FirstOrDefault(ck => ck.Name == "ci_session_3");
                //foreach(var ck in cookies)
                //{
                //	if (ck != ci_session)
                //		cookieManager.DeleteCookie(ck);
                //}
                //this.Frame.GoBack();
                //using (var client = new HttpClient())
                //{
                //	client.DefaultRequestHeaders.Add("User-Agent", LightKindomHtmlClient.UserAgentString);
                //	var str = await client.GetStringAsync(new Uri("http://www.linovel.com/main/login.html?from=www.linovel.com/"));
                //	Debug.WriteLine(str);
                //}
            }
            else if (args.IsSuccess)
            {
                webView.Visibility            = Visibility.Visible;
                progressRing.Visibility       = Visibility.Collapsed;
                progressRing.IsActive         = false;
                RetryHintTextBlock.Visibility = Visibility.Collapsed;
            }
        }
예제 #23
0
        private async void NavigationCompleteB(Windows.UI.Xaml.Controls.WebView webView, WebViewNavigationCompletedEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine("B webView.Size=[" + webView.Width + "," + webView.Height + "]");


            using (InMemoryRandomAccessStream ms = new InMemoryRandomAccessStream())
            {
                await webView.CapturePreviewToStreamAsync(ms);

                var decoder = await BitmapDecoder.CreateAsync(ms);

                var transform = new BitmapTransform
                {
                    ScaledHeight = (uint)decoder.PixelHeight,
                    ScaledWidth  = (uint)decoder.PixelWidth
                };

                var pixelData = await decoder.GetPixelDataAsync(
                    BitmapPixelFormat.Bgra8,
                    BitmapAlphaMode.Straight,
                    transform,
                    ExifOrientationMode.RespectExifOrientation,
                    ColorManagementMode.DoNotColorManage);

                var bytes = pixelData.DetachPixelData();


                var piclib   = Windows.Storage.ApplicationData.Current.TemporaryFolder;
                var fileName = (string)webView.GetValue(PngFileNameProperty) + ".png";
                var file     = await piclib.CreateFileAsync(fileName, Windows.Storage.CreationCollisionOption.GenerateUniqueName);

                using (var stream = await file.OpenAsync(FileAccessMode.ReadWrite))
                {
                    var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream);

                    encoder.SetPixelData(BitmapPixelFormat.Bgra8,
                                         BitmapAlphaMode.Ignore,
                                         (uint)decoder.PixelWidth, (uint)decoder.PixelHeight,
                                         0, 0, bytes);
                    await encoder.FlushAsync();
                }

                var onComplete = (Action <string>)webView.GetValue(OnCompleteProperty);
                onComplete?.Invoke(file.Path);
            }
        }
예제 #24
0
 private void WebView_FrameNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     //Hide progress indicator
     progressStackPanel.Visibility = Visibility.Collapsed;
 }
예제 #25
0
 private void _webView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     _loaded.Release();
 }
예제 #26
0
 private void webPlayer_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     LoadOk = true;
 }
 private void _webView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     Logger.Instance.Debug("WebView navigation completed. Target: {uri}", args.Uri);
     _tcsNavigationCompleted.TrySetResult(null);
 }
예제 #28
0
 private void PrivacyWebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     GazeInput.DwellFeedbackProgressBrush = _solidTileBrush;
     WebViewLoadingText.Visibility        = Visibility.Collapsed;
 }
예제 #29
0
 private void WebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs e)
 {
     NavigationComplete?.Invoke(sender, e);
 }
예제 #30
0
 private void AboutMeWebView_OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     AboutMeLoader.Visibility = Visibility.Collapsed;
 }
 private void NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     progressRing.IsActive = false;
 }
예제 #32
0
 private void NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     _contentPanelBase.FireOnLoading(false);
     HideReadingModeLoading();
 }
 void webView7_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     ProgressRing1.IsActive = false;
 }
예제 #34
0
 private void OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs e)
 {
     if (e.IsSuccess)
     {
         OnNavigationSucceeded();
     }
     else
     {
         OnNavigationFailed(e.WebErrorStatus);
     }
 }
예제 #35
0
        private async void NavigationCompleteA(Windows.UI.Xaml.Controls.WebView webView, WebViewNavigationCompletedEventArgs args)
        {
            var contentSize = await webView.WebViewContentSizeAsync();

            webView.NavigationCompleted -= NavigationCompleteA;

            System.Diagnostics.Debug.WriteLine("A contentSize=[" + contentSize + "]");
            System.Diagnostics.Debug.WriteLine("A webView.Size=[" + webView.Width + "," + webView.Height + "]");

            webView.Width  = contentSize.Width;
            webView.Height = contentSize.Height;
            webView.UpdateLayout();

            webView.NavigationCompleted += NavigationCompleteB;

            var html = (string)webView.GetValue(HtmlStringProperty);

            webView.NavigateToString(html);
        }
예제 #36
0
 private void ArticleWebView_OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     ViewModel.LoadingVisibility = false;
     ViewModel.WebViewVisibility = true;
 }
예제 #37
0
 private void _webView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     Logger.Instance.Debug("WebView navigation completed. Target: {uri}", args.Uri);
     _navigationCompleted.Release();
 }
예제 #38
0
 private void wbPopup_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     prgPopup.IsIndeterminate = false;
     pageIsLoading            = false;
 }
 private async void OnWebViewNavigationCompleted(Windows.UI.Xaml.Controls.WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     if (args.IsSuccess)
     {
         // Inject JS script
         await Control.InvokeScriptAsync("eval", new[] { JavaScriptFunction });
     }
 }
 private void BrowserOnLoadCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     if (!args.IsSuccess)
     {
         progressBar.Visibility = Visibility.Collapsed;
         errorTextBlock.Visibility = Visibility.Visible;
     }
     else
     {
         webView.NavigationCompleted -= BrowserOnLoadCompleted;
         webView.Visibility = Visibility.Visible;
         progressBar.Visibility = Visibility.Collapsed;
     }
 }
예제 #41
0
 private void webView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     CanGoBack        = webView.CanGoBack;
     WebViewTitleText = webView.DocumentTitle;
 }
 /// <summary>
 /// Occurs when the WebView has finished loading the current content or if navigation has failed.
 /// </summary>
 /// <param name="sender">The event source.</param>
 /// <param name="args">The event data. If there is no event data, this parameter will be null.</param>
 private void webViewChangelog_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     webViewChangelog.Visibility = Visibility.Visible;
     ChangelogManager.ConfirmRead();
 }
예제 #43
0
 private void finish(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     progressweb.IsActive = false;
 }
예제 #44
0
 private void CommentsWebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     m_CurrentUri = args.Uri;
 }
예제 #45
0
 private void webview1_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     shifou_jiazai = true;
 }
예제 #46
0
 private void OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     IsLoading = false;
     OnPropertyChanged(nameof(IsBackEnabled));
     OnPropertyChanged(nameof(IsForwardEnabled));
 }
 void WebViewControl_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     ProgressControl.IsActive = false;
 }
 private void WebViewOnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     this.Inject(NativeFunction + GetFuncScript());
     Element.OnLoadFinished(sender, EventArgs.Empty);
 }
        private async void AuthBrowser_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs e)
        {
            //access token is a Url fragment and these fragments start with '#'

            //string uri = e.ToString();
            MessageDialog messageDialog1;
            MessageDialog messageDialog2;

            try 
            { 
            //MessageDialog messageDialog2 = new MessageDialog(uri);
            //await messageDialog2.ShowAsync();
                if (e.Uri.AbsoluteUri.Contains("?code"))
                {

                    string uri = e.Uri.AbsoluteUri.ToString();

                    string code = uri.Split('?').Last().Replace("code=", string.Empty);
                    NameValueCollection parameters = new NameValueCollection()
                    {
                        client_id = "",
                        client_secret = "",
                        grant_type = "authorization_code",
                        redirect_uri = "https://api.instagram.com",
                        code = code,
                    };

                    //string consumerKey = System.Net.WebUtility.UrlEncode("pRESOJWfLJ40fumYxGq9g");     //Put your own consumer key here.
                    //string consumerSecret = System.Net.WebUtility.UrlEncode("8Bblw0EQ6RAvcHW2B9w4lD7BkpvUZGuhWLd5A9Eo");   // Put your own consumer secret here.
                    //byte[] tokenBytes = System.Text.Encoding.UTF8.GetBytes(consumerKey + ":" + consumerSecret);
                    //string tokenCredentials = System.Convert.ToBase64String(tokenBytes);



                    //HttpClient client = new HttpClient();
                    //var result = client.GetStringAsync("https://api.instagram.com/oauth/access_token", parameters);

                    //var response = System.Text.Encoding.Default.GetString(result);

                    //URL link to POST the "code" and retrieve access token
                    //GetPictures(parameters);
                    Uri authUri = new Uri("https://api.instagram.com/oauth/access_token");

                    var client = new HttpClient();

                    //Add Post Method
                    var authContent = new HttpRequestMessage(HttpMethod.Post, authUri);

                    //Add App Parameters to content
                    var values = new List<KeyValuePair<string, string>>();

                    values.Add(new KeyValuePair<string, string>("client_id", parameters.client_id));
                    values.Add(new KeyValuePair<string, string>("client_secret", parameters.client_secret));
                    values.Add(new KeyValuePair<string, string>("grant_type", "authorization_code"));
                    values.Add(new KeyValuePair<string, string>("redirect_uri", parameters.redirect_uri));
                    values.Add(new KeyValuePair<string, string>("code", parameters.code));
                    authContent.Content = new FormUrlEncodedContent(values);
                    //authContent.Headers.Add("Authorization", "Basic " + tokenCredentials);

                    //Get Response from URL with parameters
                    HttpResponseMessage authResponse = await client.SendAsync(authContent);

                    //Store response into string
                    string authResponseString = await authResponse.Content.ReadAsStringAsync();

                    AuthBrowser.Visibility = Visibility.Collapsed;
                    //Deserialize responseString into JsonObject
                    JObject authJsonObject = await JsonConvert.DeserializeObjectAsync<JObject>(authResponseString);
                    if (access_token == null)
                    {
                        //Retrieve access token
                        access_token = authJsonObject["access_token"].ToString();
                        AuthBrowser.Width = 0;
                        AuthBrowser.Visibility = Visibility.Collapsed;

                        ProgressBar.IsIndeterminate = true;
                        ProgressBar.Visibility = Visibility.Visible;

                    }

                    //var client = new HttpClient();
                    string hashUri = "https://api.instagram.com/v1/tags/" + hashvalue +"/media/recent?access_token=" + access_token;
                    Uri getUri = new Uri(hashUri);  //%23blabla means we get the tweets with #blabla hashtag, replace with anything you like
                    var getContent = new HttpRequestMessage(HttpMethod.Get, getUri);
                    //getContent.Headers.Add("Authorization", "Bearer " + access_token);
                    HttpResponseMessage getResponse = await client.SendAsync(getContent);
                    // .....
                    string getResponseString = await getResponse.Content.ReadAsStringAsync();


                    JObject getJsonObject = await JsonConvert.DeserializeObjectAsync<JObject>(getResponseString);
                    var instaObjects = getJsonObject["data"].ToList();
                    List<Instapost> instaList = new List<Instapost>();
                    foreach (JObject insta in instaObjects)
                    {
                        Instapost d = new Instapost();
                        //d.comments.count =
                        d.Username = insta["user"]["username"].ToString();
                        d.FullName = insta["user"]["full_name"].ToString();
                        d.ImageUrl = insta["images"]["standard_resolution"]["url"].ToString();
                        d.ProfilePicture = insta["user"]["profile_picture"].ToString();
                        if (insta["caption"].Children().Any())
                            d.Message = insta["caption"]["text"].ToString();
                        if (insta["likes"] != null)
                            d.LoveCount = insta["likes"]["count"].ToString();
                        instaList.Add(d);

                    }
                    InstaListView.ItemsSource = instaList;
                    AuthBrowser.Width = 0;
                    AuthBrowser.Visibility = Visibility.Collapsed;
                    ProgressBar.Visibility = Visibility.Collapsed;
                    ProgressBar.IsIndeterminate = false;
                }
            }
            catch(Exception error)
            {
                ProgressBar.Visibility = Visibility.Collapsed;
                ProgressBar.IsIndeterminate = false;
                //RefreshButton.IsEnabled = true;
                messageDialog2 = new MessageDialog("Could not get tweets: " + error.Message);
                messageDialog2.ShowAsync();
            }
            
        }
예제 #50
0
 private void WebPage_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     checkBox.Visibility = Visibility.Visible;
 }
예제 #51
0
 private void Page_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     Page.Visibility = Visibility.Visible;
 }
예제 #52
0
        //private void webView_ContentLoading(WebView sender, WebViewContentLoadingEventArgs args)
        //{
        //    LoadIncompleted(sender);
        //    CheckCompletion(sender);
        //}


        private void webView_FrameNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
        }
 private void webView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     buttonGoBack.IsEnabled = sender.CanGoBack;
     buttonGoForward.IsEnabled = sender.CanGoForward;
 }
 private void WebView_OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     this.ProgressBar.Visibility = Visibility.Collapsed;
 }
 private void NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     HideLoading();
     HideReadingModeLoading();
 }
예제 #56
0
 private void WebViewService_NavigationComplete(object sender, WebViewNavigationCompletedEventArgs e)
 {
     NavCompleted(e);
 }
		void wbMain_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
		{
			bLoading = false;
			//Hack to avoid opening links in new page
			wbMain.InvokeScriptAsync("eval", new[]
            {
                @"(function()
                {
                    var hyperlinks = document.getElementsByTagName('a');
                    for(var i = 0; i < hyperlinks.length; i++)
                    {
                        if(hyperlinks[i].getAttribute('target') != null)
                        {
                            hyperlinks[i].setAttribute('target', '_self');
                        }
                    }
                })()"
            });


		}
예제 #58
0
 private void NavCompleted(WebViewNavigationCompletedEventArgs e)
 {
     IsLoading = false;
     RaisePropertyChanged(nameof(BrowserBackCommand));
     RaisePropertyChanged(nameof(BrowserForwardCommand));
 }
예제 #59
0
 /// <summary>
 /// Event to indicate webview has completed the navigation, either with success or failure.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 void webView1_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     pageIsLoading = false;
     if (args.IsSuccess)
     {
         string url = (args.Uri != null) ? args.Uri.ToString() : "<null>";
         appendLog(String.Format("Navigation to \"{0}\"completed successfully.\n", url));
     }
     else
     {
         string url = "";
         try { url = args.Uri.ToString(); }
         finally
         {
             address.Text = url;
             appendLog(String.Format("Navigation to: \"{0}\" failed with error code {1}.\n", url, args.WebErrorStatus.ToString()));
         }
     }
 }
예제 #60
0
 private void webview_NavigationCompleted(Windows.UI.Xaml.Controls.WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     webview.Opacity        = 1;
     progressRing.IsEnabled = false;
     progressRing.IsActive  = false;
 }