Beispiel #1
0
        private void CallCommand(PartialSpeechResponseEventArgs e)
        {
            if (e.PartialResult.Contains("stop recording"))
            {
                _partialResponces = "###";
                _tbCtrl.Text      = _fullResponces;
                StopRecording();
            }

            if (_commandMode && e.PartialResult.Contains("chemical") && e.PartialResult.Contains("properties"))
            {
                string chemical;
                try
                {
                    chemical      = e.PartialResult.Replace("chemical ", "");
                    chemical      = chemical.Replace(" properties", "");
                    _tbCtrl.Text += "looking up data for " + chemical + " ...\n";
                    _chemOperations.FillChemicalValues(chemical);
                    _tbCtrl.Text += " All Data fully loaded for chemical :" + chemical;
                }
                catch (Exception ex)
                {
                    _tbCtrl.Text += " " + ex.Message;
                }
            }

            if (_commandMode && e.PartialResult.Contains("send email"))
            {
                _emailOperations.SendDictationEmail(TbEmailAddress.Text, TbDictation.Text);
                Close();
            }

            if (_commandMode && e.PartialResult.Contains("email address"))
            {
                _partialResponces  = "###";
                _tbCtrl.Background = Brushes.White;
                _tbCtrl            = TbEmailAddress;
                _fullResponces     = _tbCtrl.Text;
                SetTextBox();
                _commandMode = false;
            }

            if (_commandMode && e.PartialResult.Contains("subject"))
            {
                _partialResponces  = "###";
                _tbCtrl.Background = Brushes.White;
                _tbCtrl            = TbSubject;
                _fullResponces     = _tbCtrl.Text;
                SetTextBox();
                _commandMode = false;
            }

            if (_commandMode && e.PartialResult.Contains("content"))
            {
                _partialResponces  = "###";
                _tbCtrl.Background = Brushes.White;
                _tbCtrl            = TbDictation;
                _fullResponces     = _tbCtrl.Text;
                SetTextBox();
                _commandMode = false;
            }

            if (_commandMode && e.PartialResult.Contains("exit command") || e.PartialResult.Contains("resume"))
            {
                _partialResponces = "###";
                _commandMode      = false;
                _fullResponces    = TbDictation.Text;
            }

            //chemical properties
            if (_commandMode && e.PartialResult.Contains("target chemical"))
            {
                _tbCtrl.Text += _chemOperations.Chemical;
            }

            if (_commandMode && e.PartialResult.Contains("mw") || e.PartialResult.Contains("molecular weight"))
            {
                _tbCtrl.Text += " Molecular Weight = " + _chemOperations.MolecularWeight;
            }

            if (_commandMode && e.PartialResult.Contains("formula"))
            {
                var text = " Formula = " + _chemOperations.MolecularWeight;
                _tbCtrl.Text   += text;
                _fullResponces += text;
            }

            if (_commandMode && e.PartialResult.Contains("synonym"))
            {
                var text = "Synonyms  = " + _chemOperations.Synonyms;
                _tbCtrl.Text   += text;
                _fullResponces += text;
            }

            if (_commandMode && e.PartialResult.Contains("chemical id"))
            {
                var text = "CID's  = " + _chemOperations.CiDs;
                _tbCtrl.Text   += text;
                _fullResponces += text;
            }

            if (_commandMode && e.PartialResult.Contains("keys"))
            {
                var text = "InCHI keys  = " + _chemOperations.CiDs;
                _tbCtrl.Text   += text;
                _fullResponces += text;
            }
        }