예제 #1
0
        private void web_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs args)
        {
            args.Handled = true;
            switch (UtilityData.LinksSetting)
            {
            case 3:
                if (_ucMessageDialog == null)
                {
                    this.FindName("_ucMessageDialog");
                    if (UtilityData.isFluentDesign)
                    {
                        _ucMessageDialog.MainGrid.Background = new AcrylicBrush()
                        {
                            BackgroundSource = AcrylicBackgroundSource.Backdrop,
                            TintOpacity      = 0.9,
                            TintColor        = (_ucMessageDialog.MainGrid.Background as SolidColorBrush).Color,
                            FallbackColor    = (_ucMessageDialog.MainGrid.Background as SolidColorBrush).Color
                        };
                    }
                    _ucMessageDialog.btSameWindow.Click += (s, a) =>
                    {
                        web.Navigate(args.Uri);
                        _ucMessageDialog.Visibility       = Visibility.Collapsed;
                        _ucMessageDialog.MainGrid.Opacity = 0;
                    };
                }
                _ucMessageDialog.Visibility = Visibility.Visible;
                try
                {
                    _ucMessageDialog.MainGrid.Fade((float)1, 200).Start();
                }
                catch (Exception)
                {
                    _ucMessageDialog.MainGrid.Opacity = 1;
                }
                _ucMessageDialog.tbLink.Text = args.Uri.ToString();
                break;

            case 0:
                IAsyncOperation <bool> b = Launcher.LaunchUriAsync(args.Uri);
                break;

            case 1:
                web.Navigate(args.Uri);
                break;

            case 2:
                UtilityClass.MultipleInstance(args.Uri);
                break;
            }
        }