private void InitAGCModes() { for (AGCMode agc = AGCMode.FIRST + 1; agc < AGCMode.LAST; agc++) { string s = agc.ToString().ToLower(); s = s.Substring(0, 1).ToUpper() + s.Substring(1, s.Length - 1); comboAGC.Items.Add(s); } }
public Memory(Console c) { InitializeComponent(); console = c; // Setup arrays modes = new ArrayList(); for (DSPMode m = DSPMode.FIRST + 1; m < DSPMode.LAST; m++) { modes.Add(new DataBind((int)m, m.ToString())); } // modes.Add(new DataBind(0, "LSB")); // modes.Add(new DataBind(1, "USB")); // modes.Add(new DataBind(2, "DSB")); // modes.Add(new DataBind(3, "CWL")); // modes.Add(new DataBind(4, "CWU")); // modes.Add(new DataBind(5, "FMN")); // modes.Add(new DataBind(6, "AM")); // modes.Add(new DataBind(7, "SAM")); // modes.Add(new DataBind(8, "SPEC")); // modes.Add(new DataBind(9, "DRM")); filters = new ArrayList(); filters.Add(new DataBind(0, "Filter1")); filters.Add(new DataBind(1, "Filter2")); filters.Add(new DataBind(2, "Filter3")); filters.Add(new DataBind(3, "Filter4")); filters.Add(new DataBind(4, "Filter5")); filters.Add(new DataBind(5, "Filter6")); filters.Add(new DataBind(6, "Filter7")); filters.Add(new DataBind(7, "Filter8")); filters.Add(new DataBind(8, "Filter9")); filters.Add(new DataBind(9, "Filter10")); filters.Add(new DataBind(10, "Var1")); filters.Add(new DataBind(11, "Var2")); filters.Add(new DataBind(12, "None")); agc_modes = new ArrayList(); for (AGCMode agc = AGCMode.FIRST + 1; agc < AGCMode.LAST; agc++) { string s = agc.ToString().ToLower(); s = s.Substring(0, 1).ToUpper() + s.Substring(1, s.Length - 1); agc_modes.Add(new DataBind((int)agc, s)); } step_sizes = new ArrayList(); step_sizes.Add(new DataBind(0, "1Hz")); step_sizes.Add(new DataBind(1, "10Hz")); step_sizes.Add(new DataBind(2, "50Hz")); step_sizes.Add(new DataBind(3, "100Hz")); step_sizes.Add(new DataBind(4, "250Hz")); step_sizes.Add(new DataBind(5, "500Hz")); step_sizes.Add(new DataBind(6, "1kHz")); step_sizes.Add(new DataBind(7, "5kHz")); step_sizes.Add(new DataBind(8, "10kHz")); step_sizes.Add(new DataBind(9, "100kHz")); step_sizes.Add(new DataBind(10, "1MHz")); step_sizes.Add(new DataBind(11, "10MHz")); // Init DataGrid components InitDataGrid(); // Use database memory table ds = DB.dsMemory; dataGrid1.DataSource = ds.Tables["Memory"]; ds.Tables["Memory"].Columns["GroupID"].DefaultValue = 0; ds.Tables["Memory"].Columns["Frequency"].DefaultValue = 7.0; ds.Tables["Memory"].Columns["ModeID"].DefaultValue = 0; ds.Tables["Memory"].Columns["FilterID"].DefaultValue = 0; ds.Tables["Memory"].Columns["Callsign"].DefaultValue = " "; ds.Tables["Memory"].Columns["Comments"].DefaultValue = " "; //ds.Tables["Memory"].Columns["Scan"].DefaultValue = 1; ds.Tables["Memory"].Columns["Squelch"].DefaultValue = 0; ds.Tables["Memory"].Columns["StepSizeID"].DefaultValue = 0; ds.Tables["Memory"].Columns["AGCID"].DefaultValue = 2; ds.Tables["Memory"].Columns["Gain"].DefaultValue = 0; ds.Tables["Memory"].Columns["FilterLow"].DefaultValue = 0; ds.Tables["Memory"].Columns["FilterHigh"].DefaultValue = 0; ds.Tables["Memory"].Columns["CreateDate"].DefaultValue = DateTime.Now; // Bind combobox datasources columnGroupID.ComboBox.DataSource = ds.Tables["GroupList"]; columnGroupID.ComboBox.DisplayMember = "GroupName"; columnGroupID.ComboBox.ValueMember = "GroupID"; columnMode.ComboBox.DataSource = modes; columnMode.ComboBox.DisplayMember = "Text"; columnMode.ComboBox.ValueMember = "Index"; columnFilter.ComboBox.DataSource = filters; columnFilter.ComboBox.DisplayMember = "Text"; columnFilter.ComboBox.ValueMember = "Index"; columnAGC.ComboBox.DataSource = agc_modes; columnAGC.ComboBox.DisplayMember = "Text"; columnAGC.ComboBox.ValueMember = "Index"; columnStepSize.ComboBox.DataSource = step_sizes; columnStepSize.ComboBox.DisplayMember = "Text"; columnStepSize.ComboBox.ValueMember = "Index"; chkEdit_CheckedChanged(this, EventArgs.Empty); ds.Tables["Memory"].DefaultView.Sort = "Frequency"; dataGrid1.CurrentRowIndex = 0; ds.Tables["Memory"].DefaultView.AllowNew = false; }