예제 #1
0
 public RankedVideoInfoControlViewModel(
     Database.NicoVideo data,
     Interfaces.IMylist ownerPlaylist = null
     )
     : base(data, ownerPlaylist)
 {
 }
 public HistoryVideoInfoControlViewModel(
     string rawVideoId,
     Interfaces.IMylist ownerPlaylist = null
     )
     : base(rawVideoId, ownerPlaylist)
 {
 }
        public VideoInfoControlViewModel(Database.NicoVideo data, Interfaces.IMylist ownerPlaylist = null)

        {
            RawVideoId    = data?.RawVideoId ?? RawVideoId;
            Data          = data;
            OnwerPlaylist = ownerPlaylist;

            NgSettings                     = App.Current.Container.Resolve <NGSettings>();
            CreateMylistCommand            = App.Current.Container.Resolve <CreateMylistCommand>();
            CreateLocalMylistCommand       = App.Current.Container.Resolve <CreateLocalMylistCommand>();
            CreateSubscriptionGroupCommand = App.Current.Container.Resolve <CreateSubscriptionGroupCommand>();
            AddToHiddenUserCommand         = App.Current.Container.Resolve <AddToHiddenUserCommand>();
            AddCacheRequestCommand         = App.Current.Container.Resolve <Commands.Cache.AddCacheRequestCommand>();
            DeleteCacheRequestCommand      = App.Current.Container.Resolve <DeleteCacheRequestCommand>();
            Scheduler             = App.Current.Container.Resolve <IScheduler>();
            HohoemaPlaylist       = App.Current.Container.Resolve <HohoemaPlaylist>();
            ExternalAccessService = App.Current.Container.Resolve <ExternalAccessService>();
            PageManager           = App.Current.Container.Resolve <PageManager>();
            UserMylistManager     = App.Current.Container.Resolve <UserMylistManager>();
            LocalMylistManager    = App.Current.Container.Resolve <LocalMylistManager>();
            SubscriptionManager   = App.Current.Container.Resolve <SubscriptionManager>();
            VideoCacheManager     = App.Current.Container.Resolve <VideoCacheManager>();
            NicoVideoProvider     = App.Current.Container.Resolve <NicoVideoProvider>();

            _CompositeDisposable = new CompositeDisposable();

            VideoCacheManager.VideoCacheStateChanged += VideoCacheManager_VideoCacheStateChanged;

            if (Data != null)
            {
                SetupFromThumbnail(Data);
            }
        }
예제 #4
0
 public CacheVideoViewModel(
     Database.NicoVideo data,
     Interfaces.IMylist ownerPlaylist = null
     )
     : base(data, ownerPlaylist)
 {
 }
예제 #5
0
 public CacheVideoViewModel(
     string rawVideoId,
     Interfaces.IMylist ownerPlaylist = null
     )
     : base(rawVideoId, ownerPlaylist)
 {
 }
 public VideoInfoControlViewModel(
     string rawVideoId,
     Interfaces.IMylist ownerPlaylist = null
     )
     : this(data : null, ownerPlaylist : ownerPlaylist)
 {
     RawVideoId = rawVideoId;
 }
예제 #7
0
        private void ShowNewVideosToastNotification(Subscription subscription, SubscriptionSource source, IEnumerable <Database.NicoVideo> newItems)
        {
            var mylistMan = (App.Current as App).Container.Resolve <UserMylistManager>();

            // TODO: プレイリスト毎にまとめたほうがいい?

            foreach (var dest in subscription.Destinations)
            {
                Interfaces.IMylist list = null;
                if (dest.Target == SubscriptionDestinationTarget.LocalPlaylist)
                {
                    list = MylistHelper.FindMylistInCached(dest.PlaylistId, PlaylistOrigin.Local);
                }
                else if (dest.Target == SubscriptionDestinationTarget.LoginUserMylist)
                {
                    list = MylistHelper.FindMylistInCached(dest.PlaylistId, PlaylistOrigin.LoginUser);
                }

                IList <Database.NicoVideo> videoList;
                if (NewItemsPerPlayableList.TryGetValue(list, out var cacheVideoList))
                {
                    videoList = cacheVideoList.Item1;

                    if (!cacheVideoList.Item2.Contains(subscription))
                    {
                        cacheVideoList.Item2.Add(subscription);
                    }
                }
                else
                {
                    videoList = new List <Database.NicoVideo>();
                    NewItemsPerPlayableList.Add(list, new Tuple <IList <Database.NicoVideo>, IList <Subscription> >(videoList, new List <Subscription>()
                    {
                        subscription
                    }));
                }

                foreach (var video in newItems)
                {
                    videoList.Add(video);
                }
            }


            try
            {
                foreach (var pair in NewItemsPerPlayableList)
                {
                    var playableList    = pair.Key;
                    var newItemsPerList = pair.Value.Item1;
                    var subscriptions   = pair.Value.Item2;

                    ToastVisual visual = new ToastVisual()
                    {
                        BindingGeneric = new ToastBindingGeneric()
                        {
                            Children = { }
                        }
                    };

                    visual.BindingGeneric.Children.Insert(0, new AdaptiveText()
                    {
                        Text      = $"『{playableList.Label}』に新着動画を追加",
                        HintStyle = AdaptiveTextStyle.Base
                    });

                    foreach (var item in newItemsPerList)
                    {
                        visual.BindingGeneric.Children.Add(new AdaptiveText()
                        {
                            Text      = item.Title,
                            HintStyle = AdaptiveTextStyle.BaseSubtle
                        });
                    }



                    ToastActionsCustom action = new ToastActionsCustom()
                    {
                        Buttons =
                        {
                            new ToastButton("視聴する",  new LoginRedirectPayload()
                            {
                                RedirectPageType = HohoemaPageType.VideoPlayer,RedirectParamter                             = newItemsPerList.First().RawVideoId
                            }.ToParameterString())
                            {
                                ActivationType = ToastActivationType.Foreground,
                            },
                            new ToastButton("購読を管理", new LoginRedirectPayload()
                            {
                                RedirectPageType = HohoemaPageType.Subscription
                            }.ToParameterString())
                            {
                                ActivationType = ToastActivationType.Foreground,
                            },
                        }
                    };

                    ToastContent toastContent = new ToastContent()
                    {
                        Visual  = visual,
                        Actions = action,
                    };

                    var toast = new ToastNotification(toastContent.GetXml());

                    var notifier = ToastNotificationManager.CreateToastNotifier();

                    toast.Tag   = playableList.Id;
                    toast.Group = TOAST_GROUP;
                    notifier.Show(toast);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
        }
예제 #8
0
        public MylistGroupListItem(Interfaces.IMylist list)
        {
            GroupId = list.Id;

            Label = list.Label;
        }