Пример #1
0
 private void RenameAlbum(ListViewItem item, string newName)
 {
     try
     {
         string oldPath = null;
         string newPath = null;
         if (item.Tag is AlbumManager)
         {
             AlbumManager mgr = (AlbumManager)item.Tag;
             oldPath = mgr.FullName;
             mgr.RenameAlbum(newName);
             newPath = mgr.FullName;
         }
         else if (item.Tag is string)
         {
             oldPath  = (string)item.Tag;
             newPath  = AlbumManager.RenameAlbum(oldPath, newName);
             item.Tag = newPath;
         }
         if (oldPath != null)
         {
             AlbumNode aNode = atvAlbumTree.FindAlbumNode(oldPath);
             if (aNode != null)
             {
                 aNode.UpdatePath(newPath);
             }
         }
     }
     catch (ArgumentException aex)
     {
         MessageBox.Show("Unable to rename album. [" + aex.Message + "]");
     }
 }