示例#1
0
        public void SetMoleculeSelected(int?moleculeID)
        {
            molecules.SelectedMoleculeID = moleculeID;

            foreach (KeyValuePair <int, MoleculeSettingsPanelListItem> item in moleculeListItems)
            {
                item.Value.SetHighlighted(false);
                UserInterfaceEvents.RaiseMoleculeSelected(item.Key, false);
            }

            if (moleculeID != null)
            {
                foreach (KeyValuePair <int, MoleculeSettingsPanelListItem> item in moleculeListItems)
                {
                    if (item.Key == molecules.SelectedMoleculeID)
                    {
                        item.Value.SetHighlighted(true);

                        // if molecule is hidden then dont raise event. When molecule is unhidden then an event will be raised instead
                        MoleculeSettings molecule = molecules.Get((int)moleculeID);
                        if (molecule != null && !molecule.Hidden)
                        {
                            UserInterfaceEvents.RaiseMoleculeSelected(item.Key, true);
                        }
                    }
                }
            }

            updateSelectedMoleculeInterfaceSettings();
        }
示例#2
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();
        }