private async void ListView_ItemClick(object sender, ItemClickEventArgs e) { var item = (e.ClickedItem as StackPanel).Tag.ToString(); if (item == "ToView") { if (!ApiHelper.IsLogin() && !await Utils.ShowLoginDialog()) { Utils.ShowMessageToast("请先登录"); return; } MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(ToViewPage)); } else if (item == "Test") { } else { MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(SettingPage)); } }
private async Task <bool> HasMessage() { try { if (!ApiHelper.IsLogin()) { return(false); } // http://message.bilibili.com/api/msg/query.room.list.do?access_key=a36a84cc8ef4ea2f92c416951c859a25&actionKey=appkey&appkey=c1b107428d337928&build=414000&page_size=100&platform=android&ts=1461404884000&sign=5e212e424761aa497a75b0fb7fbde775 string url = string.Format("http://message.bilibili.com/api/notify/query.notify.count.do?_device=wp&_ulv=10000&access_key={0}&actionKey=appkey&appkey={1}&build=5250000&platform=android&ts={2}", ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan); url += "&sign=" + ApiHelper.GetSign(url); string results = await WebClientClass.GetResults(new Uri(url)); MessageModel model = JsonConvert.DeserializeObject <MessageModel>(results); if (model.code == 0) { MessageModel list = JsonConvert.DeserializeObject <MessageModel>(model.data.ToString()); message = list; if (list.reply_me != 0 || list.chat_me != 0 || list.notify_me != 0 || list.praise_me != 0 || list.at_me != 0) { return(true); } else { return(false); } } else { return(false); } } catch (Exception) { return(false); //Utils.ShowMessageToast("读取通知失败", 3000); } }