private void WebBrowser_Navigating(object sender, WebNavigatingEventArgs e)
 {
     this.Indicator.IsRunning = true;
 }
Example #2
0
 private void Browse_OnNavigating(object sender, WebNavigatingEventArgs e)
 {
     loading.IsVisible = true;
 }
 private void WebView_Navigating(object sender, WebNavigatingEventArgs e)
 {
     webview.IsVisible = false;
     loader.IsVisible  = true;
 }
Example #4
0
 internal void BlazorForwardSendNavigating(WebNavigatingEventArgs args)
 {
     Element.SendNavigating(args);
 }
Example #5
0
            public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType)
            {
                var navEvent = WebNavigationEvent.NewPage;

                switch (navigationType)
                {
                case UIWebViewNavigationType.LinkClicked:
                    navEvent = WebNavigationEvent.NewPage;
                    break;

                case UIWebViewNavigationType.FormSubmitted:
                    navEvent = WebNavigationEvent.NewPage;
                    break;

                case UIWebViewNavigationType.BackForward:
                    navEvent = _renderer._lastBackForwardEvent;
                    break;

                case UIWebViewNavigationType.Reload:
                    navEvent = WebNavigationEvent.Refresh;
                    break;

                case UIWebViewNavigationType.FormResubmitted:
                    navEvent = WebNavigationEvent.NewPage;
                    break;

                case UIWebViewNavigationType.Other:
                    navEvent = WebNavigationEvent.NewPage;
                    break;
                }

                _lastEvent = navEvent;
                var lastUrl = request.Url.ToString();
                var args    = new WebNavigatingEventArgs(navEvent, new UrlWebViewSource {
                    Url = lastUrl
                }, lastUrl);

                var jCookies = WebView.Cookies.GetCookies(request.Url);

                if (jCookies != null)
                {
                    // Set cookies here
                    var cookieJar = NSHttpCookieStorage.SharedStorage;
                    cookieJar.AcceptPolicy = NSHttpCookieAcceptPolicy.Always;

                    //clean up old cookies
                    foreach (var aCookie in cookieJar.Cookies)
                    {
                        cookieJar.DeleteCookie(aCookie);
                    }

                    //set up the new cookies
                    if (WebView.Cookies != null)
                    {
                        IList <NSHttpCookie> eCookies =
                            (from object jCookie in jCookies
                             where jCookie != null
                             select(Cookie) jCookie
                             into netCookie
                             select new NSHttpCookie(netCookie)).ToList();

                        cookieJar.SetCookies(eCookies.ToArray(), request.Url, request.Url);
                    }
                }

                WebView.SendNavigating(args);
                _renderer.UpdateCanGoBackForward();
                return(!args.Cancel);
            }
