Ejemplo n.º 1
0
        public void RenameResult()
        {
            CheckDisposed();
            var selectedIndices = SelectedIndices(listResults);

            if (selectedIndices.Length == 0)
            {
                return;
            }

            int[] listResultsSelectedIndices = SelectedIndices(listResults);
            int   iFirst = listResultsSelectedIndices[0];

            listResults.SelectedIndices.Clear();
            listResults.SelectedIndices.Add(iFirst);

            var selected          = (ManageResultsAction)listResults.Items[iFirst];
            var listExistingNames = from chromSet in Chromatograms
                                    where !ReferenceEquals(chromSet, selected.Chromatograms)
                                    select chromSet.Name;

            using (var dlg = new RenameResultDlg(selected.Chromatograms.Name, listExistingNames))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    selected.Chromatograms    = (ChromatogramSet)selected.Chromatograms.ChangeName(dlg.ReplicateName);
                    listResults.Items[iFirst] = ManageResultsAction.EMPTY;  // Forces text update for case change
                    listResults.Items[iFirst] = selected;
                }
            }
            listResults.Focus();
        }
Ejemplo n.º 2
0
        public void RenameResult()
        {
            CheckDisposed();
            var selectedIndices = SelectedIndices(listResults);
            if (selectedIndices.Length == 0)
                return;

            int[] listResultsSelectedIndices = SelectedIndices(listResults);
            int iFirst = listResultsSelectedIndices[0];
            listResults.SelectedIndices.Clear();
            listResults.SelectedIndices.Add(iFirst);

            var selected = (ManageResultsAction) listResults.Items[iFirst];
            var listExistingNames = from chromSet in Chromatograms
                               where !ReferenceEquals(chromSet, selected.Chromatograms)
                               select chromSet.Name;

            using (var dlg = new RenameResultDlg(selected.Chromatograms.Name, listExistingNames))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    selected.Chromatograms = (ChromatogramSet) selected.Chromatograms.ChangeName(dlg.ReplicateName);
                    listResults.Items[iFirst] = ManageResultsAction.EMPTY;  // Forces text update for case change
                    listResults.Items[iFirst] = selected;
                }
            }
            listResults.Focus();
        }