Наследование: TabItemViewModel, IExternalizable
Пример #1
0
 //VideoViewから
 public void Remove(VideoViewModel vm)
 {
     if (VideoList.Contains(vm))
     {
         VideoList.Remove(vm);
     }
 }
Пример #2
0
        //指定したプレイリストエントリに飛ぶ
        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();
            }
        }
Пример #3
0
 public void AddVideoView(VideoViewModel vm)
 {
     //UserItemsにVideoViewが無かったら追加する
     if (!UserItems.Contains(VideoView))
     {
         AddUserTab(VideoView);
     }
     VideoView.Add(vm);
     SelectedTab = VideoView;
 }
Пример #4
0
        //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;
            }
        }
Пример #5
0
 //指定したプレイリストエントリに飛ぶ
 public void Jump(PlayListEntryViewModel entry)
 {
     Video?.DisposeViewModel();
     Video = new VideoViewModel(entry, IsFullScreen);
     UIInstance.DataContext = Video;
     Video.Initialize();
     if (IsFullScreen)
     {
         UpdateFullScreenViewModel();
     }
 }
Пример #6
0
        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());
            }
        }
Пример #7
0
        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);
            }
        }
Пример #8
0
 private void Initialize()
 {
     SelectedPlayList = PlayList.First();
     Video            = new VideoViewModel(this);
     Video.Initialize();
 }
Пример #9
0
 public VideoTagViewModel(NicoNicoVideoTag tag, VideoViewModel vm)
 {
     Tag   = tag;
     Owner = vm;
 }
Пример #10
0
 public VideoFlashHandler(VideoViewModel vm)
 {
     Owner = vm;
 }
Пример #11
0
 public CommentEntryViewModel(NicoNicoCommentEntry entry, VideoViewModel vm)
 {
     Entry = entry;
     Owner = vm;
 }
Пример #12
0
        public VideoMylistViewModel(VideoViewModel vm)
        {
            Video = vm;

            Task.Run(() => Mylists = new ObservableCollection <NicoNicoMylistGroupData>(MylistViewModel.MylistGroupInstance.GetMylistGroup()));
        }
Пример #13
0
        public VideoTagViewModel(NicoNicoTag tag, VideoViewModel vm) {

            Tag = tag;
            Owner = vm;
        }
Пример #14
0
 public VideoMylistViewModel(VideoViewModel vm)
 {
     Owner          = vm;
     MylistInstance = new NicoNicoMylist(vm);
 }
Пример #15
0
 public VideoCommentViewModel(VideoViewModel vm)
 {
     Owner = vm;
 }
Пример #16
0
        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;
            }
        }
Пример #17
0
 public void Add(VideoViewModel vm)
 {
     VideoList.Add(vm);
     SelectedList = vm;
 }
Пример #18
0
        public VideoMylistViewModel(VideoViewModel vm)
        {
            Video = vm;

            //Task.Run(() => Mylists = new ObservableCollection<NicoNicoMylistGroupData>(MylistViewModel.MylistGroupInstance.GetMylistGroup()));
        }
Пример #19
0
        public VideoFlashHandler(VideoViewModel vm) {

            Owner = vm;
        }
Пример #20
0
 public PaidVideoViewModel(VideoViewModel vm)
 {
     Owner    = vm;
     VideoUrl = vm.VideoUrl;
 }
Пример #21
0
        public VideoCommentViewModel(VideoViewModel vm) {

            Owner = vm;
		}
Пример #22
0
        //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;
            }
        }
Пример #23
0
        public NicoNicoWatchApi(string videoPage, VideoViewModel vm) {

            VideoPage = videoPage;
            Owner = vm;
        }
 public ObjectForScriptingHelper(VideoViewModel video)
 {
     Video = video;
 }
Пример #25
0
 public VideoCommentViewModel(VideoViewModel vm)
 {
     Owner           = vm;
     CommentInstance = new NicoNicoComment(vm);
     Post            = new VideoPostCommentViewModel(this);
 }
Пример #26
0
        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;
            }
        }
Пример #27
0
 private void Initialize()
 {
     SelectedPlayList = PlayList.First();
     Video = new VideoViewModel(SelectedPlayList.VideoUrl, this);
 }