//VideoViewから public void Remove(VideoViewModel vm) { if (VideoList.Contains(vm)) { VideoList.Remove(vm); } }
//指定したプレイリストエントリに飛ぶ public void Jump(PlayListEntryViewModel entry) { if (Video == null) { Video = new VideoViewModel(entry.ContentUrl); Video.VideoEnded += (obj, e) => { if (Video.IsRepeat) { return; } if (SelectedPlayList == PlayList.Last() && !IsRepeat) { if (Video.IsFullScreen) { Window.GetWindow(Video.FullScreenWebBrowser)?.Close(); } } else { Next(); } }; Video.CloseRequest += (obj, e) => { App.ViewModelRoot.MainContent.RemoveUserTab(this); }; } else { Video.VideoUrl = entry.ContentUrl; Video.Initialize(); } }
public void AddVideoView(VideoViewModel vm) { //UserItemsにVideoViewが無かったら追加する if (!UserItems.Contains(VideoView)) { AddUserTab(VideoView); } VideoView.Add(vm); SelectedTab = VideoView; }
//URLから適当なViewを開く public static TabItemViewModel Open(string url, bool addtab = true) { /*if(Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { System.Diagnostics.Process.Start(url); return null; }*/ if(url.StartsWith("http://www.nicovideo.jp/watch/")) { var vm = new VideoViewModel(url); if(addtab) { App.ViewModelRoot.AddTabAndSetCurrent(vm); } return vm; } else if(url.StartsWith("http://www.nicovideo.jp/user/")) { var vm = new UserViewModel(url); if(addtab) { App.ViewModelRoot.AddTabAndSetCurrent(vm); } return vm; } else if(url.StartsWith("http://www.nicovideo.jp/mylist/")) { var vm = new PublicMylistViewModel(url); if(addtab) { App.ViewModelRoot.AddTabAndSetCurrent(vm); } return vm; } else if(url.StartsWith("http://com.nicovideo.jp/community/")) { var vm = new CommunityViewModel(url); if(addtab) { App.ViewModelRoot.AddTabAndSetCurrent(vm); } return vm; } /*else if(url.StartsWith("http://live.nicovideo.jp/watch/")) { var vm = new LiveViewModel(url); App.ViewModelRoot.AddTabAndSetCurrent(vm); return vm; }*/ else { System.Diagnostics.Process.Start(url); return null; } }
//指定したプレイリストエントリに飛ぶ public void Jump(PlayListEntryViewModel entry) { Video?.DisposeViewModel(); Video = new VideoViewModel(entry, IsFullScreen); UIInstance.DataContext = Video; Video.Initialize(); if (IsFullScreen) { UpdateFullScreenViewModel(); } }
public void Initialize(VideoViewModel vm) { Owner = vm; if (Owner.ApiData.Video.Id.Contains("nm")) { VideoType = NicoNicoVideoType.SWF; Browser.Source = new Uri(GetSWFPlayerPath()); } else if (Owner.ApiData.Video.SmileInfo.Url.Contains("rtmp")) { VideoType = NicoNicoVideoType.RTMP; Browser.Source = new Uri(GetRTMPPlayerPath()); } else { if (Owner.ApiData.Video.MovieType == "flv") { VideoType = NicoNicoVideoType.FLV; } else { if (Owner.ApiData.Video.DmcInfo != null) { VideoType = NicoNicoVideoType.New; } else { VideoType = NicoNicoVideoType.MP4; } } Browser.Source = new Uri(GetHtml5PlayerPath()); } }
public void RemoveVideoView(VideoViewModel vm) { var index = VideoView.VideoList.IndexOf(vm); if (index < 0) { return; } if (index == 0) { VideoView.Remove(vm); VideoView.SelectedList = VideoView.VideoList.FirstOrDefault(); } else { VideoView.Remove(vm); VideoView.SelectedList = VideoView.VideoList[index - 1]; } if (VideoView.VideoList.Count == 0) { UserItems.Remove(VideoView); } }
private void Initialize() { SelectedPlayList = PlayList.First(); Video = new VideoViewModel(this); Video.Initialize(); }
public VideoTagViewModel(NicoNicoVideoTag tag, VideoViewModel vm) { Tag = tag; Owner = vm; }
public VideoFlashHandler(VideoViewModel vm) { Owner = vm; }
public CommentEntryViewModel(NicoNicoCommentEntry entry, VideoViewModel vm) { Entry = entry; Owner = vm; }
public VideoMylistViewModel(VideoViewModel vm) { Video = vm; Task.Run(() => Mylists = new ObservableCollection <NicoNicoMylistGroupData>(MylistViewModel.MylistGroupInstance.GetMylistGroup())); }
public VideoTagViewModel(NicoNicoTag tag, VideoViewModel vm) { Tag = tag; Owner = vm; }
public VideoMylistViewModel(VideoViewModel vm) { Owner = vm; MylistInstance = new NicoNicoMylist(vm); }
public VideoCommentViewModel(VideoViewModel vm) { Owner = vm; }
public static Status AddFavorite(VideoViewModel vm, string userId, string token) { vm.Status = "お気に入りに登録中"; var add = "http://www.nicovideo.jp/api/watchitem/add"; var formData = new Dictionary<string, string>(); formData["item_type"] = "1"; formData["item_id"] = userId; formData["token"] = token; try { var request = new HttpRequestMessage(HttpMethod.Post, add); request.Content = new FormUrlEncodedContent(formData); var a = NicoNicoWrapperMain.Session.GetAsync(request).Result; vm.VideoData.ApiData.UploaderIsFavorited = true; vm.Status = ""; return Status.Success; } catch(RequestTimeout) { vm.Status = "お気に入り登録に失敗しました。"; return Status.Failed; } }
public void Add(VideoViewModel vm) { VideoList.Add(vm); SelectedList = vm; }
public VideoMylistViewModel(VideoViewModel vm) { Video = vm; //Task.Run(() => Mylists = new ObservableCollection<NicoNicoMylistGroupData>(MylistViewModel.MylistGroupInstance.GetMylistGroup())); }
public PaidVideoViewModel(VideoViewModel vm) { Owner = vm; VideoUrl = vm.VideoUrl; }
//URLから適当なViewを開く public static TabItemViewModel Replace(TabItemViewModel old, string url) { if(Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { System.Diagnostics.Process.Start(url); return null; } if(url.StartsWith("http://www.nicovideo.jp/watch/")) { var vm = new VideoViewModel(url); App.ViewModelRoot.ReplaceTabAndSetCurrent(old, vm); return vm; } else if(url.StartsWith("http://www.nicovideo.jp/user/")) { var vm = new UserViewModel(url); App.ViewModelRoot.ReplaceTabAndSetCurrent(old, vm); return vm; } else if(url.StartsWith("http://www.nicovideo.jp/mylist/")) { var vm = new PublicMylistViewModel(url); App.ViewModelRoot.ReplaceTabAndSetCurrent(old, vm); return vm; } else if(url.StartsWith("http://com.nicovideo.jp/community/")) { var vm = new CommunityViewModel(url); App.ViewModelRoot.ReplaceTabAndSetCurrent(old, vm); return vm; } /*else if(url.StartsWith("http://live.nicovideo.jp/watch/")) { var vm = new LiveViewModel(url); App.ViewModelRoot.ReplaceTabAndSetCurrent(old, vm); return vm; }*/ else { System.Diagnostics.Process.Start(url); return null; } }
public NicoNicoWatchApi(string videoPage, VideoViewModel vm) { VideoPage = videoPage; Owner = vm; }
public ObjectForScriptingHelper(VideoViewModel video) { Video = video; }
public VideoCommentViewModel(VideoViewModel vm) { Owner = vm; CommentInstance = new NicoNicoComment(vm); Post = new VideoPostCommentViewModel(this); }
public static Status DeleteFavorite(VideoViewModel vm, string userId, string token) { vm.Status = "お気に入り解除中"; var del = "http://www.nicovideo.jp/api/watchitem/delete"; var formData = new Dictionary<string, string>(); formData["id_list[1][]"] = userId; formData["token"] = token; try { var request = new HttpRequestMessage(HttpMethod.Post, del); request.Content = new FormUrlEncodedContent(formData); var a = NicoNicoWrapperMain.Session.GetAsync(request).Result; vm.VideoData.ApiData.UploaderIsFavorited = false; vm.Status = ""; return Status.Success; } catch(RequestTimeout) { vm.Status = "お気に入り解除に失敗しました。"; return Status.Failed; } }
private void Initialize() { SelectedPlayList = PlayList.First(); Video = new VideoViewModel(SelectedPlayList.VideoUrl, this); }