public CurveLibraryRecordEditDialog(CurveLibraryRecord clr) { InitializeComponent(); Icon = common.Resources.VixenPlus; LibraryRecord = clr; _curveLibrary = new CurveLibrary(); textBoxManufacturer.AutoCompleteCustomSource.AddRange(_curveLibrary.GetAllManufacturers()); textBoxController.AutoCompleteCustomSource.AddRange(_curveLibrary.GetAllControllers()); if (LibraryRecord == null) { return; } textBoxManufacturer.Text = LibraryRecord.Manufacturer; textBoxLightCount.Text = LibraryRecord.LightCount; buttonColor.BackColor = Color.FromArgb(LibraryRecord.Color); textBoxController.Text = LibraryRecord.Controller; }
private void LoadRecords() { if (_isInternal) { return; } Cursor = Cursors.WaitCursor; try { SetFilters(); listViewRecords.BeginUpdate(); listViewRecords.Items.Clear(); btnOkay.Enabled = false; try { foreach (var record in _curveLibrary.Read()) { listViewRecords.Items.Add( new ListViewItem(new[] { record.Manufacturer, record.LightCount, record.Color.ToString(CultureInfo.InvariantCulture), record.Controller })).Tag = record; } } catch (Exception exception) { MessageBox.Show(exception.Message, Vendor.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { listViewRecords.EndUpdate(); } if (_curveLibrary.IsFiltered) { return; } PopulateFilter(comboBoxManufacturer, _curveLibrary.GetAllManufacturers()); PopulateFilter(comboBoxCount, _curveLibrary.GetAllLightCounts()); PopulateFilter(comboBoxColor, _curveLibrary.GetAllLightColors()); PopulateFilter(comboBoxController, _curveLibrary.GetAllControllers()); } finally { Cursor = Cursors.Default; } }