Beispiel #1
0
        /// <summary>
        /// 获取专辑图像 URL 路径
        /// </summary>
        /// <param name="sid">歌曲 SID</param>
        /// <returns></returns>
        private string GetAblumImageUrl(int sid)
        {
            string _requestUrl = $"http://music.163.com/api/song/detail/";
            var    _result     = m_netUtils.GetAsync <NetEaseSongDetailResultModel>(_requestUrl, new
            {
                id  = sid,
                ids = $"%5B{sid}%5D"
            }).Result;

            return(_result?.songs?[0]?.album?.picUrl);
        }
        public async void HandleEvent(CheckUpdateEventData eventData)
        {
            try
            {
                using (var client = new HttpMethodUtils())
                {
                    var result = await client.GetAsync <UpdateModel>(@"http://api.myzony.com/api/VersionCheck/CheckVersion");

                    if (result == null)
                    {
                        return;
                    }
                    var newVersion     = new Version(result.Version);
                    var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

                    string BuildMessageText()
                    {
                        StringBuilder builder = new StringBuilder();

                        builder.Append("发现新版本,是否更新?").Append("\r\n");
                        builder.Append("更新信息:").Append("\r\n");
                        builder.Append(result.UpdateDescription.Replace("|", "\r\n"));
                        return(builder.ToString());
                    }

                    if (newVersion > currentVersion)
                    {
                        if (MessageBox.Show(caption: "更新提示", text: BuildMessageText(), icon: MessageBoxIcon.Information, buttons: MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            Process.Start(result.Url);
                        }
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }
        }