Ejemplo n.º 1
0
 private async void Download_btn_Click(object sender, EventArgs e)
 {
     music_list.Hide();
     if (account.IsAuthorized)
     {
         try
         {
             this.Hide();
             this.title_btn_general.Text = new string(' ', 4) + download_btn.Text;
             LoadBar bar = new LoadBar(Properties.Resources.WhileDownloadingText + " \n\r        Plaese Wait...");
             bar.Font         = new Font("Segoe UI", 24f);
             bar.TextPosition = new Point(154, 460);
             bar.Show();
             Task t = new Task(() =>
             {
                 Client.DownloadAllMusic();
             });
             t.Start();
             await t;
             bar.Close();
             MusicMessageBox box = new MusicMessageBox();
             box.ShowWindow(this, MessageFlags.Success);
             box.Show();
             downloaded = true;
         }
         catch (Exception ex)
         {
             MusicMessageBox box = new MusicMessageBox();
             box.Show();
             box.ShowWindow(this, ex.Message);
         }
     }
 }
Ejemplo n.º 2
0
 private void Plus_btn_Click(object sender, EventArgs e)
 {
     if (!account.IsAuthorized)
     {
         file_open.Filter = Properties.Resources.MusicFormatString;
         if (file_open.ShowDialog() == DialogResult.OK)
         {
             string fName = $"{ Properties.Resources.PublicMusicFolder}{ Path.GetFileNameWithoutExtension(file_open.FileName)}{Path.GetExtension(file_open.FileName)}";
             if (!File.Exists(fName))
             {
                 File.Copy(file_open.FileName, fName);
             }
             var item = new Music_Item();
             item.Name       = Path.GetFileNameWithoutExtension(file_open.FileName);
             item.ArtistName = Properties.Resources.UnknownMusicArtist;
             if (!closed)
             {
                 item.Size = new Size(music_list.Size.Width - 26, item.Size.Height);
             }
             else
             {
                 item.Size = new Size(music_list.Size.Width - 493, item.Size.Height);
             }
             item.MouseClick += Item_MouseClick;
             music_list.Controls.Add(item);
             item.Index = music_list.Controls.IndexOf(item);
             music_list.Controls.Add(item);
             music_list.Show();
             random_play_btn.Enabled = true;
             left_arrow_btn.Enabled  = true;
             play_btn.Enabled        = true;
             replay_btn.Enabled      = true;
             volume_btn.Enabled      = true;
             right_arrow_btn.Enabled = true;
         }
     }
     else
     {
         MusicMessageBox box = new MusicMessageBox();
         box.ShowWindow(this, Properties.Resources.NeedToLogOutMessage);
         box.Show();
     }
 }
Ejemplo n.º 3
0
        public Player()
        {
            bool rememberMe = false;

            InitializeComponent();
            //SetRoundedShape(this, 40);
            account = new VKAccount();
            InitFolders();

            if (rememberMe)
            {
                try
                {
                    Client = new VKManager();
                    Client.AuthentificateFromFile(File.ReadAllText(Properties.Resources.UserDataJSONPath), Properties.Resources.SecretUserJSONDataPath);
                }
                catch (Exception ex)
                {
                    MusicMessageBox box = new MusicMessageBox();
                    box.ShowWindow(this, ex.Message);
                }
            }
        }