private void OnEditTrackName(object sender, RoutedEventArgs e)
        {
            Stop();
            loaded = false;

            string newName = EditNameDialog.ShowDialog(this, Config.Midi.GetTrackSettingsAt(trackIndex).ProperName);

            if (newName != null)
            {
                Config.Midi.GetTrackSettingsAt(trackIndex).Name     = newName;
                ((ListBoxItem)listTracks.Items[trackIndex]).Content = Config.Midi.GetTrackSettingsAt(trackIndex).ProperName;
                //listTracks.SelectedIndex = trackIndex;
            }

            loaded = true;
        }
        private void OnEditMidiName(object sender, RoutedEventArgs e)
        {
            Stop();
            loaded = false;

            if (Config.HasMidi)
            {
                string newName = EditNameDialog.ShowDialog(this, Config.Midi.ProperName);
                if (newName != null)
                {
                    Config.Midi.Name = newName;
                    listMidis.Items[listMidis.SelectedIndex] = Config.Midi.ProperName;
                    listMidis.SelectedIndex = Config.MidiIndex;
                }
            }

            loaded = true;
        }