Esempio n. 1
0
        //画面遷移する直前
        private void WebViewNavigating(object sender, NavigatingCancelEventArgs e)
        {
            if (e.Uri.OriginalString.StartsWith("javascript:"))
            {
                WebBrowser.InvokeScript("eval", e.Uri.OriginalString.Split(new char[] { ':' }, 2)[1]);

                e.Cancel = true;
                return;
            }

            //Viewerで開けるURLはViewerで開く
            if (NicoNicoOpener.GetType(e.Uri.OriginalString) != NicoNicoUrlType.Other && OpenWithViewer)
            {
                //なぜかNavgatingイベントが2回呼ばれる箇所があるので対策
                if (PrevUrl == e.Uri.OriginalString)
                {
                    e.Cancel = true;
                    return;
                }

                PrevUrl  = e.Uri.OriginalString;
                e.Cancel = true;
                NicoNicoOpener.Open(e.Uri.OriginalString);
            }
            else
            {
                IsActive     = true;
                Owner.Status = "読み込み中: " + e.Uri.OriginalString;
            }
        }
Esempio n. 2
0
        private void Value_Navigating1(object sender, NavigatingCancelEventArgs e)
        {
            Url = e.Uri.OriginalString;

            if (!ForceWebView && NicoNicoOpener.GetType(e.Uri) != NicoNicoUrlType.Other && !(Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
            {
                e.Cancel = true;

                NicoNicoOpener.Open(e.Uri);
                return;
            }
        }
Esempio n. 3
0
        private void browser_Navigating(object sender, NavigatingCancelEventArgs e)
        {
            if (e.Uri != null)
            {
                var url = e.Uri.OriginalString;

                if (NicoNicoOpener.GetType(url) != NicoNicoUrlType.Other)
                {
                    NicoNicoOpener.Open(url);
                    e.Cancel = true;
                }
            }
        }
Esempio n. 4
0
 protected override void Invoke(object parameter)
 {
     //Viewerで開けるURLをWebViewで開こうとした時は
     //Viewerで開くフラグが経っているとアレな動作になるので
     if (NicoNicoOpener.GetType(Url) == NicoNicoUrlType.Other)
     {
         App.ViewModelRoot.AddWebViewTab(Url, false);
     }
     else
     {
         App.ViewModelRoot.AddWebViewTab(Url, true);
     }
 }
        public void ShowInfomation()
        {
            if (ToolTip != null || Entry.VideoUrl == null)
            {
                return;
            }

            NicoRepoType = NicoNicoOpener.GetType(Entry.VideoUrl);

            if (NicoRepoType == NicoNicoUrlType.Video)
            {
                ToolTip           = new VideoDataViewModel(Entry.VideoUrl.Substring(30));
                ToolTipVisibility = Visibility.Visible;
            }
        }
Esempio n. 6
0
        public void InitializeToolTip(object sender, RoutedEventArgs e)
        {
            var link = sender as Hyperlink;

            //すでにツールチップがあったらスキップ
            if (link.ToolTip != null)
            {
                return;
            }

            var inline = link.Inlines.First() as Run;

            if (inline != null)
            {
                var uri = link.NavigateUri;
                //#○○:×× リンクだとnullになるので
                if (uri == null)
                {
                    var time = inline.Text;

                    if (time.StartsWith("#"))
                    {
                        link.NavigateUri = new Uri(time, UriKind.Relative);
                    }

                    return;
                }
                var text = uri.OriginalString;
                var type = NicoNicoOpener.GetType(text);

                if (type == NicoNicoUrlType.Video)
                {
                    link.ToolTip = text;
                }
                else
                {
                    link.ToolTip = text;
                }
            }
        }
        public void OpenHyperLink(object sender, RequestNavigateEventArgs e)
        {
            var url = e.Uri.OriginalString;

            if (url.StartsWith("#"))
            {
                if (DataContext is VideoViewModel)
                {
                    var vm   = (VideoViewModel)DataContext;
                    var time = url.Substring(1);

                    vm.Handler.Seek(NicoNicoUtil.ConvertTime((time)));
                }
            }
            else
            {
                if (DataContext is VideoViewModel)
                {
                    var vm = (VideoViewModel)DataContext;

                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.LeftShift) || NicoNicoOpener.GetType(e.Uri.OriginalString) != NicoNicoUrlType.Video)
                    {
                        NicoNicoOpener.Open(e.Uri.OriginalString);
                    }
                    else
                    {
                        NicoNicoOpener.Replace(vm, e.Uri.OriginalString);
                        vm.DisposeViewModel();
                    }
                }
            }
        }
Esempio n. 8
0
        public void OpenHyperLink(object sender, RequestNavigateEventArgs e)
        {
            var url = e.Uri.OriginalString;

            if (DataContext is VideoViewModel)
            {
                var vm = (VideoViewModel)DataContext;
                if (url.StartsWith("#"))
                {
                    vm.Handler.Seek(NicoNicoUtil.ConvertTime((url.Substring(1))));
                }
                else
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.LeftShift) || NicoNicoOpener.GetType(e.Uri.OriginalString) != NicoNicoUrlType.Video)
                    {
                        NicoNicoOpener.Open(e.Uri.OriginalString);
                    }
                    else
                    {
                        //URLを書き換えて再読込
                        vm.VideoUrl = e.Uri.OriginalString;
                        vm.Initialize();
                    }
                }
            }
        }