private void Command_box_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            switch (e.Key)
            {
            case VirtualKey.Enter:
                try
                {
                    string CommandContent = Command_box.Text;

                    Task.Run(() =>
                    {
                        ChakraSMS executor = new ChakraSMS();
                        executor.Chakra.ProjectObjectToGlobal(new SCEELibs.Editor.ConsoleManager(), "Console");
                        executor.Chakra.ProjectObjectToGlobal(new SCEELibs.SCEELibs(), "sceelibs");
                        executor.Chakra.RunScript(CommandContent);
                    });
                }
                catch { }

                commands_list.Add(Command_box.Text);
                commands_list_index = -1; Command_box.Text = "";
                break;

            case VirtualKey.Down:
                if (commands_list_index < 0)
                {
                    commands_list_index = commands_list.Count;
                }
                commands_list_index--;

                if (commands_list_index >= 0)
                {
                    Command_box.Text = commands_list[commands_list_index];
                }

                break;

            case VirtualKey.Up:
                if (commands_list_index + 1 <= commands_list.Count - 1)
                {
                    commands_list_index++;

                    if (commands_list_index >= 0)
                    {
                        Command_box.Text = commands_list[commands_list_index];
                    }
                }
                else
                {
                    Command_box.Text = ""; commands_list_index = -1;
                }
                break;
            }
        }
Esempio n. 2
0
 private void InitializeChakra()
 {
     executor = new ChakraSMS();
     executor.Chakra.ProjectObjectToGlobal(new SCEELibs.Editor.ConsoleManager(), "console");
     executor.Chakra.ProjectObjectToGlobal(new SCEELibs.SCEELibs(), "sceelibs");
 }