Example #1
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);
        }
Example #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();
            }
        }
Example #3
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();
            }
        }
Example #4
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);
        }
Example #5
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();

            }

        }
Example #6
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();
            }

        }