Esempio n. 1
0
        private void annotationsListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lastSelectedAnnotation != null)
            {
                lastSelectedAnnotation.OptionsChanged -= new EventHandler(OnAnnotationChanged);
            }

            if (clearing)
            {
                return;
            }

            if (annotationsListView.SelectedIndices.Count > 0 &&
                currentSpectrum.AnnotationList.Count > annotationsListView.SelectedIndices[0])
            {
                if (lastSelectedAnnotation == null ||
                    lastSelectedAnnotation.GetOptionsPanel(false) != currentSpectrum.AnnotationList[annotationsListView.SelectedIndices[0]].GetOptionsPanel(false))
                {
                    splitContainer.Panel2.Controls.Clear();
                    splitContainer.Panel2.Controls.Add(currentSpectrum.AnnotationList[annotationsListView.SelectedIndices[0]].GetOptionsPanel(false));
                }
                lastSelectedAnnotation = currentSpectrum.AnnotationList[annotationsListView.SelectedIndices[0]];
                lastSelectedAnnotation.OptionsChanged += new EventHandler(OnAnnotationChanged);
                lastSelectedAnnotation.GetOptionsPanel();

                removeAnnotationButton.Enabled = true;
            }
            else
            {
                splitContainer.Panel2.Controls.Clear();
                lastSelectedAnnotation         = null;
                removeAnnotationButton.Enabled = false;
            }
            splitContainer.Panel2.Refresh();
        }