private void add_Click(object sender, RoutedEventArgs e)
        {
            this.IsEnabled = false;
            if (commandWindow is null)
            {
                commandWindow = new commandWindow();
            }
            else
            {
                commandWindow = new commandWindow(commandWindow);
            }
            commandWindow.ShowDialog();


            if (commandWindow.addCommand)
            {
                try
                {
                    utils.command c = createCommand();
                    script.commands.Add(c);
                    this.commands.Items.Add(c.name);
                }
                catch
                {
                    MessageBox.Show(utils.ErrorMessages.unexpected_error, "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                    add_Click(sender, e);
                }
            }
            this.IsEnabled = true;
        }
        private void edit_Click(object sender, RoutedEventArgs e)
        {
            int index = this.commands.SelectedIndex;

            if (index < 0)
            {
                return;
            }

            this.IsEnabled = false;

            commandWindow = new commandWindow(script.commands[index]);

            commandWindow.ShowDialog();


            if (commandWindow.addCommand)
            {
                try
                {
                    utils.command c = createCommand();
                    script.commands[index]     = c;
                    this.commands.Items[index] = c.name;
                }
                catch
                {
                    MessageBox.Show(utils.ErrorMessages.unexpected_error, "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                    edit_Click(sender, e);
                }
            }
            this.IsEnabled = true;
        }