private void OnPhotoSetDeleted(object sender, DeletePhotoSetEventArgs e)
        {
            PhotoSet photoSet = PhotoSetCache[e.SetId];
            PhotoSetCache.Remove(e.SetId);
            PhotoSetList.Remove(photoSet);

            photoSet = null;

            // Dispatch event
            PhotoSetListUpdatedEventArgs args = new PhotoSetListUpdatedEventArgs();
            args.UserId = CurrentUser.ResourceId;
            PhotoSetListUpdated.DispatchEvent(this, args);
        }
Exemplo n.º 2
0
        // Stream updated
        private void OnPhotoSetListUpdated(object sender, PhotoSetListUpdatedEventArgs e)
        {
            Dispatcher.BeginInvoke(() =>
            {
                if (e.UserId != Cinderella.CinderellaCore.CurrentUser.ResourceId)
                    return;

                if (Cinderella.CinderellaCore.PhotoSetList.Count == 0)
                {
                    StreamListStatusLabel.Text = AppResources.PreludeNoPhotoSetFoundText;
                    StreamListStatusLabel.Visibility = Visibility.Visible;
                    StreamListView.Visibility = Visibility.Collapsed;
                }
                else
                {
                    StreamListStatusLabel.Visibility = Visibility.Collapsed;
                    StreamListView.Visibility = Visibility.Visible;

                    PhotoSetList.Clear();
                    foreach (PhotoSet photoset in Cinderella.CinderellaCore.PhotoSetList)
                    {
                        PhotoSetList.Add(photoset);
                    }
                }

            });
        }
        private void PhotoListReturned(object sender, PhotoSetListEventArgs e)
        {
            JObject json = JObject.Parse(e.Response);
            JObject photosetJson = (JObject)json["photosets"];

            bool canCreate = photosetJson["cancreate"].ToString().ParseBool();
            int page = int.Parse(photosetJson["page"].ToString());
            int perPage = int.Parse(photosetJson["perpage"].ToString());
            int numTotal = int.Parse(photosetJson["total"].ToString());

            PhotoSetList.Clear();
            foreach (var ps in photosetJson["photoset"])
            {
                PhotoSet photoset = PhotoSetFactory.PhotoSetWithJObject((JObject)ps);
                PhotoSetList.Add(photoset);
            }

            // Dispatch event
            PhotoSetListUpdatedEventArgs args = new PhotoSetListUpdatedEventArgs();
            args.CanCreate = canCreate;
            args.Page = page;
            args.PerPage = perPage;
            args.TotalCount = numTotal;
            args.UserId = e.UserId;
            PhotoSetListUpdated.DispatchEvent(this, args);
        }