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')

沒有留言:

張貼留言

乩童警探 一二集

接連看了兩集。第一集還算新鮮,到了第二集就看得比較慢了。一來,劇情雖然常會提到乩童,但真的跟乩童又沒有什麼關係。第二集後半大概就猜出是怎麼一回事了,但還是很享受在作者解釋的過程。只是前面舖陳有點久,而且人物有點多,再加上我是斷斷續續的看,看到後來都快忘了誰是誰,或是誰曾經出過什麼...