private void btnAdd_Click(object sender, EventArgs e)
        {
            GroupDTO groupDTO = VkAPI.GetGroup(tbGroupLink.Text, AccessToken);

            AddGroup(groupDTO);
            tbGroupLink.Clear();
        }
Beispiel #2
0
        private void Collector_DoWork(object sender, DoWorkEventArgs e)
        {
            int RequestedQuantity = (int)nudQuantity.Value;

            for (int g = 0; g < Configs.Groups.Count; g++)
            {
                int CollectedQuantity = 0;

                while (CollectedQuantity < RequestedQuantity)
                {
                    int CurrentQuantity = RequestedQuantity - CollectedQuantity;
                    if (CurrentQuantity > 100)
                    {
                        CurrentQuantity = 100;
                    }

                    List <VkPublicationDTO> publications = VkAPI.GetWallPosts(Configs.Groups[g], CurrentQuantity, CollectedQuantity, Configs.AccessToken);

                    if (publications != null)
                    {
                        for (int i = 0; i < publications.Count; i++)
                        {
                            AddRow(publications[i]);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Ошибка во время сбора публикаций");
                    }

                    CollectedQuantity += CurrentQuantity;
                }
            }
        }
        public MainWindowViewModel(string access_token)
        {
            vkAPI = new VkAPI(VkAPI.BASE_URL, access_token);
            player = new Mp3Player();
            player.OnPlaybackEnded += Player_OnPlaybackEnded;
            player.OnPlaybackStateChanged += Player_OnPlaybackStateChanged;
            player.OnPlaybackPositionUpdated += PlayerOnPlaybackPositionUpdated;

            SearchResults = new Playlist("Search results");
            Queue = new Playlist("Queue");
            Favorites = new Playlist("Favorites");
            Playlists = new ObservableCollection<Playlist>();
        }
        public MainWindowViewModel()
        {
            vkAPI = new VkAPI();
            albumArtProvider = new BingAlbumArtProvider();
            player = new Mp3Player();
            player.OnPlaybackEnded += Player_OnPlaybackEnded;
            player.OnPlaybackStateChanged += Player_OnPlaybackStateChanged;
            player.OnPlaybackPositionUpdated += PlayerOnPlaybackPositionUpdated;

            SearchResults = new Playlist("Search results");
            Queue = new Playlist("Queue");
            Favorites = new Playlist("Favorites");
            Playlists = new ObservableCollection<Playlist>();
        }