Пример #1
0
        private void CoreWebView2_WebMessageReceived(object sender, Microsoft.Web.WebView2.Core.CoreWebView2WebMessageReceivedEventArgs e)
        {
            string value = e.TryGetWebMessageAsString();

            string[] args = value.Split(new char[] { '|' }, 2);
            if (args[0] == "PasteValue")
            {
                //Trace.WriteLine(args[1]);
                PasteValue(args[1]);
            }

            else if (args[0] == "PasteValueList")
            {
                PasteValueList(args[1]);
            }


            else if (args[0] == "SetToClipBoard")
            {
                SetToClipboard(args[1]);
            }


            else if (args[0] == "esc")
            {
                DiyHide();
            }
            else if (args[0].StartsWith("test"))
            {
            }
        }
        private async void CoreWebView2_WebMessageReceived(object sender, Microsoft.Web.WebView2.Core.CoreWebView2WebMessageReceivedEventArgs e)
        {
            progressBar.Visibility = Visibility.Visible;
            string     message    = e.TryGetWebMessageAsString();
            Geolocator geolocator = new Geolocator();
            var        result     = await geolocator.GetGeopositionAsync();

            string coordinates = $"{message} - Latitude: {result.Coordinate.Point.Position.Latitude} - Longitude: {result.Coordinate.Point.Position.Longitude}";

            progressBar.Visibility = Visibility.Collapsed;
            MessageBox.Show(coordinates);
        }