コード例 #1
0
        private void SongsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var item = (ImageComboBoxItem)songsComboBox.SelectedItem;

            if (item.Item is Config.Song song)
            {
                SetAndLoadSong(song.Index);
            }
            else if (item.Item is Config.Playlist playlist)
            {
                if (playlist.Songs.Count > 0 &&
                    FlexibleMessageBox.Show(string.Format(Strings.PlayPlaylistBody, Environment.NewLine + playlist), Strings.MenuPlaylist, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    ResetPlaylistStuff(false);
                    curPlaylist = playlist;
                    Engine.Instance.Player.ShouldFadeOut = playlistPlaying = true;
                    Engine.Instance.Player.NumLoops      = GlobalConfig.Instance.PlaylistSongLoops;
                    endPlaylistItem.Enabled = true;
                    SetAndLoadNextPlaylistSong();
                }
            }
        }
コード例 #2
0
        private void ExportSF2(object sender, EventArgs e)
        {
            var d = new CommonSaveFileDialog
            {
                DefaultFileName  = Engine.Instance.Config.GetGameName(),
                DefaultExtension = ".sf2",
                EnsureValidNames = true,
                Title            = Strings.MenuSaveSF2,
                Filters          = { new CommonFileDialogFilter(Strings.FilterSaveSF2, ".sf2") }
            };

            if (d.ShowDialog() == CommonFileDialogResult.Ok)
            {
                try
                {
                    Core.GBA.AlphaDream.SoundFontSaver_SF2.Save((Core.GBA.AlphaDream.Config)Engine.Instance.Config, d.FileName);
                    FlexibleMessageBox.Show(string.Format(Strings.SuccessSaveSF2, d.FileName), Text);
                }
                catch (Exception ex)
                {
                    FlexibleMessageBox.Show(ex, Strings.ErrorSaveSF2);
                }
            }
        }