public RepostDialog(DynamicCardsModel dynamicCardsModel) { this.InitializeComponent(); if (Window.Current.CoreWindow.Bounds.Width >= 500) { st.Width = 440; } else { st.Width = Window.Current.CoreWindow.Bounds.Width - 24; } emote = new Emote(EmoteMode.dynamic); _dynamicCardsModel = dynamicCardsModel; isRepost = true; repostData.Visibility = Visibility.Visible; btn_Image.Visibility = Visibility.Collapsed; xtitle.Text = "转发动态"; LoadRepostData(); pics.Visibility = Visibility.Collapsed; LoadAtList(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); //if (e.NavigationMode== NavigationMode.New) //{ if ((e.Parameter as object[])[0] is DynamicCardsModel) { _data = (e.Parameter as object[])[0] as DynamicCardsModel; ObservableCollection <DynamicCardsModel> ls = new ObservableCollection <DynamicCardsModel>(); ls.Add(_data); dynamic.HideLoadMoreButton(); dynamic.LoadData(ls, true); ls_repost.ItemsSource = null; if (_data.desc.user_profile != null) { if (_data.desc.user_profile.info.uid.ToString() == ApiHelper.GetUserId()) { btn_Delete.Visibility = Visibility.Visible; } else { btn_Delete.Visibility = Visibility.Collapsed; } } LoadRepost(); comment.ClearComment(); InitializeComment(); } else { var hid = (e.Parameter as object[])[0].ToString(); LoadAlbumData(hid); } //} }
private async void LoadDynamicData(string dynamic_id) { try { string url = string.Format("https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail?access_key={0}&appkey={1}&dynamic_id={2}&build=5250000&mobi_app=android&platform=android&src=bilih5&ts={3}", ApiHelper.AccessKey, ApiHelper.AndroidKey.Appkey, dynamic_id, ApiHelper.TimeStamp); url += "&sign=" + ApiHelper.GetSign(url); string re = await WebClientClass.GetResultsUTF8Encode(new Uri(url)); JObject obj = JObject.Parse(re); if (obj["code"].ToInt32() == 0) { DynamicCardsModel dynamicCardsModel = Newtonsoft.Json.JsonConvert.DeserializeObject <DynamicCardsModel>(obj["data"]["card"].ToString()); _data = dynamicCardsModel; //_data = new DynamicCardsModel() //{ // feed1 = dynamicFeed1Model, // desc = new DynamicCardsModel() // { // timestamp = dynamicFeed1Model.item.upload_timestamp, // type = 2, // uid = dynamicFeed1Model.user.uid, // dynamic_id = Convert.ToInt64(dynamic_id), // user_profile = new user_profileModel() // { // info = new user_profileModel() // { // uid = dynamicFeed1Model.user.uid, // face = dynamicFeed1Model.user.head_url, // uname = dynamicFeed1Model.user.name // } // }, // rid = dynamicFeed1Model.item.doc_id, // like = dynamicFeed1Model.item.vote_count, // }, // reply = dynamicFeed1Model.item.comment_count, // card = obj["data"].ToString() //}; ObservableCollection <DynamicCardsModel> ls = new ObservableCollection <DynamicCardsModel>(); ls.Add(_data); dynamic.LoadData(ls, true); ls_repost.ItemsSource = null; if (_data.desc.user_profile != null) { if (_data.desc.user_profile.info.uid.ToString() == ApiHelper.GetUserId()) { btn_Delete.Visibility = Visibility.Visible; } else { btn_Delete.Visibility = Visibility.Collapsed; } } LoadRepost(); comment.ClearComment(); InitializeComment(); } else { obj["message"].ToString(); } } catch (Exception) { Utils.ShowMessageToast("无法读取动态"); } }