コード例 #1
0
ファイル: ChemSpiderClient.cs プロジェクト: cyrenaique/HCSA
        public Search(string token, IWin32Window owner, TransferType transferType, bool closeOnTransfer)
        {
            _owner = (Form)owner;
            _token = token;
            _transferType = transferType;
            _closeOnTransfer = closeOnTransfer;

            if (!string.IsNullOrEmpty(token))
            {

                // instantiate our ChemSpider Search instance
                _cs = new ChemSpiderSearch.Search();

                // instantiate our ChemSpider InChI instance
                _ci = new ChemSpiderInChI.InChI();

                // setup event handlers
                _cs.ElementsSearchCompleted += (cs_ElementsSearchCompleted);
                _cs.IntrinsicPropertiesSearchCompleted += (cs_IntrinsicPropertiesSearchCompleted);
                _cs.LassoSearchCompleted += (cs_LassoSearchCompleted);
                _cs.PredictedPropertiesSearchCompleted += (cs_PredictedPropertiesSearchCompleted);
                _cs.SimilaritySearchCompleted += (cs_SimilaritySearchCompleted);
                _cs.SimpleSearchCompleted += (cs_SimpleSearchCompleted);
                _cs.StructureSearchCompleted += (cs_StructureSearchCompleted);
                _cs.SubstructureSearchCompleted += (cs_SubstructureSearchCompleted);
                _cs.GetAsyncSearchResultCompleted += (_cs_GetAsyncSearchResultCompleted);
                _cs.GetAsyncSearchResultPartCompleted += (_cs_GetAsyncSearchResultPartCompleted);
            }
            else
            {
                MessageBox.Show(owner, "ChemSpider token not set", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: frmResults.cs プロジェクト: cyrenaique/HCSA
        public frmResults(int[] results, ChemSpiderSearch.Search cs, ChemSpiderInChI.InChI ci, string token, TransferType transferType, bool closeOnTransfer)
        {
            _cs = cs;
            _ci = ci;
            _token = token;
            _results = results;
            _transferType = transferType;
            _closeOnTransfer = closeOnTransfer;

            InitializeComponent();

            tsbTransfer.Enabled = (transferType != TransferType.None);

            if (_results.Length == 1)
            {
                tsbMovePrevious.Enabled = false;
                tsbMoveNext.Enabled = false;
                tsbMoveFirst.Enabled = false;
                tsbMoveLast.Enabled = false;
            }
            else
            {
                tsbMoveFirst.Enabled = false;
                tsbMovePrevious.Enabled = false;
                tsbMoveLast.Enabled = true;
                tsbMoveNext.Enabled = true;
            }
            Navigate(0);
        }