private void btnAddButton_Click(object sender, RoutedEventArgs e)
 {
     var abw = new AddButtonWindow();
     if (abw.ShowDialog() == true)
     {
         string toShow = convertAddButtonResult();
         lstButtons.Items.Add(toShow);
     }
 }
        private void btnEditButton_Click(object sender, RoutedEventArgs e)
        {
            if (lstButtons.SelectedIndex == -1)
                return;

            string[] parts = lstButtons.SelectedItem.ToString().Split(new[] {' '});

            AddButtonWindow abw;
            int endIndex = 1;
            string cmd = "";
            for (int i = 1; i < parts.Count(); i++)
            {
                cmd += parts[i];
                if (parts[i].EndsWith("'"))
                {
                    endIndex = i;
                    break;
                }
                cmd += " ";
            }
            cmd = cmd.Replace("'", "");
            if (parts[0] == "Press")
            {
                abw = new AddButtonWindow(cmd, parts[0], Convert.ToInt32(parts[endIndex + 2]), 30);
            }
            else
            {
                abw = new AddButtonWindow(cmd, parts[0], Convert.ToInt32(parts[endIndex + 4]), Convert.ToInt32(parts[endIndex + 2]));
            }
            if (abw.ShowDialog() == true)
            {
                string toShow = convertAddButtonResult();
                int index = lstButtons.SelectedIndex;
                lstButtons.Items.RemoveAt(index);
                lstButtons.Items.Insert(index, toShow);
            }
        }