public void Bookmark() { //if (_controlInterface.Frequency == 0) return; if (!_controlInterface.IsPlaying) return; var memoryEntry = new MemoryEntry(); memoryEntry.DetectorType = _controlInterface.DetectorType; memoryEntry.Frequency = _controlInterface.Frequency; memoryEntry.FilterBandwidth = _controlInterface.FilterBandwidth; memoryEntry.Shift = _controlInterface.FrequencyShiftEnabled ? _controlInterface.FrequencyShift : 0; memoryEntry.GroupName = "Misc"; if (_controlInterface.DetectorType == DetectorType.WFM) { var stationName = _controlInterface.RdsProgramService.Trim(); memoryEntry.Name = string.Empty; if (!string.IsNullOrEmpty(stationName)) { memoryEntry.Name = stationName; } else { memoryEntry.Name = GetFrequencyDisplay(_controlInterface.Frequency) + " " + memoryEntry.DetectorType; } } else { memoryEntry.Name = GetFrequencyDisplay(_controlInterface.Frequency) + " " + memoryEntry.DetectorType; } memoryEntry.IsFavourite = true; DoEdit(memoryEntry, true); }
private void DoEdit(MemoryEntry memoryEntry, bool isNew) { var dialog = new DialogEntryInfo(memoryEntry, _groups); if (dialog.ShowDialog() == DialogResult.OK) { if (isNew) { _entries.Add(memoryEntry); _entries.Sort((e1, e2) => e1.Frequency.CompareTo(e2.Frequency)); } _settingsPersister.PersistStoredFrequencies(_entries); if (!_groups.Contains(memoryEntry.GroupName)) { _groups.Add(memoryEntry.GroupName); ProcessGroups(memoryEntry.GroupName); } else { if ((string)comboGroups.SelectedItem == AllGroups || (string)comboGroups.SelectedItem == memoryEntry.GroupName || ((string)comboGroups.SelectedItem == FavouriteGroup && memoryEntry.IsFavourite)) { if (isNew) _displayedEntries.Add(memoryEntry); } else comboGroups.SelectedItem = memoryEntry.GroupName; } } }
private void DoEdit(MemoryEntry memoryEntry, bool isNew) { var dialog = new DialogEntryInfo(memoryEntry, _groups); if (dialog.ShowDialog() == DialogResult.OK) { if (isNew) { _entries.Add(memoryEntry); _entries.Sort((e1, e2) => e1.Frequency.CompareTo(e2.Frequency)); } _settingsPersister.PersistStoredFrequencies(_entries); if (!_groups.Contains(memoryEntry.GroupName)) { _groups.Add(memoryEntry.GroupName); ProcessGroups(memoryEntry.GroupName); } else { if ((string)comboGroups.SelectedItem == AllGroups || (string)comboGroups.SelectedItem == memoryEntry.GroupName || ((string)comboGroups.SelectedItem == FavouriteGroup && memoryEntry.IsFavourite)) { if (isNew) { _displayedEntries.Add(memoryEntry); } } else { comboGroups.SelectedItem = memoryEntry.GroupName; } } } }
public MemoryEntry(MemoryEntry memoryEntry) { this._name = memoryEntry._name; this._groupName = memoryEntry._groupName; this._detectorType = memoryEntry._detectorType; this._frequency = memoryEntry._frequency; this._shift = memoryEntry._shift; this._centerFrequency = memoryEntry._centerFrequency; this._filterBandwidth = memoryEntry._filterBandwidth; this._isFavourite = memoryEntry._isFavourite; }
private void btnDelete_Click(object sender, EventArgs e) { MemoryEntry memoryEntry = (MemoryEntry)this.memoryEntryBindingSource.Current; if (memoryEntry != null && MessageBox.Show("Are you sure that you want to delete '" + memoryEntry.Name + "'?", "Delete Entry", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this._entries.Remove(memoryEntry); this._settingsPersister.PersistStoredFrequencies(this._entries); this._displayedEntries.Remove(memoryEntry); } }
public MemoryEntry(MemoryEntry memoryEntry) { this._name = memoryEntry._name; this._groupName = memoryEntry._groupName; this._detectorType = memoryEntry._detectorType; this._frequency = memoryEntry._frequency; this._shift = memoryEntry._shift; this._centerFrequency = memoryEntry._centerFrequency; this._filterBandwidth = memoryEntry._filterBandwidth; this._isFavourite = memoryEntry._isFavourite; }
public DialogEntryInfo(MemoryEntry memoryEntry, List<string> groups) { _memoryEntry = memoryEntry; InitializeComponent(); textBoxName.Text = memoryEntry.Name; comboGroupName.Text = memoryEntry.GroupName; frequencyNumericUpDown.Value = memoryEntry.Frequency; shiftNumericUpDown.Value = memoryEntry.Shift; lblMode.Text = memoryEntry.DetectorType.ToString(); comboGroupName.Items.AddRange(groups.ToArray()); nudFilterBandwidth.Value = memoryEntry.FilterBandwidth; favouriteCb.Checked = memoryEntry.IsFavourite; ValidateForm(); }
public DialogEntryInfo(MemoryEntry memoryEntry, List<string> groups) { this._memoryEntry = memoryEntry; this.InitializeComponent(); this.textBoxName.Text = memoryEntry.Name; this.comboGroupName.Text = memoryEntry.GroupName; this.frequencyNumericUpDown.Value = (Decimal) memoryEntry.Frequency; this.shiftNumericUpDown.Value = (Decimal) memoryEntry.Shift; this.lblMode.Text = memoryEntry.DetectorType.ToString(); this.comboGroupName.Items.AddRange((object[]) groups.ToArray()); this.nudFilterBandwidth.Value = (Decimal) memoryEntry.FilterBandwidth; this.favouriteCb.Checked = memoryEntry.IsFavourite; this.ValidateForm(); }
public DialogEntryInfo(MemoryEntry memoryEntry, List <string> groups) { _memoryEntry = memoryEntry; InitializeComponent(); textBoxName.Text = memoryEntry.Name; comboGroupName.Text = memoryEntry.GroupName; frequencyNumericUpDown.Value = memoryEntry.Frequency; shiftNumericUpDown.Value = memoryEntry.Shift; lblMode.Text = memoryEntry.DetectorType.ToString(); comboGroupName.Items.AddRange(groups.ToArray()); nudFilterBandwidth.Value = memoryEntry.FilterBandwidth; favouriteCb.Checked = memoryEntry.IsFavourite; ValidateForm(); }
public void Navigate() { if (this._controlInterface.IsPlaying) { int num = (this.frequencyDataGridView.SelectedCells.Count > 0) ? this.frequencyDataGridView.SelectedCells[0].RowIndex : (-1); if (num != -1) { try { MemoryEntry memoryEntry = (MemoryEntry)this.memoryEntryBindingSource.List[num]; this._controlInterface.FrequencyShift = memoryEntry.Shift; this._controlInterface.FrequencyShiftEnabled = (memoryEntry.Shift != 0); if (Math.Abs(memoryEntry.Frequency - memoryEntry.CenterFrequency - this._controlInterface.FrequencyShift) < this._controlInterface.RFBandwidth / 2) { this._controlInterface.CenterFrequency = memoryEntry.CenterFrequency; this._controlInterface.Frequency = memoryEntry.Frequency; } else { long num2 = memoryEntry.Frequency - memoryEntry.Shift + this._controlInterface.FilterBandwidth / 2 + 5000; if (Math.Abs(memoryEntry.Frequency - num2 - memoryEntry.Shift) < this._controlInterface.RFBandwidth / 2) { this._controlInterface.CenterFrequency = num2; this._controlInterface.Frequency = memoryEntry.Frequency; } else { this._controlInterface.CenterFrequency = memoryEntry.Frequency - this._controlInterface.FrequencyShift; this._controlInterface.Frequency = memoryEntry.Frequency; } } this._controlInterface.DetectorType = memoryEntry.DetectorType; this._controlInterface.FilterBandwidth = (int)memoryEntry.FilterBandwidth; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } }
public void Bookmark() { //if (_controlInterface.Frequency == 0) return; if (!_controlInterface.IsPlaying) { return; } var memoryEntry = new MemoryEntry(); memoryEntry.DetectorType = _controlInterface.DetectorType; memoryEntry.Frequency = _controlInterface.Frequency; memoryEntry.FilterBandwidth = _controlInterface.FilterBandwidth; memoryEntry.Shift = _controlInterface.FrequencyShiftEnabled ? _controlInterface.FrequencyShift : 0; memoryEntry.GroupName = comboGroups.SelectedItem.ToString(); if (_controlInterface.DetectorType == DetectorType.WFM) { var stationName = _controlInterface.RdsProgramService.Trim(); memoryEntry.Name = string.Empty; if (!string.IsNullOrEmpty(stationName)) { memoryEntry.Name = stationName; } else { memoryEntry.Name = GetFrequencyDisplay(_controlInterface.Frequency) + " " + memoryEntry.DetectorType; } } else { memoryEntry.Name = GetFrequencyDisplay(_controlInterface.Frequency) + " " + memoryEntry.DetectorType; } memoryEntry.IsFavourite = false; DoEdit(memoryEntry, true); }
public MemoryInfoEventArgs(MemoryEntry entry) { _memoryEntry = entry; }
public MemoryInfoEventArgs(MemoryEntry entry) { _memoryEntry = entry; }
public void Bookmark() { if (!this._controlInterface.IsPlaying) return; MemoryEntry memoryEntry = new MemoryEntry(); memoryEntry.DetectorType = this._controlInterface.DetectorType; memoryEntry.Frequency = this._controlInterface.Frequency; memoryEntry.FilterBandwidth = (long) this._controlInterface.FilterBandwidth; memoryEntry.Shift = this._controlInterface.FrequencyShiftEnabled ? this._controlInterface.FrequencyShift : 0L; memoryEntry.GroupName = "Misc"; if (this._controlInterface.DetectorType == DetectorType.WFM) { string str = this._controlInterface.RdsProgramService.Trim(); memoryEntry.Name = string.Empty; memoryEntry.Name = string.IsNullOrEmpty(str) ? FrequencyManagerPanel.GetFrequencyDisplay(this._controlInterface.Frequency) + (object) " " + (string) (object) memoryEntry.DetectorType : str; } else memoryEntry.Name = FrequencyManagerPanel.GetFrequencyDisplay(this._controlInterface.Frequency) + (object) " " + (string) (object) memoryEntry.DetectorType; memoryEntry.IsFavourite = true; this.DoEdit(memoryEntry, true); }
private void DoEdit(MemoryEntry memoryEntry, bool isNew) { if (new DialogEntryInfo(memoryEntry, this._groups).ShowDialog() != DialogResult.OK) return; if (isNew) { this._entries.Add(memoryEntry); this._entries.Sort((Comparison<MemoryEntry>) ((e1, e2) => e1.Frequency.CompareTo(e2.Frequency))); } this._settingsPersister.PersistStoredFrequencies(this._entries); if (!this._groups.Contains(memoryEntry.GroupName)) { this._groups.Add(memoryEntry.GroupName); this.ProcessGroups(memoryEntry.GroupName); } else if ((string) this.comboGroups.SelectedItem == "[All Groups]" || (string) this.comboGroups.SelectedItem == memoryEntry.GroupName || (string) this.comboGroups.SelectedItem == "[Favourites]" && memoryEntry.IsFavourite) { if (isNew) this._displayedEntries.Add(memoryEntry); } else this.comboGroups.SelectedItem = (object) memoryEntry.GroupName; this.UpdateVisibleFrequencies(); }