示例#1
0
        public static string Show(
            string prompt,
            string title,
            string initialCid,
            MetaTable mt)
        {
            //if (Instance == null)
            Instance = new InputCompoundId();             // always allocate a new class

            new JupyterGuiConverter().ConvertFormOrUserControl(Instance);

            Instance.Text        = title;
            Instance.Prompt.Text = prompt;
            Instance.CidCtl.Text = initialCid;
            Instance.PreviousCid = "";
            Instance.QuickStructure.ClearMolecule();
            Instance.MetaTable = mt;

            if (mt != null && Lex.Eq(mt.Name, MetaTable.SmallWorldMetaTableName))
            {
                Instance.MetaTable = null;                 // don't use smallworld db directly since can't retrieve by CID
            }
            DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm);

            if (dr == DialogResult.OK)
            {
                return(Instance.CidCtl.Text);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        private void BrowseRN_Click(object sender, EventArgs e)
        {
            EQ.Checked  = true;
            Cid.Enabled = true;

            string prompt = "Enter the " + Qc.ActiveLabel + " to be retrieved";
            string title  = "Limit " + Qc.ActiveLabel;
            string tok    = InputCompoundId.Show(prompt, title, Cid.Text, Qc.MetaColumn.MetaTable);

            if (tok != null)
            {
                Cid.Text = tok;
            }
            return;
        }
示例#3
0
        /// <summary>
        /// Retrieve an existing molecule and store in MoleculeControl
        /// </summary>
        /// <param name="molCtl"></param>
        /// <param name="mc"></param>

        public static void RetrieveDatabaseStructure(
            MoleculeControl molCtl,
            MetaColumn mc)
        {
            MetaTable mt = null;
            string    cid = "", txt;

            txt = "compound id";
            if (mc != null)
            {
                mt   = mc.MetaTable;
                txt += " (" + mt.KeyMetaColumn.Label + ", etc.)";
            }

            txt = "Enter the " + txt + " that you want to use as a model.";

            while (true)
            {
                cid = InputCompoundId.Show(txt, "Retrieve Molecule from Database", cid, mt);
                if (String.IsNullOrEmpty(cid))
                {
                    return;
                }

                string molString = InputCompoundId.Molecule.PrimaryValue;
                if (String.IsNullOrEmpty(molString))
                {
                    MessageBoxMx.ShowError("Compound number is not in the database, try again.");
                    continue;
                }

                MoleculeMx cs = InputCompoundId.Molecule;

                cs.RemoveStructureCaption();                                      // remove any caption
                molCtl.SetPrimaryTypeAndValue(cs.PrimaryFormat, cs.PrimaryValue); // set mol
                molCtl.SetTemporaryMoleculeTag(cid);                              // associate the cid in case saved as history/favorite
                break;
            }
        }