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(); } } } }
//ログイン後の初期化処理 public void LogedInInit() { User = new NicoNicoUserEntry(); User.UserId = NicoNicoWrapperMain.Session.UserId; User.UserName = NicoNicoUser.LookupUserName(User.UserId); App.ViewModelRoot.Title += "(user:"******")"; TabItems.Add(WebView = new WebViewViewModel()); TabItems.Add(Ranking = new RankingViewModel()); TabItems.Add(Search = new SearchViewModel()); TabItems.Add(new FavoriteViewModel()); TabItems.Add(new NicoRepoViewModel()); TabItems.Add(new MylistViewModel()); TabItems.Add(NotifyLive = new NotifyLiveViewModel()); TabItems.Add(new HistoryViewModel()); TabItems.Add(new OtherViewModel()); TabItems.Add(Config = new ConfigViewModel()); //生放送通知を更新するタイマーを動かす StatusBar.StartRefreshTimer(); //サーバーからアップデートがあるか確認してあったらアップデートダイアログを出す Update.CheckUpdate(); //公式NG機能を初期化 NGCommentInstance = new NicoNicoNGComment(); //NGCommentInstance.GetNGClient(); if (Environment.GetCommandLineArgs().Length > 1) { Task.Run(() => NicoNicoOpener.Open(Environment.GetCommandLineArgs()[1])); } }
//画面遷移する直前 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; } }
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(); } } } }
//ユーザーページを開く public void Open() { if (SelectedCommunity != null) { NicoNicoOpener.Open(SelectedCommunity.CommunityPage); } SelectedCommunity = null; }
public void Open() { //編集モードの時は開かない if (!Owner.IsEditMode) { NicoNicoOpener.Open(Item.ContentUrl); } }
//選択された動画を開く public void Open() { if (SelectedItem != null) { NicoNicoOpener.Open("http://www.nicovideo.jp/watch/" + SelectedItem.Data.Id); SelectedItem = null; } }
private void desc_Navigating(object sender, NavigatingCancelEventArgs e) { if (e.Uri != null) { NicoNicoOpener.Open(e.Uri); e.Cancel = true; } }
public void Open() { if (SelectedLive != null) { NicoNicoOpener.Open(SelectedLive.LiveUrl); SelectedLive = null; } }
//動画を開く public void OpenVideo() { if (SelectedItem != null) { NicoNicoOpener.Open("http://www.nicovideo.jp/watch/" + SelectedItem.Node.Cmsid); SelectedItem = null; } }
//ユーザーページを開く public void Open() { if (SelectedUser != null) { NicoNicoOpener.Open(SelectedUser.UserPage); } SelectedUser = null; }
public void Open() { //not existsの時など if (SelectedItem == null) { return; } NicoNicoOpener.Open("http://www.nicovideo.jp/watch/" + SelectedItem.Node.Cmsid); SelectedItem = null; }
public void OpenHyperLink(object sender, RequestNavigateEventArgs e) { var text = e.Uri.OriginalString; if (text.StartsWith("mylist/")) { text = "http://www.nicovideo.jp/" + text; } NicoNicoOpener.Open(text); }
public void Open() { //not existsの時など if (SelectedItem == null || SelectedItem.Url == null) { SelectedItem = null; return; } NicoNicoOpener.Open(SelectedItem.Url); SelectedItem = null; }
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; } }
public void Refresh() { if (IsPlayList) { PlayListEntry.Owner.Jump(PlayListEntry); } else { DisposeViewModel(); NicoNicoOpener.Replace(this, VideoUrl); } }
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; } } }
public void Reflesh() { DisposeViewModel(); if (IsPlayList) { Initialize(); } else { NicoNicoOpener.Open(VideoUrl); } }
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 Open() { //not existsの時など if (SelectedItem == null || SelectedItem.Entry.VideoUrl == null) { SelectedItem = null; return; } //URLに応じて開くものを変える NicoNicoOpener.Open(SelectedItem.Entry.VideoUrl); SelectedItem = null; }
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; } }
//投稿者を開く public void OpenHyperLink(object sender, RequestNavigateEventArgs e) { var vm = DataContext as VideoViewModel; if (vm != null) { if (vm.VideoData.ApiData.IsChannelVideo) { NicoNicoOpener.Open("http://ch.nicovideo.jp/channel/ch" + e.Uri.OriginalString); } else { NicoNicoOpener.Open("http://www.nicovideo.jp/user/" + e.Uri.OriginalString); } } }
public async void Initialize() { //自動的にサインインする サインイン情報がなければ foreach (var user in await SignIn.AutoSignIn()) { UserList.Add(user); } //一番最初に来たユーザーがカレントになる CurrentUser = UserList.First(); //セッションを保存 SignIn.SaveSession(UserList.ToList(), CurrentUser); Status = "サインイン完了"; MainContent.AddSystemTab(WebView = new WebViewViewModel()); MainContent.AddSystemTab(Ranking = new RankingViewModel()); MainContent.AddSystemTab(Search = new SearchViewModel()); MainContent.AddSystemTab(new FollowViewModel()); MainContent.AddSystemTab(new NicoRepoViewModel()); MainContent.AddSystemTab(new MylistViewModel()); MainContent.AddSystemTab(LiveNotify = new LiveNotifyViewModel()); MainContent.AddSystemTab(History = new HistoryViewModel()); MainContent.AddSystemTab(new OtherViewModel()); MainContent.AddSystemTab(Setting = new SettingsViewModel()); if (await UpdateChecker.IsUpdateAvailable()) { Messenger.Raise(new TransitionMessage(typeof(Views.UpdateFoundView), new UpdaterViewModel(), TransitionMode.Modal)); } var args = Environment.GetCommandLineArgs(); if (args.Length == 2) { var commandline = Environment.GetCommandLineArgs()[1]; NicoNicoOpener.TryOpen(commandline); } }
public void OpenHyperLink(object sender, RequestNavigateEventArgs e) { var url = e.Uri.OriginalString; if (url.StartsWith("#")) { if (DataContext is VideoViewModel) { VideoViewModel vm = (VideoViewModel)DataContext; var time = url.Substring(1); vm.Seek(NicoNicoUtil.ConvertTime((time))); } } else { NicoNicoOpener.Open(e.Uri.OriginalString); } }
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 Open() { if (SelectedItem != null) { if (SelectedItem.Entry.Type == 0) { NicoNicoOpener.Open("http://www.nicovideo.jp/watch/" + SelectedItem.Entry.Id); } else if (SelectedItem.Entry.Type == 5) { System.Diagnostics.Process.Start("http://seiga.nicovideo.jp/watch/mg" + SelectedItem.Entry.Id); } else if (SelectedItem.Entry.Type == 6) { System.Diagnostics.Process.Start("http://seiga.nicovideo.jp/watch/bk" + SelectedItem.Entry.Id); } else if (SelectedItem.Entry.Type == 11) { //System.Diagnostics.Process.Start("http://ch.nicovideo.jp/" + SelectedItem.Entry); } SelectedItem = null; } }
public void OpenCommunity() { NicoNicoOpener.Open(CommunityUrl); }
public void Open() { NicoNicoOpener.Open("http://www.nicovideo.jp/watch/" + Item.VideoId); }
public void OpenHyperLink(object sender, RequestNavigateEventArgs e) { NicoNicoOpener.Open(e.Uri.OriginalString); }
public void OpenNew() { NicoNicoOpener.OpenNew(this); }