Exemple #1
0
        public void OnShowHideMoleculeButton()
        {
            MoleculeSettings molecule = molecules.GetSelected();

            if (molecule == null)
            {
                return;
            }

            if (hiddenMolecules.Contains(molecule.ID))
            {
                molecule.Hidden = false;
                UserInterfaceEvents.RaiseShowMolecule(molecule.ID);
                if (molecule.PendingRerender)
                {
                    UserInterfaceEvents.RaiseMoleculeRenderSettingsUpdated(molecule.ID, molecule.RenderSettings, molecule.CurrentTrajectoryFrameNumber);
                }

                UserInterfaceEvents.RaiseMoleculeSelected(molecule.ID, true);
                hiddenMolecules.Remove(molecule.ID);
            }
            else
            {
                molecule.Hidden = true;
                trajectoryControls.StopAnimation();
                UserInterfaceEvents.RaiseHideMolecule(molecule.ID);
                hiddenMolecules.Add(molecule.ID);

                if (interactionsPanel.MonitoringEnabled)
                {
                    interactionsPanel.StopInteractions();
                    console.ShowError("Stopped monitoring molecular interactions, hiding molecule");
                }

                UserInterfaceEvents.RaiseMoleculeSelected(molecule.ID, false);
            }

            updateSelectedMoleculeInterfaceSettings();
        }