/// <summary> /// 新增 /// </summary> /// <param name="item"></param> public void AddRadio(FMRadioItem item) { try { this.Items.Add(item); _DB.Rows.InsertOnSubmit(item); _DB.SubmitChanges(); } catch (Exception ex) { Debug.WriteLine("AddRadio"+ex.Message); } }
/// <summary> /// 删除 /// </summary> /// <param name="item"></param> public void DeleteRadio(FMRadioItem item) { try { if (_DB.DatabaseExists()) { _DB.Rows.DeleteOnSubmit(item); _DB.SubmitChanges(); this.Items.Remove(item); } } catch (Exception ex) { Debug.WriteLine("DeleteRadio" + ex.Message); } }
private void btnAddRadio_Click(object sender, RoutedEventArgs e) { if (flag) { FMRadioItem radioitem = new FMRadioItem(); radioitem.Id = Guid.NewGuid(); radioitem.Frequency = frequency; FMRadioModel model = new FMRadioModel(); model.AddRadio(radioitem); } }