private async void btnDownload_Click(object sender, EventArgs e) { try { if (!IsOnline()) { throw new Exception("Brak połączenia z internetem"); } ShowMessageAndStart("Pobieram bazę danych"); FindViewById <Button>(Resource.Id.btnDownload).Visibility = ViewStates.Gone; DictionaryXMLHelper dictionaryXMLHelper = new DictionaryXMLHelper(); xml_doc = await dictionaryXMLHelper.DownloadDictionary(db_remote_info.file_link); ShowMessageAndStart("Synchronizuję bazę danych"); FindViewById <Button>(Resource.Id.btnDeleteTables).Visibility = ViewStates.Gone; dictionaryDBHelper_import = new DictionaryDBHelper(); dictionaryDBHelper_import.BeforeSynchro(); foreach (XmlNode xml_category in xml_doc.SelectSingleNode("dictionary").SelectNodes("category")) { AddCategory(null, (XmlElement)xml_category); } dictionaryDBHelper_import.SetVersion(db_remote_info.version); dictionaryDBHelper_import.AfterSynchro(); ShowMessageAndStop(string.Format("Baza została zsynchronizowana")); FindViewById <Button>(Resource.Id.btnCheckVersion).Visibility = ViewStates.Gone; FindViewById <Button>(Resource.Id.btnDownload).Visibility = ViewStates.Gone; } catch (Exception ex) { FindViewById <Button>(Resource.Id.btnDownload).Visibility = ViewStates.Visible; ShowError(ex.Message); } }