Esempio n. 1
0
 private void AddHystoryToken(HistoryToken token)
 {
     if (!history.Contains(token))
     {
         history.Add(token);
     }
     //if (!lstHistory.Items.Contains(token))
     //    lstHistory.Items.Add(token);
     if (!txtMessage.AutoCompleteCustomSource.Contains(token.StringValue))
     {
         txtMessage.AutoCompleteCustomSource.Add(token.StringValue);
     }
     Filter();
 }
Esempio n. 2
0
        private void Inject()
        {
            Module   source;
            Command  cmd;
            Response rsp;

            string[]     inputs;
            HistoryToken token;

            if ((source = (Module)cbModules.SelectedItem) == null)
            {
                return;
            }

            inputs = BulkMode ?
                     txtMessage.Text.Split(separators, StringSplitOptions.RemoveEmptyEntries) :
                     new string[] { txtMessage.Text.Trim() };

            foreach (string input in inputs)
            {
                //blackboard.Inject(source.Name + " " + input);
                token = null;
                if (Response.IsResponse(input) && Response.TryParse(input, source, out rsp))
                {
                    token = new HistoryToken(rsp);
                }
                else if (Command.IsCommand(input) && Command.TryParse(input, source, out cmd))
                {
                    token = new HistoryToken(cmd);
                }
                if (token == null)
                {
                    blackboard.Inject(source.Name + " " + input);
                    continue;
                }

                blackboard.Inject(token.StringToInject);
                AddHystoryToken(token);
            }
            txtMessage.Clear();
        }