public async void Initialize() { Mylist = new VideoMylistViewModel(this); Comment = new VideoCommentViewModel(this); Handler = new VideoFlashHandler(this); Time = new VideoTime(); VideoData = new VideoData(); await DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => { if (IsFullScreen) { FullScreenVideoFlash = new VideoFlash() { DataContext = this }; FullScreenController = new VideoController() { DataContext = this }; } else { VideoFlash = new VideoFlash() { DataContext = this }; Controller = new VideoController() { DataContext = this }; } })); var videoUrl = VideoUrl + "?watch_harmful=1"; IsActive = true; Status = "動画情報取得中"; //動画情報取得 await Task.Run(() => { WatchApi = new NicoNicoWatchApi(videoUrl, this); VideoData.ApiData = WatchApi.GetWatchApiData(); Handler.Initialize(VideoData); }); }
public VideoViewModel(string videoUrl, PlayListViewModel playList = null) : base(videoUrl.Substring(30)) { PlayList = playList; if(videoUrl.Contains("?")) { videoUrl = videoUrl.Split('?')[0]; Name = videoUrl.Substring(30); } VideoUrl = videoUrl; Cmsid = Name; Mylist = new VideoMylistViewModel(this); Comment = new VideoCommentViewModel(this); Handler = new VideoFlashHandler(this); Time = new VideoTime(); VideoData = new VideoData(); InitializeView(); }