/// <summary> /// Shows the dialog to the user. /// </summary> public Dialog Show(bool showVersion = false) { var view = LayoutInflater.From(context).Inflate(Resource.Layout.dialog_whats_new, null, false); var content = view.FindViewById <TextView>(Resource.Id.content); var checkbox = view.FindViewById <CheckBox>(Resource.Id.checkbox); checkbox.CheckedChange += (sender, e) => { prefs.showWhatsNew = e.IsChecked; }; var adb = new IONAlertDialog(context); adb.SetTitle(string.Format(context.GetString(Resource.String.whats_new_in), currentVersion)); adb.SetView(view); adb.SetNegativeButton(Resource.String.ok_done, (obj, e) => { var dialog = obj as Dialog; dialog.Dismiss(); }); var ret = adb.Show(); Task.Factory.StartNew(() => { var sb = new StringBuilder(); var news = new List <WhatsNew>(); news.AddRange(WhatsNew.ParseWithException(context.Resources.GetXml(Resource.Xml.whats_new))); news.AddRange(WhatsNew.ParseWithException(context.Resources.GetXml(Resource.Xml.whats_new_history))); // Trim the unnecessary versions. for (int i = news.Count - 1; i >= 0; i--) { if (news[i].versionCode.CompareTo(oldVersion) < 0 || news[i].versionCode.CompareTo(currentVersion) > 0) { news.RemoveAt(i); } } if (showVersion) { PrintIndividualUpdates(news, sb); } else { PrintCollapsedUpdates(news, sb); } handler.Post(() => { Appion.Commons.Util.Log.D(this, "Posting: " + sb.ToString()); content.TextFormatted = Html.FromHtml(sb.ToString()); }); }); return(ret); }