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);
        }
        public void DeletePhotoSetAsync(string setId)
        {
            string timestamp = DateTimeUtils.GetTimestamp();
            string nonce = Guid.NewGuid().ToString().Replace("-", null);

            Dictionary<string, string> paramDict = new Dictionary<string, string>();
            paramDict["method"] = "flickr.photosets.delete";
            paramDict["format"] = "json";
            paramDict["nojsoncallback"] = "1";
            paramDict["oauth_consumer_key"] = consumerKey;
            paramDict["oauth_nonce"] = nonce;
            paramDict["oauth_signature_method"] = "HMAC-SHA1";
            paramDict["oauth_timestamp"] = timestamp;
            paramDict["oauth_token"] = AccessToken;
            paramDict["oauth_version"] = "1.0";
            paramDict["photoset_id"] = setId;

            string signature = OAuthCalculateSignature("POST", "https://api.flickr.com/services/rest/", paramDict, AccessTokenSecret);
            paramDict["oauth_signature"] = signature;

            DispatchPostRequest("POST", "https://api.flickr.com/services/rest/", paramDict,
                (response) =>
                {
                    bool success = true;
                    string errorMessage = "";

                    try
                    {
                        JObject json = JObject.Parse(response);
                        string status = json["stat"].ToString();
                        if (status != "ok")
                        {
                            success = false;
                            errorMessage = json["message"].ToString();
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(e.Message);

                        success = false;
                    }

                    if (!success)
                    {
                        DeletePhotoSetExceptionEventArgs exceptionArgs = new DeletePhotoSetExceptionEventArgs();
                        exceptionArgs.SetId = setId;
                        exceptionArgs.ErrorMessage = errorMessage;
                        PhotoSetDeleteException.DispatchEvent(this, exceptionArgs);
                    }
                    else
                    {
                        DeletePhotoSetEventArgs args = new DeletePhotoSetEventArgs();
                        args.SetId = setId;
                        PhotoSetDeleted.DispatchEvent(this, args);
                    }


                }, (ex) =>
                {
                    DeletePhotoSetExceptionEventArgs exceptionArgs = new DeletePhotoSetExceptionEventArgs();
                    exceptionArgs.SetId = setId;
                    exceptionArgs.ErrorMessage = "Unknown network error";
                    PhotoSetDeleteException.DispatchEvent(this, exceptionArgs);
                });
        }
        private void OnPhotoSetDeleted(object sender, DeletePhotoSetEventArgs e)
        {
            if (deletePhotoSetDialog == null || e.SetId != PhotoSetSource.ResourceId)
            {
                return;
            }

            deleteView.ShowCompleteMessage("Complete. Please click on the confirm button to go back");
            deletePhotoSetConfirmButton.IsEnabled = true;
        }