PhotobucketNet照片上传
我在 PhotobucketNet 用户登录方面遇到问题(我需要用户登录,以便我可以将图片从 HDD 上传到他的 Photobucket 帐户)。
Photobucket photobucket = new Photobucket("myapikey", "myapisecret");
photobucket.LaunchUserLogin();
// the problem happens here
photobucket.RequestUserToken();
如果我调用 RequestUserToken() ,它会立即发生,所以我会因为用户未登录而崩溃,并且用户登录后不会引发任何事件。是否有一些变量(bool 或其他变量)我可以检查用户是否登录 - 也许将其与计时器一起放入循环中? 他们也是知道用户是否取消登录的一种方法吗? 我知道计时器不是一个好的解决方案,所以如果有人有更好的想法,我愿意接受任何建议......
I have a problem with PhotobucketNet user login(I need user to login so I can upload a picture from HDD to his Photobucket account).
Photobucket photobucket = new Photobucket("myapikey", "myapisecret");
photobucket.LaunchUserLogin();
// the problem happens here
photobucket.RequestUserToken();
If I call RequestUserToken() it will happen immediately, so I'll get a crash cause user didn't logged in, and there is no event that's been raised after user logs in. Is there some variable(bool or something else) that I can check to see if user logged in - maybe to put it in a loop with timer?
Also is their a way to know if user canceled logging in?
I know that timer isn't a good solution, so if anyone has anything better as an idea, I'm open for any suggestions...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我今天遇到了同样的问题,在寻找解决方案时发现了您的帖子。以下是我设法解决问题的方法:
首先,我获得“用户登录网址”并将其传递到带有 Web 浏览器控件(称为“登录”)的表单。
接下来,我从这个页面获取了url,
这是登录后的页面。如果 Web 浏览器的 url 是该页面,我会要求 photobucket 类(在我的例子中为 Program.Service)来请求令牌。
登录表单中的代码如下所示:
现在您只需保存令牌并使用它。
I've encountered the same problem today and i found your post while i was searching for solutions. Here is how i managed to solve the problem:
Firstly, i got the "user login url" and passed it to a form with a web browser control, called "Login".
Next, I got the url from this page,
which is the page after the login. If the web browser's url is that page, i asked the photobucket class (in my case Program.Service), to request the token.
The code from the Login form is something like this:
Now you just save the token and use it.