Пример #1
0
        void AddOneNewSongClick(object param)
        {
            FileInfo info = new FileInfo(PathToFile);

            MessageBox.Show(info.FullName);

            StreamReader sourceStream = new StreamReader(PathToFile);

            byte[] fileContents = File.ReadAllBytes(PathToFile);// = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());

            sourceStream.Close();


            SongData data = new MusicID3Tag().DoParseFile(PathToFile);

            if (data != null)
            {
                ParametrSong ps = new ParametrSong();
                ps.User       = User_client;
                ps.Genre      = GenreForAdd;
                ps.NameArtist = data.NameArtist;
                ps.NameSong   = data.NameSong;
                ps.FileName   = info.Name;
                ps.File       = fileContents;

                adminConnector.UploadFileToFtp(ps);
            }
        }
Пример #2
0
 public async void RemoveSong(ParametrSong parametrSong)
 {
     try
     {
         await Task.Run(() => adminChannel.RemoveSong(parametrSong));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
0
 public async void UploadFileToFtp(ParametrSong parametrSong)
 {
     try
     {
         await Task.Run(() => adminChannel.UploadFileToFtp(parametrSong));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #4
0
        void RemoveSongClick(object param)
        {
            if (User_client.ID_Producer != (param as Song).ID_Producer)
            {
                MessageBox.Show("У Вас нет прав на удаление!");
            }
            else
            {
                ParametrSong ps = new ParametrSong();
                ps.User       = User_client;
                ps.NameArtist = (param as Song).Name_Artist;
                ps.NameSong   = (param as Song).Name_Song;

                adminConnector.RemoveSong(ps);

                AllSong.Remove(param as Song);
            }
        }