public UpdatePartyForm()
        {
            InitializeComponent();
            this.RegisterClient();
            var currentParty = _service.GetPartyById(_dataStorage.CurrentSelectedPartyId);

            NameTxt.Text        = currentParty.Name;
            LimitBox.Text       = string.Empty + currentParty.AvailablePlaces;
            YesCheckBox.Checked = currentParty.privacy;
            //not sure if works like this
            StartDateTimePicker.Value = currentParty.startDate;
            StartTimePicker.Value     = currentParty.startDate;
            EndDateTimePicker.Value   = currentParty.endDate;
            EndTimePicker.Value       = currentParty.endDate;
            currentRowVersion         = currentParty.RowVersion;
        }
示例#2
0
        /// <summary>
        /// Initializing the party ->
        /// Spotify authentication
        /// Getting current playlist with ratings from db
        /// Getting the party name
        /// </summary>
        private async void PartyInit()
        {
            _spotify = _dataStorage._spotifyDS;
            if (_spotify == null)
            {
                await RunSpotifyAuthentication();

                _dataStorage._spotifyDS = _spotify;
            }
            GetPlaylist();

            SpotifyLocalConnect();
            _spotifyLocal.OnTrackTimeChange += Spotify_OnTrackTimeChange;
            _spotifyLocal.OnTrackChange     += UpdateSongData;
            _partyName = _service.GetPartyById(_dataStorage.CurrentSelectedPartyId).Name;
        }
示例#3
0
        private void RefreshSpotifyPlaylist(List <SongsForPartyTable> songsForPartyTable)
        {
            var partyName = _service.GetPartyById(_dataStorage.CurrentSelectedPartyId).Name;
            var playlists = GetPlaylists();
            var uris      = new List <string>();

            songsForPartyTable.ForEach(track =>
            {
                uris.Add(track.songURL);
            });


            var foundid = "";
            var i       = 0;

            while (foundid == "" && i < playlists.Count)
            {
                if (playlists[i].Name.Equals(partyName))
                {
                    foundid = playlists[i].Id;
                }
                i++;
            }
            if (foundid != "")
            {
                _fullPlaylist = _spotify.GetPlaylist(_dataStorage._profile.Id, foundid);
                _spotify.ReplacePlaylistTracks(_dataStorage._profile.Id, _fullPlaylist.Id, uris);
            }
            else
            {
                _fullPlaylist = CreatePlaylist(partyName);

                var playlist = _service.GetAllSongs(_dataStorage.CurrentSelectedPartyId).OrderByDescending(aux => aux.rating).ToList();
                playlist.ForEach(track =>
                {
                    AddTrack(_fullPlaylist, track.songURL);
                });
            }
            //PlayNewByUri(_fullPlaylist.Uri); --> playlist starts playing in order
            //_currentTrack.TrackResource.Uri;
            //PlayNewByUri(_fullPlaylist.Uri);
            //PlaySelectedPlaylist(uris);
            //_spotifyLocal.PlayURL(uris[1], $"uri:{uris[2]}");
        }