private void FilePathSetting_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (IsCombBoxSelectionChanged) { ComboBox selectItem = (ComboBox)sender; if ((ServerModel)selectItem.SelectedItem == null) { return; } using (SqliteWrapper sqliteWrapper = new SqliteWrapper(true)) { try { ServerModel nowTarget = sqliteWrapper.ExecuteSelect <ServerModel>().FirstOrDefault(a => a.target == 1); nowTarget.target = 0; sqliteWrapper.ExecuteUpdata(nowTarget); ServerModel selectTarget = sqliteWrapper.ExecuteSelectOne <ServerModel>(((ServerModel)selectItem.SelectedItem).id); selectTarget.target = 1; sqliteWrapper.ExecuteUpdata(selectTarget); sqliteWrapper.Commit(); } catch { sqliteWrapper.RollBack();; } } } IsCombBoxSelectionChanged = true; }