protected override void OnElementChanged(ElementChangedEventArgs <GoogleMapView> e)
        {
            if (Control == null)
            {
                TChromium.Initialize();
                XForms.Context.Terminated += (sender, arg) => TChromium.Shutdown();
                SetNativeControl(new WebViewContainer(XForms.NativeParent));
                NativeWebView.LoadStarted  += OnLoadStarted;
                NativeWebView.LoadFinished += OnLoadFinished;
                NativeWebView.LoadError    += OnLoadError;
            }

            if (e.OldElement != null)
            {
                ((ObservableCollection <Marker>)e.OldElement.Markers).CollectionChanged -= OnCollectionChanged;
                e.OldElement.LoadMapRequested -= OnLoadMapRequested;
            }

            if (e.NewElement != null)
            {
                ((ObservableCollection <Marker>)e.NewElement.Markers).CollectionChanged += OnCollectionChanged;
                e.NewElement.LoadMapRequested += OnLoadMapRequested;
                LoadMap();
            }
            base.OnElementChanged(e);
        }
Esempio n. 2
0
        protected override void OnElementChanged(ElementChangedEventArgs <WebView> e)
        {
            if (Control == null)
            {
                TChromium.Initialize();
                Forms.Context.Terminated += (sender, arg) => TChromium.Shutdown();
                SetNativeControl(new WebViewContainer(Forms.NativeParent));
                NativeWebView.LoadStarted  += OnLoadStarted;
                NativeWebView.LoadFinished += OnLoadFinished;
                NativeWebView.LoadError    += OnLoadError;
            }

            if (e.OldElement != null)
            {
                e.OldElement.EvalRequested      -= OnEvalRequested;
                e.OldElement.GoBackRequested    -= OnGoBackRequested;
                e.OldElement.GoForwardRequested -= OnGoForwardRequested;
                e.OldElement.ReloadRequested    -= OnReloadRequested;
            }

            if (e.NewElement != null)
            {
                e.NewElement.EvalRequested += OnEvalRequested;
                e.NewElement.EvaluateJavaScriptRequested += OnEvaluateJavaScriptRequested;
                e.NewElement.GoForwardRequested          += OnGoForwardRequested;
                e.NewElement.GoBackRequested             += OnGoBackRequested;
                e.NewElement.ReloadRequested             += OnReloadRequested;
                Load();
            }
            base.OnElementChanged(e);
        }
Esempio n. 3
0
        protected override void OnElementChanged(ElementChangedEventArgs <WebView> e)
        {
            if (_control == null)
            {
                TChromium.Initialize();
                Forms.Context.Terminated += (sender, arg) => TChromium.Shutdown();
                _control               = new TWebView(Forms.Context.MainWindow);
                _control.LoadStarted  += OnLoadStarted;
                _control.LoadFinished += OnLoadFinished;
                _control.LoadError    += OnLoadError;
                SetNativeView(_control);
            }

            if (e.OldElement != null)
            {
                e.OldElement.EvalRequested      -= OnEvalRequested;
                e.OldElement.GoBackRequested    -= OnGoBackRequested;
                e.OldElement.GoForwardRequested -= OnGoForwardRequested;
            }

            if (e.NewElement != null)
            {
                e.NewElement.EvalRequested      += OnEvalRequested;
                e.NewElement.GoForwardRequested += OnGoForwardRequested;
                e.NewElement.GoBackRequested    += OnGoBackRequested;
                Load();
            }
            base.OnElementChanged(e);
        }
Esempio n. 4
0
 protected override void ConnectHandler(MauiWebView platformView)
 {
     TChromium.Initialize();
     MauiApplication.Current.Terminated += (sender, arg) => TChromium.Shutdown();
     PlatformWebView.LoadFinished       += OnLoadFinished;
 }