Exemplo n.º 1
0
        private void buttonCreateLyric_Click(object sender, EventArgs e)
        {
            //提示输入文件名
            FormInput formInput = new FormInput();
            formInput.Text = "请输入音乐名称";
            if (formInput.ShowDialog() == DialogResult.OK)
            {
                if (formInput.StrReturnValue != "")
                {
                    //修改文件编号
                    string strIndexTemp = (listViewUserMusicList.Items.Count + 1).ToString("d3");
                    string strTxtFileName = strIndexTemp + formInput.StrReturnValue + ".txt";
                    string strTxtFilePath = MusicHelper.GetLyricFilePathByLyricFileName(comboBoxMusicianList.Items[comboBoxMusicianList.SelectedIndex].ToString(), comboBoxAlbumList.Items[comboBoxAlbumList.SelectedIndex].ToString(), strTxtFileName);

                    //提示输入歌词,保存
                    FormLyric formLyric = new FormLyric();

                    if (formLyric.ShowDialog() == DialogResult.OK)
                    {
                        if (formLyric.Lyric != "")
                        {
                            MusicHelper.SetLyricsByLyricFilePath(strTxtFilePath, formLyric.Lyric);

                            comboBoxAlbumList_SelectedIndexChanged(null, null);
                        }

                    }

                }
            }

        }
Exemplo n.º 2
0
        //专辑改名
        private void buttonRenameList_Click(object sender, EventArgs e)
        {
            //过用户没有选择“系列”,则提示用户先选择一个系列
            if (comboBoxMusicianList.SelectedIndex < 0 || comboBoxAlbumList.SelectedIndex < 0)
            {
                MessageBox.Show("请先选中一个[专辑]!");
            }
            else
            {
                FormInput formInput = new FormInput();
                formInput.Text = "您将修改[" + comboBoxMusicianList.Items[comboBoxMusicianList.SelectedIndex].ToString() + "]系列中的[" + comboBoxAlbumList.Items[comboBoxAlbumList.SelectedIndex].ToString() + "]专辑,请输入新的专辑名称并[确定]";
                formInput.textBoxMessage.Text = comboBoxAlbumList.Items[comboBoxAlbumList.SelectedIndex].ToString();
                formInput.ShowDialog();

                if (formInput.StrReturnValue != "")
                {
                    //改名,如果重复则提示已存在同名专辑
                    MessageBox.Show(ListHelper.RenameAlbum(comboBoxMusicianList.Items[comboBoxMusicianList.SelectedIndex].ToString(), comboBoxAlbumList.Items[comboBoxAlbumList.SelectedIndex].ToString(), formInput.StrReturnValue));

                    //刷新专辑列表
                    comboBoxMusicianList_SelectedIndexChanged(null, null);
                }

                formInput.Dispose();

            }

        }
Exemplo n.º 3
0
        private void buttonRenameMusic_Click(object sender, EventArgs e)
        {
            if (listViewUserMusicList.Items.Count <= 0 || listViewUserMusicList.SelectedIndices.Count == 0 || listViewUserMusicList.SelectedIndices[0] < 0)
            {
                return;
            }

            //得到选中的音乐的名字,并显示在文本框中供修改
            FormInput formInput = new FormInput();
            formInput.textBoxMessage.Text = listViewUserMusicList.SelectedItems[0].Text;
            formInput.ShowDialog();

            if (formInput.StrReturnValue != "")
            {
                FileInfo fileInfo = new FileInfo(listViewUserMusicList.SelectedItems[0].Tag.ToString());
                fileInfo.MoveTo(listViewUserMusicList.SelectedItems[0].Tag.ToString().Replace(listViewUserMusicList.SelectedItems[0].Text,
                    formInput.StrReturnValue));

                //如果当前编辑的不是txt文件,则自动编辑txt文件
                if (fileInfo.Extension != ".txt")
                {
                    string strTxtFile = listViewUserMusicList.SelectedItems[0].Tag.ToString().Substring(0, listViewUserMusicList.SelectedItems[0].Tag.ToString().Length - 3) + "txt";
                    fileInfo = new FileInfo(strTxtFile);
                    fileInfo.MoveTo(strTxtFile.Replace(listViewUserMusicList.SelectedItems[0].Text,
                    formInput.StrReturnValue));
                }
            }

            formInput.Dispose();

            comboBoxAlbumList_SelectedIndexChanged(null, null);
        }
Exemplo n.º 4
0
        //新建一个播放列表/专辑
        private void buttonCreateList_Click(object sender, EventArgs e)
        {
            //过用户没有选择“系列”,则提示用户先选择一个系列
            if (comboBoxMusicianList.SelectedIndex < 0)
            {
                MessageBox.Show("请先选中一个[系列],再新建专辑。");
            }
            else
            {
                FormInput formInput = new FormInput();
                formInput.Text = "您将在[" + comboBoxMusicianList.Items[comboBoxMusicianList.SelectedIndex].ToString() + "]系列中新建专辑,请输入专辑名称并[确定]";
                formInput.textBoxMessage.Text = DateTime.Now.ToString("yyyyMMdd");
                formInput.ShowDialog();

                if (formInput.StrReturnValue != "")
                {
                    //新建目录,如果重复则提示已存在同名专辑
                    MessageBox.Show(ListHelper.CreateAlbum(comboBoxMusicianList.Items[comboBoxMusicianList.SelectedIndex].ToString(), formInput.StrReturnValue));

                    //刷新专辑列表
                    comboBoxMusicianList_SelectedIndexChanged(null, null);
                }

                formInput.Dispose();
            }

        }