Example #6
0
        private void onNavigating(object sender, WebNavigatingEventArgs e)
        {
            string current_url = HttpUtility.UrlDecode(e.Url);

            if (current_url.Equals("ixian:onload", StringComparison.Ordinal))
            {
                onLoad();
            }
            else if (current_url.Equals("ixian:back", StringComparison.Ordinal))
            {
                Navigation.PopAsync(Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:remove", StringComparison.Ordinal))
            {
                onRemove();
                Navigation.PopAsync(Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:removehistory", StringComparison.Ordinal))
            {
                onRemoveHistory();
            }
            else if (current_url.Equals("ixian:request", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new WalletReceivePage(friend), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:send", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new WalletSendPage(friend.walletAddress), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:chat", StringComparison.Ordinal))
            {
                if (customChatBtn)
                {
                    Navigation.PopAsync(Config.defaultXamarinAnimations);
                    e.Cancel = true;
                    return;
                }
                else
                {
                    Navigation.PushAsync(new SingleChatPage(friend), Config.defaultXamarinAnimations);
                }
            }
            else if (current_url.Contains("ixian:txdetails:"))
            {
                string[] split = current_url.Split(new string[] { "ixian:txdetails:" }, StringSplitOptions.None);
                string   id    = split[1];

                Transaction transaction = null;
                foreach (Transaction tx in TransactionCache.transactions)
                {
                    if (tx.id.Equals(id, StringComparison.Ordinal))
                    {
                        transaction = tx;
                        break;
                    }
                }

                if (transaction == null)
                {
                    foreach (Transaction tx in TransactionCache.unconfirmedTransactions)
                    {
                        if (tx.id.Equals(id, StringComparison.Ordinal))
                        {
                            transaction = tx;
                            break;
                        }
                    }

                    if (transaction == null)
                    {
                        e.Cancel = true;
                        return;
                    }
                }

                Navigation.PushAsync(new WalletSentPage(transaction), Config.defaultXamarinAnimations);
            }
            else
            {
                // Otherwise it's just normal navigation
                e.Cancel = false;
                return;
            }
            e.Cancel = true;
        }
Example #7
0
        private void onNavigating(object sender, WebNavigatingEventArgs e)
        {
            string current_url = HttpUtility.UrlDecode(e.Url);

            e.Cancel = true;

            if (current_url.Equals("ixian:onload", StringComparison.Ordinal))
            {
                onLoad();
            }
            else if (current_url.Equals("ixian:back", StringComparison.Ordinal))
            {
                friend.chat_page = null;

                Navigation.PopAsync(Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:request", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new WalletReceivePage(friend), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:details", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new ContactDetails(friend, true), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:send", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new WalletSendPage(friend.walletAddress), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:accept", StringComparison.Ordinal))
            {
                onAcceptFriendRequest();
            }
            else if (current_url.Equals("ixian:call", StringComparison.Ordinal))
            {
                if (VoIPManager.isInitiated())
                {
                    VoIPManager.hangupCall(null);
                }
                else
                {
                    VoIPManager.initiateCall(friend);
                }
            }
            else if (current_url.Equals("ixian:sendfile", StringComparison.Ordinal))
            {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                onSendFile();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            }
            else if (current_url.Contains("ixian:acceptfile:"))
            {
                string id = current_url.Substring("ixian:acceptfile:".Length);

                FriendMessage fm = friend.messages.Find(x => x.transferId == id);
                if (fm != null)
                {
                    onAcceptFile(fm);
                }
                else
                {
                    Logging.error("Cannot find message with transfer id: {0}", id);
                }
            }
            else if (current_url.Contains("ixian:openfile:"))
            {
                string id = current_url.Substring("ixian:openfile:".Length);

                FriendMessage fm = friend.messages.Find(x => x.transferId == id);

                // Open file in default app. May not work, check https://forums.xamarin.com/discussion/103042/how-to-open-pdf-or-txt-file-in-default-app-on-xamarin-forms
                //Device.OpenUri(new Uri(transfer.filePath));
                if (File.Exists(fm.filePath))
                {
                    DependencyService.Get <IFileOperations>().open(fm.filePath);
                }
            }
            else if (current_url.Contains("ixian:chat:"))
            {
                string msg = current_url.Substring("ixian:chat:".Length);
                onSend(msg);
            }
            else if (current_url.Contains("ixian:viewPayment:"))
            {
                string tx_id = current_url.Substring("ixian:viewPayment:".Length);
                onViewPayment(tx_id);
            }
            else if (current_url.Contains("ixian:app:"))
            {
                string app_id = current_url.Substring("ixian:app:".Length);
                onApp(app_id);
            }
            else if (current_url.StartsWith("ixian:appAccept:"))
            {
                string session_id = current_url.Substring("ixian:appAccept:".Length);
                onAppAccept(session_id);
            }
            else if (current_url.StartsWith("ixian:appReject:"))
            {
                string session_id = current_url.Substring("ixian:appReject:".Length);
                onAppReject(session_id);
            }
            else if (current_url.StartsWith("ixian:hangUp:"))
            {
                string session_id = current_url.Substring("ixian:hangUp:".Length);
                VoIPManager.hangupCall(Crypto.stringToHash(session_id));
            }
            else
            {
                // Otherwise it's just normal navigation
                e.Cancel = false;
                return;
            }
            e.Cancel = true;
        }
Example #8
0
 private void wvwRecipes_Navigating(object sender, WebNavigatingEventArgs e)
 {
     wvwRecipes.IsVisible = false;
     actLoading.IsVisible = true;
 }
Example #9
0
 private void WebView_Navigating(object sender, WebNavigatingEventArgs e)
 {
     defaultActivityIndicator.IsRunning = true;    //指示器开启
     labelLoading.IsVisible             = true;
 }
Example #10
0
 private void Thewebview_Navigating(object sender, WebNavigatingEventArgs e)
 {
     SiteNavActivityIndcator.IsVisible = true;
     Thewebview.IsVisible = false;
 }
 void OnNavigating(object sender, WebNavigatingEventArgs e)
 {
     LoadingLabel.IsVisible = true;
 }
Example #12
0
 /// <summary>
 /// Send the Navigated event
 /// </summary>
 /// <param name="args"></param>
 internal void SendNavigated(WebNavigatingEventArgs args)
 {
     Navigated?.Invoke(this, args);
 }
Example #13
0
 private void Browser_Navigating(object sender, WebNavigatingEventArgs e)
 {
     LoadingLabel.IsVisible = true;
 }
 void webviewNavigating(object sender, WebNavigatingEventArgs e)
 {
     labelLoading.IsVisible = true;
 }
Example #15
0
 private void PagOnNavigating(object sender, WebNavigatingEventArgs e)
 {
     lblStatus.Text = "Carregando página...";
 }
Example #16
0
 private void Web_Navigating(object sender, WebNavigatingEventArgs e)
 {
     labelLoading.IsVisible = true;
 }
Example #17
0
 private void ArtWebV_Navigating(object sender, WebNavigatingEventArgs e)
 {
     this.skltLoading.IsVisible = true;
 }
Example #18
0
 void webOnNavigating(object sender, WebNavigatingEventArgs e)
 {
     Console.WriteLine(sender.ToString() + ", " + e.Url);
 }
Example #19
0
 private void webView_Navigating(object sender, WebNavigatingEventArgs e)
 {
     ActivityIndicatorView.IsRunning = true;
 }
Example #20
0
 private void web_Stripe_Navigating(object sender, WebNavigatingEventArgs e)
 {
     bar.IsRunning = true;
     bar.IsVisible = true;
 }
 void webviewNavigating(object sender, WebNavigatingEventArgs e)
 {
     progressBar.IsVisible = true;
 }
 private void NewsWebView_Navigating(object sender, WebNavigatingEventArgs e) => URLSearchBar.Text = e.Url;
Example #23
0
        private void onNavigating(object sender, WebNavigatingEventArgs e)
        {
            string current_url = HttpUtility.UrlDecode(e.Url);

            if (onNavigatingGlobal(current_url))
            {
                e.Cancel = true;
                return;
            }

            if (current_url.Equals("ixian:onload", StringComparison.Ordinal))
            {
                onLoaded();
            }
            else if (current_url.Equals("ixian:wallet", StringComparison.Ordinal))
            {
                // Deprecated
            }
            else if (current_url.Equals("ixian:quickscan", StringComparison.Ordinal))
            {
                ICustomQRScanner scanner = DependencyService.Get <ICustomQRScanner>();
                if (scanner != null && scanner.useCustomQRScanner())
                {
                    Logging.error("Custom scanner not implemented");
                    e.Cancel = true;
                    return;
                }
                quickScan();
            }
            else if (current_url.Contains("ixian:qrresult:"))
            {
                string[] split  = current_url.Split(new string[] { "ixian:qrresult:" }, StringSplitOptions.None);
                string   result = split[1];
                processQRResult(result);
                e.Cancel = true;
                return;
            }
            else if (current_url.Equals("ixian:newchat", StringComparison.Ordinal))
            {
                newChat();
            }
            else if (current_url.Equals("ixian:newcontact", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new ContactNewPage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:sendixi", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new WalletSendPage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:receiveixi", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new WalletReceivePage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:wixi", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new WIXISendPage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:avatar", StringComparison.Ordinal))
            {
                //onChangeAvatarAsync(sender, e);
            }
            else if (current_url.Equals("ixian:settings", StringComparison.Ordinal))
            {
                onSettings(sender, e);
            }
            else if (current_url.Equals("ixian:address", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new MyAddressPage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:lock", StringComparison.Ordinal))
            {
                //   prepBackground();
                Navigation.PushAsync(new SetLockPage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:activity", StringComparison.Ordinal))
            {
                // TODO show wallet activity screen
            }
            else if (current_url.Equals("ixian:about", StringComparison.Ordinal))
            {
#pragma warning disable CS0618 // Type or member is obsolete
                Device.OpenUri(new Uri(Config.aboutUrl));
#pragma warning restore CS0618 // Type or member is obsolete
            }
            else if (current_url.Equals("ixian:guide", StringComparison.Ordinal))
            {
#pragma warning disable CS0618 // Type or member is obsolete
                Device.OpenUri(new Uri(Config.guideUrl));
#pragma warning restore CS0618 // Type or member is obsolete
            }
            else if (current_url.Equals("ixian:backup", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new BackupPage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:encpass", StringComparison.Ordinal))
            {
                Navigation.PushAsync(new EncryptionPassword(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Contains("ixian:chat:"))
            {
                string[] split = current_url.Split(new string[] { "ixian:chat:" }, StringSplitOptions.None);
                string   id    = split[1];
                onChat(id, e);
            }
            else if (current_url.Contains("ixian:details:"))
            {
                string[] split = current_url.Split(new string[] { "ixian:details:" }, StringSplitOptions.None);
                string   id    = split[1];
                // TODO: handle exceptions
                byte[] id_bytes = Base58Check.Base58CheckEncoding.DecodePlain(id);

                Friend friend = FriendList.getFriend(id_bytes);

                if (friend == null)
                {
                    e.Cancel = true;
                    return;
                }

                Navigation.PushAsync(new ContactDetails(friend), Config.defaultXamarinAnimations);
            }
            else if (current_url.Contains("ixian:txdetails:"))
            {
                string[] split  = current_url.Split(new string[] { "ixian:txdetails:" }, StringSplitOptions.None);
                string   id     = split[1];
                byte[]   b_txid = Transaction.txIdLegacyToV8(id);

                Transaction transaction = null;
                foreach (Transaction tx in TransactionCache.transactions)
                {
                    if (tx.id.SequenceEqual(b_txid))
                    {
                        transaction = tx;
                        break;
                    }
                }

                if (transaction == null)
                {
                    lock (TransactionCache.unconfirmedTransactions)
                    {
                        foreach (Transaction tx in TransactionCache.unconfirmedTransactions)
                        {
                            if (tx.id.SequenceEqual(b_txid))
                            {
                                transaction = tx;
                                break;
                            }
                        }
                    }

                    if (transaction == null)
                    {
                        e.Cancel = true;
                        return;
                    }
                }

                Navigation.PushAsync(new WalletSentPage(transaction), Config.defaultXamarinAnimations);
            }
            else if (current_url.Contains("ixian:tab:"))
            {
                currentTab = current_url.Split(new string[] { "ixian:tab:" }, StringSplitOptions.None)[1];
            }
            else if (current_url.Equals("ixian:apps", StringComparison.Ordinal))
            {
                //   prepBackground();
                Navigation.PushAsync(new AppsPage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.Equals("ixian:downloads", StringComparison.Ordinal))
            {
                //   prepBackground();
                Navigation.PushAsync(new DownloadsPage(), Config.defaultXamarinAnimations);
            }
            else if (current_url.StartsWith("ixian:viewLog"))
            {
                // TODO perhaps move this whole functionality to Logging class and delete spixi.log.zip on start if exists

                if (File.Exists(Path.Combine(Config.spixiUserFolder, "spixi.log.zip")))
                {
                    File.Delete(Path.Combine(Config.spixiUserFolder, "spixi.log.zip"));
                }

                if (File.Exists(Path.Combine(Config.spixiUserFolder, "ixian.log.tmp")))
                {
                    File.Delete(Path.Combine(Config.spixiUserFolder, "ixian.log.tmp"));
                }

                File.Copy(Path.Combine(Config.spixiUserFolder, "ixian.log"), Path.Combine(Config.spixiUserFolder, "ixian.log.tmp"));

                using (ZipArchive archive = ZipFile.Open(Path.Combine(Config.spixiUserFolder, "spixi.log.zip"), ZipArchiveMode.Create))
                {
                    archive.CreateEntryFromFile(Path.Combine(Config.spixiUserFolder, "ixian.log.tmp"), "ixian.log");
                    if (File.Exists(Path.Combine(Config.spixiUserFolder, "ixian.0.log")))
                    {
                        archive.CreateEntryFromFile(Path.Combine(Config.spixiUserFolder, "ixian.0.log"), "ixian.0.log");
                    }
                }

                if (File.Exists(Path.Combine(Config.spixiUserFolder, "ixian.log.tmp")))
                {
                    File.Delete(Path.Combine(Config.spixiUserFolder, "ixian.log.tmp"));
                }

                DependencyService.Get <IFileOperations>().share(Path.Combine(Config.spixiUserFolder, "spixi.log.zip"), "Share Spixi Log File");
            }
            else if (current_url.StartsWith("ixian:onboardingComplete"))
            {
                Application.Current.Properties["onboardingComplete"] = true;
                Application.Current.SavePropertiesAsync();  // Force-save properties for compatibility with WPF

                SpixiLocalization.addCustomString("OnboardingComplete", "true");
                generatePage("index.html");
            }
            else if (current_url.StartsWith("ixian:joinBot"))
            {
                Friend friend = FriendList.addFriend(Base58Check.Base58CheckEncoding.DecodePlain("419jmKRKVFcsjmwpDF1XSZ7j1fez6KWaekpiawHvrpyZ8TPVmH1v6bhT2wFc1uddV"), null, "Spixi Group Chat", null, null, 0);
                if (friend != null)
                {
                    friend.save();

                    StreamProcessor.sendContactRequest(friend);
                }
            }
            else
            {
                // Otherwise it's just normal navigation
                e.Cancel = false;
                return;
            }
            e.Cancel = true;
        }
 private void webView_Navigating(object sender, WebNavigatingEventArgs e)
 {
     progress.IsVisible = true;
 }
Example #25
0
 private void ActionCarregando(object sender, WebNavigatingEventArgs args)
 {
     LblStatus.Text = "Carregando...";
 }
Example #26
0
 // Issue: This event is not fired if the url refers to a page requested
 //        by https in a server with self signed certificate
 private void OnUrlNavigating(object sender, WebNavigatingEventArgs e)
 {
     Debug.WriteLine($"++++ Navigated to {e.Url}");
 }
 private void PaymentWebView_Navigating(object sender, WebNavigatingEventArgs e)
 {
     UserDialogs.Instance.ShowLoading("");
 }
Example #28
0
        private void CreateAttributedString(UILabel control, string html)
        {
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;
            // --------------
            // 02-01-2018 : Fix for default font family => https://github.com/matteobortolazzo/HtmlLabelPlugin/issues/9
            var fontDescriptor = control.Font.FontDescriptor.VisibleName;
            var fontFamily     = fontDescriptor.ToLower().Contains("system") ? "-apple-system,system-ui,BlinkMacSystemFont,Segoe UI" : control.Font.FamilyName;

            html += "<style> body{ font-family: " + fontFamily + ";}</style>";
            // --------------
            var myHtmlData = NSData.FromString(html, NSStringEncoding.Unicode);
            // control.Lines = 0;
            var mutable = new NSMutableAttributedString(new NSAttributedString(myHtmlData, attr, ref nsError));

            if (mutable.MutableString.HasSuffix(new NSString("\n")))
            {
                mutable.DeleteRange(new NSRange(mutable.MutableString.Length - 1, 1));
            }

            var links = new List <LinkData>();

            control.AttributedText = mutable;

            // Makes a list of all links:
            mutable.EnumerateAttributes(new NSRange(0, mutable.Length), NSAttributedStringEnumeration.LongestEffectiveRangeNotRequired, (NSDictionary attrs, NSRange range, ref bool stop) =>
            {
                foreach (var a in attrs) // should use attrs.ContainsKey(something) instead
                {
                    if (a.Key.ToString() != "NSLink")
                    {
                        continue;
                    }
                    links.Add(new LinkData(range, a.Value.ToString()));
                    return;
                }
            });

            // Sets up a Gesture recognizer:
            if (links.Count <= 0)
            {
                return;
            }
            control.UserInteractionEnabled = true;
            var tapGesture = new UITapGestureRecognizer((tap) =>
            {
                var url = DetectTappedUrl(tap, (UILabel)tap.View, links);
                if (url == null)
                {
                    return;
                }

                var label = (SupportHtmlLabel)Element;
                var args  = new WebNavigatingEventArgs(WebNavigationEvent.NewPage, new UrlWebViewSource {
                    Url = url
                }, url);
                label.SendNavigating(args);

                if (args.Cancel)
                {
                    return;
                }

                Device.OpenUri(new Uri(url));
                label.SendNavigated(args);
            });

            control.AddGestureRecognizer(tapGesture);
        }
        protected void webOnNavigating(object sender, WebNavigatingEventArgs e)
        {
            var link = e.Url;

            Application.Current.Properties["link"] = link;
        }
 protected void OnNavigating(object sender, WebNavigatingEventArgs e)
 {
     progress.IsVisible = true;
 }
Example #31
0
			public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType)
			{
				var navEvent = WebNavigationEvent.NewPage;
				switch (navigationType)
				{
					case UIWebViewNavigationType.LinkClicked:
						navEvent = WebNavigationEvent.NewPage;
						break;
					case UIWebViewNavigationType.FormSubmitted:
						navEvent = WebNavigationEvent.NewPage;
						break;
					case UIWebViewNavigationType.BackForward:
						navEvent = _renderer._lastBackForwardEvent;
						break;
					case UIWebViewNavigationType.Reload:
						navEvent = WebNavigationEvent.Refresh;
						break;
					case UIWebViewNavigationType.FormResubmitted:
						navEvent = WebNavigationEvent.NewPage;
						break;
					case UIWebViewNavigationType.Other:
						navEvent = WebNavigationEvent.NewPage;
						break;
				}

				_lastEvent = navEvent;
				var lastUrl = request.Url.ToString();
				var args = new WebNavigatingEventArgs(navEvent, new UrlWebViewSource { Url = lastUrl }, lastUrl);

				WebView.SendNavigating(args);
				_renderer.UpdateCanGoBackForward();
				return !args.Cancel;
			}