2008/06/17

improvement of "Random Flickr Photos" in C#

img_4028
Canon S30
2004.04.15
Keukenhof tuin

荷蘭的庫肯霍夫花園,除了有各式各樣的鬱金香外,
其實還有許多特別的花可以欣賞。

****

Added features:
1. modified the output html codes so that the title and the taken date of the photo will be shown when mouse is hovered over the photo.
2. moved interactions with flickr service into a thread so that it won't hang the whole application
3. every time the photo search is done, display the html results correspondingly, so that it won't take too long to show the results

A new class is created to do the time-consuming job. webbrowser is passed to it as a reference, so that it can set up DocumentText when it wants. To use pass by reference feature in C#, a "ref" keyword should be added in the function declaration and when being used.

****

The launch look-up in the web browser function in onlinedic is broken for a while. Since I don't use this feature often, I did not care about it. The other day, I found that there's a good module in emesene just for the purpose as I want! It's called desktop.py. emesene uses it to determine the current system and choose the right web browser for you. With this module, what I need to do is nothing but copy the desktop.py and call a method!


import desktop
desktop.open('url_name')

No comments:

Post a Comment

騎士團長殺人事件 --村上春樹

今年的日文小說看完了。篇幅很長,但規模不大,故事都繞著幾個主要的人物。情節裡有些超現實的場景,但最後卻讓人有點意猶未盡,因為有些想搞懂的疑點,在還沒講清之前就結束了。