private void OnChangeTagEventArgument(TagEventArgument e) { var albumView = this.Container.GetInstance<AlbumView>(); string regionName = this.ContainerView.GetFlyout(e.Title); if (albumView != null) { albumView.ViewModel.DoInit(new CategoryTagAlbumParam { Category = e.Category, TagName = e.TagName, Condition = ConditionAlbumType.hot, Device = DeviceType.pc, Page = 1, PerPage = 20, Status = 0 }, regionName, albumView); } }
/// <summary> /// 构造 /// </summary> public AlbumListViewModel() { if (this.EventAggregator == null) { throw new ArgumentNullException("EventAggregator"); } //标签点击事件,获取专辑数据 this.EventAggregator.GetEvent<AlbumListEvent<TagEventArgument>>().Subscribe(e => { this.TagEventArgument = e; }); }
/// <summary> /// 初始化 /// </summary> public override void Initialize() { if (this.EventAggregator == null) { throw new ArgumentNullException("EventAggregator"); } //标签点击事件,获取专辑数据 this.EventAggregator.GetEvent<AlbumListEvent<TagEventArgument>>().Subscribe(e => { this.TagEventArgument = e; }); //标签点击事件,获取专辑详情数据 this.EventAggregator.GetEvent<AlbumDetailEvent<long>>().Subscribe(e => { this.OnAlbumDetailEvent(e); }); }
/// <summary> /// 分类事件函数 /// </summary> /// <param name="e"></param> private void OnTagEventPublish(TagEventArgument e) { if (DiscoverViewModel.CategoryList == null) { throw new ArgumentException("分类集合为空!"); } this.CurrentCategory = DiscoverViewModel.CategoryList.FirstOrDefault(c => c.Name == e.TagKey); if (this.CurrentCategory == null || this.CurrentCategory.Name != e.TagKey) { throw new ArgumentException(string.Format("找不到分类:分类key为{0}", e.TagKey)); } var regionName = this.ContainerView.GetFlyout(this.CurrentCategory.Title); if (this.RegionManager != null) { this.RegionManager.AddToRegion(regionName, this.CategoryDetailView); } if (this.CategoryTagService != null) { this.IsWaiting = true; this.CategoryTagService.GetData(result => { Application.Current.Dispatcher.BeginInvoke(new Action(() => { CategoryTagResult tagResult = result as CategoryTagResult; this.IsWaiting = false; if (tagResult != null && tagResult.Ret == 0) { this.TagDataList.Clear(); this.TagDataList.Add(new TagData { CategoryId = 0, CoverPath = "pack://application:,,,/XIMALAYA.PCDesktop.Tools;component/Resources/Images/tagall.jpg", TagName = "全部" }); foreach (var tag in tagResult.List) { this.TagDataList.Add(tag); } } })); }, new CategoryTagParam { Category = this.CurrentCategory.Name, Type = TagType.album }); } }