Exemplo n.º 1
0
        private void TextChangedHandler(object sender, TextChangedEventArgs e)
        {
            try
            {
                if (tb_Command.Text.Length > 2)
                {
                    using (StreamReader reader = new StreamReader("AvailableCommands.xml"))
                    {
                        XmlSerializer           serializer = new XmlSerializer(typeof(XmlDocumentation));
                        XmlDocumentation        doc        = (XmlDocumentation)serializer.Deserialize(reader);
                        XmlDocumentationCommand cmd        = doc.Commands.Where(x => x.Keyword.Contains(tb_Command.Text.Split(' ')[0])).FirstOrDefault();
                        if (cmd == null)
                        {
                            p_CommandHelper.IsOpen = false;
                            return;
                        }

                        CommandHelperElement element = new CommandHelperElement(cmd.Name, cmd.Description, cmd.Format);

                        for (int i = 0; i < cmd.Parameters.Count; i++)
                        {
                            XmlDocumentationCommandParameter prm       = cmd.Parameters[i];
                            CommandHelperParameterElement    parameter = new CommandHelperParameterElement(prm.Name, prm.Details, prm.IsRequired);
                            element.AddParameter(parameter);
                        }

                        p_CommandHelper.Child = element;

                        p_CommandHelper.IsOpen = true;
                    }
                }
                else
                {
                    p_CommandHelper.IsOpen = false;
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
 public void AddParameter(CommandHelperParameterElement parameter)
 {
     sp_Parameters.Children.Add(parameter);
 }