Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Updata);
            NewVerison.VersionCode        = Intent.GetCharSequenceExtra("VersionCode");
            NewVerison.VersionName        = Intent.GetCharSequenceExtra("VersionName");
            NewVerison.VersionDiscription = Intent.GetCharSequenceExtra("VersionDiscription");
            #region 设置ToolBar
            SetToolBar();
            #endregion
            TextView VerisonName = FindViewById <TextView>(Resource.Id.VerisonName);
            VerisonName.Text = NewVerison.VersionName;

            TextView VerisonDiscription = FindViewById <TextView>(Resource.Id.VerisonDiscription);
            VerisonDiscription.MovementMethod = ScrollingMovementMethod.Instance;
            VerisonDiscription.Text           = "";
            try
            {
                JObject jObject = (JObject)JsonConvert.DeserializeObject(NewVerison.VersionDiscription);
                JArray  jArray  = (JArray)jObject["VerisonDiscription"];
                foreach (var item in jArray)
                {
                    VerisonDiscription.Text += item.ToString() + "\r\n";
                }
            }
            catch
            {
                VerisonDiscription.Text = "获取更新描述失败";
            }
            #region  载更新按钮
            Button DownloadButton = FindViewById <Button>(Resource.Id.DownloadButton);
            DownloadButton.Click += (o, e) =>
            {
                DownloadTask downloadTask = new DownloadTask(this);
                downloadTask.Execute("https://github.com/UMI64/UinfoWork/raw/master/UinfoWork.UinfoWork.apk");
            };
            #endregion
            #region  载更新按钮
            TextView WebUpData = FindViewById <TextView>(Resource.Id.WebUpData);
            WebUpData.Click += (o, e) =>
            {
                Uri    uri    = Uri.Parse("https://github.com/UMI64/UinfoWork/raw/master/UinfoWork.UinfoWork.apk");
                Intent intent = new Intent(Intent.ActionView, uri);
                StartActivity(intent);
            };
            #endregion
        }