private void savedata() { SQLiteConnection dbconn = new SQLiteConnection(App.settingpath); dbconn.CreateTable <settingsdata>(); settingsdata settinginfo = new settingsdata() { height = toheightunit(Heightset.Detail), weight = toweightunit(Weightset.Detail), bp = tobpunit(Bpset.Detail), _temp = totempunit(Tpset.Detail), alerttime = timeofalert.Time, walert = weatheroption.On, oalert = otheroption.On, language = tolang(Lang.Detail) }; try { dbconn.DeleteAll <settingsdata>(); } catch (Exception) { } dbconn.Insert(settinginfo); dbconn.Dispose(); }
private void setcontent() { SQLiteConnection dbconn = new SQLiteConnection(App.settingpath); try { settingsdata settinginfo = dbconn.Table <settingsdata>().ToList().First(); lang = settinginfo.language; Weightset.Detail = fromweightunit(settinginfo.weight); Heightset.Detail = fromheightunit(settinginfo.height); Bpset.Detail = frombpunit(settinginfo.bp); Tpset.Detail = fromtempunit(settinginfo._temp); timeofalert.Time = settinginfo.alerttime; weatheroption.On = settinginfo.walert; otheroption.On = settinginfo.oalert; Lang.Detail = fromlang(settinginfo.language); var k = (int)lang; measurementsection.Title = new string[] { "Unit of measurement", "量度單位", "量度單位" }[k]; Weightset.Text = new string[] { "Weight", "體重", "体重" }[k]; Heightset.Text = new string[] { "Height", "身高", "身高" }[k]; Bpset.Text = new string[] { "Blood pressure", "血壓", "血压" }[k]; Tpset.Text = new string[] { "Temperature", "溫度", "温度" }[k]; Lang.Text = new string[] { "Language", "語言", "语言" }[k]; notifsection.Title = new string[] { "Notification", "通知", "通知" }[k]; weatheroption.Text = new string[] { "Weather alerts", "顯示天氣", "显示天气" }[k]; otheroption.Text = new string[] { "Other alerts", "顯示其他通知", "显示其他通知" }[k]; toatitle.Text = new string[] { "Time of alert", "通知時間", "通知时间" }[k]; toadetail.Text = new string[] { "When do you want to receive alerts about your health?", "接收天氣通知的時間", "接收天气通知的时间" }[k]; Title = new string[] { "Preferences", "設定", "设定" }[k]; btnext.Text = new string[] { "Next", "下一步", "下一步" }[k]; } catch (Exception) { } base.OnAppearing(); }