private void SearchPhraseClear_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { foreach (int index in IDInput.CheckedIndices) { IDInput.SetItemChecked(index, false); } }
private void ArchiveLocationInput_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ArchiveLocationInput.Text) && Directory.Exists(ArchiveLocationInput.Text)) { // Specified directory is a valid one. try { this.Cursor = Cursors.WaitCursor; string[] matches = Directory.GetFiles(ArchiveLocationInput.Text, "*_archive.d"); if (matches.Length > 0) { // Open the active archive m_archiveReader.Open(matches[0]); MetadataRecord definition; List <string> previousSelection = new List <string>(ConfigurationFile.Current.Settings.General["Selection", true].ValueAs("").Split(',')); IDInput.Items.Clear(); for (int i = 1; i <= m_archiveReader.MetadataFile.RecordsOnDisk; i++) { definition = m_archiveReader.MetadataFile.Read(i); if (definition.GeneralFlags.Enabled) { IDInput.Items.Add(new Metadata(definition)); if (previousSelection.Contains(definition.HistorianID.ToString())) { IDInput.SetItemChecked(IDInput.Items.Count - 1, true); } Application.DoEvents(); } } } } catch (Exception ex) { ShowUpdateMessage("Error initializing application - {0}", ex.Message); } finally { this.Cursor = Cursors.Default; } } }
private void SearchPhraseFind_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { // Search for points matching the search criteria. int pointID; Metadata definition; string searchPhrase = SearchPhraseInput.Text.ToLower(); int.TryParse(searchPhrase, out pointID); this.Cursor = Cursors.WaitCursor; ShowUpdateMessage("Searching for points matching \"{0}\"...", searchPhrase); for (int i = 0; i < IDInput.Items.Count; i++) { definition = (Metadata)IDInput.Items[i]; if (definition.PointID == pointID || definition.PointName.ToLower().Contains(searchPhrase) || definition.PointDescription.ToLower().Contains(searchPhrase)) { IDInput.SetItemChecked(i, true); } } ShowUpdateMessage("Found {0} point(s) matching \"{1}\".", IDInput.CheckedIndices.Count, searchPhrase); } catch (Exception ex) { ShowUpdateMessage("Error finding points - {0}", ex.Message); } finally { this.Cursor = Cursors.Default; } }