[Windows Phone][C#]最近寫了一個Windows Phone的Google Reader APP

本篇文章應該會用中文撰寫到完,接續著我前幾篇的文章,我一共寫了幾篇跟Google Reader溝通有關的文章。也讓我來仔細敘述當初為何會有這些文章的出現吧。 大概是兩個月前XDite大大在plurk po了一篇 “我要在一個月之內把Reeder幹出來” (大概是這樣吧!雖然我忘記原文了,而且大大好像後來也刪除了)。其實那一篇我看了以後很震撼~ 對喔!! 可以利用完全仿製另外一個商用APP的方式來練功。 於是我也開始撰寫APP,由於我自己只有iPhone,但是卻沒有任何MAC的電腦可以給我提供開發的環境,也只好拿公司最容易找到工具。Microsoft的 Visual Studio來撰寫Windows Phone。 一路上從四月才開始把專案建起來到現在,從完全不會寫Windows Phone到搞定Data Binding、知道如何使用Lambda與Delegate、也慢慢把Windows Phone原件搞懂,當然好久沒摸的WPF也開始拿回來K了一陣,到最後的LINQ、JSON(這個方便應該之後會寫一篇文章來做個說明)。其實寫好一個Google Reader App能夠學習的APP技巧真的不少,在這裡也稍微列一下: 為了登入Google API的服務, 一開始要學習的就是如何去處理網路溝通的方式,面對的就是 HttpWebRequest與WebClient。 當然這篇文章也幫助我很多。在這時候一併就把Lanbda與Delegate 的觀念學起來,畢竟你得要處理threading與UI呈現的問題。 登入Google Reader API之後就沒事情了嗎? 還要好好的去處理溝通過來得資料,這裡你當然可以乖乖的使用XML的方式或是直接跳到JSON的方式。 還好之前學習的Linq與JSON就派上用場。不過Google Reader的JSON資料也怪怪的~ 為了去處理這些東西~也讓我對JSON的觀念更佳的清楚了。 抓回來的Label列表與文章列表要如何處理呢?這時候又要跟WPF裡面的ListBox開始奮戰,這時候你又得跟Data Binding還有WPF XAML的語法來奮鬥。 別忘了最後~ 由於你需要離線閱讀還以記錄使用者的登入資訊。這時候又要跟Local database on Windows Phobne來奮鬥。不過這個算簡單的,畢竟LinQ步算是太難入門的東西。 到目前為止利用自己上班剩餘時間,大概忙了三個禮拜的結果,目前已經可以登入與看文章。由於在今天好不容易把Google Reader裡面的設定閱讀(mark it as read)也搞定了。 現在也才可以寫篇文章做點記錄。不過接下來才是Reeder令人激賞的好用地方,我也先把自己的TODO 列一下: 順暢與讀體驗與文章下載(裡面包含著完全不影響使用者閱讀的離線下載) 將你喜歡的文章轉載到各個社群媒體Facebook,Evernote…. 等 (希望懂了JSON可以讓之後的路更順暢) 使用者介面得更加美化 (這是我的盲點~~~~~) 好啦!! 今天也總算把基本功能都完成了! 繼續努力了~~~
繼續閱讀

本站也開始支援SyntaxHighlighter

SyntaxHighlighter是一個在網站上相當好用的東西。我終於也在www.evanlin.comblog把他安裝好了</br>不過呢~ 由於Window Live Writer 還沒有找到真的讓我覺得很好用的部分</br>這個Plugin 不好用(更正: 因為不支援最新版本的Syntaxhighlighter 3.0.8.3)</br>以下是我加入到MT 模板的code(不過這是用VSpaste)先貼的 <span style="color:green;"><!-- Include required JS files --> </span><span style="color:blue;"><</span><span style="color:#a31515;">script </span><span style="color:red;">type</span><span style="color:blue;">="text/javascript" </span><span style="color:red;">src</span><span style="color:blue;">="js/shCore.js"></</span><span style="color:#a31515;">script</span><span style="color:blue;">> <</span><span style="color:#a31515;">script </span><span style="color:red;">type</span><span style="color:blue;">="text/javascript" </span><span style="color:red;">src</span><span style="color:blue;">="js/shBrushJScript.js"></</span><span style="color:#a31515;">script</span><span style="color:blue;">> <</span><span style="color:#a31515;">script </span><span style="color:red;">type</span><span style="color:blue;">="text/javascript" </span><span style="color:red;">src</span><span style="color:blue;">="js/shBrushCSharp.js"></</span><span style="color:#a31515;">script</span><span style="color:blue;">> <</span><span style="color:#a31515;">script </span><span style="color:red;">type</span><span style="color:blue;">="text/javascript" </span><span style="color:red;">src</span><span style="color:blue;">="js/shBrushCss.js"></</span><span style="color:#a31515;">script</span><span style="color:blue;">> <</span><span style="color:#a31515;">script </span><span style="color:red;">type</span><span style="color:blue;">="text/javascript" </span><span style="color:red;">src</span><span style="color:blue;">="js/shBrushJava.js"></</span><span style="color:#a31515;">script</span><span style="color:blue;">> <</span><span style="color:#a31515;">script </span><span style="color:red;">type</span><span style="color:blue;">="text/javascript" </span><span style="color:red;">src</span><span style="color:blue;">="js/shBrushXml.js"></</span><span style="color:#a31515;">script</span><span style="color:blue;">> <</span><span style="color:#a31515;">link </span><span style="color:red;">href</span><span style="color:blue;">="css/shCore.css" </span><span style="color:red;">rel</span><span style="color:blue;">="stylesheet" </span><span style="color:red;">type</span><span style="color:blue;">="text/css" /> <</span><span style="color:#a31515;">link </span><span style="color:red;">href</span><span style="color:blue;">="css/shThemeDefault.css" </span><span style="color:red;">rel</span><span style="color:blue;">="stylesheet" </span><span style="color:red;">type</span><span style="color:blue;">="text/css" /> </span><span style="color:green;"><!-- Include required JS files --> </span><span style="color:blue;"><</span><span style="color:#a31515;">script </span><span style="color:red;">type</span><span style="color:blue;">="text/javascript"> </span><span style="color:#a31515;">SyntaxHighlighter.all() </span><span style="color:blue;"></</span><span style="color:#a31515;">script</span><span style="color:blue;">> </span> 話說~ VSpaste 這個plugin 也很好用~ 跨Blog又不用安裝~ 不過可能支援語系會少一點 以下是使用這個Windows Live Writer Plugin(Windows Live Writer Source Code plugin for SyntaxHighlighter) , 而且也支援最新版本的syntaxhighlighter 3.0.8.3 <!-- Include required JS files --> <script type="text/javascript" src="js/shCore.js"></script>...
繼續閱讀

How to using google reader API on Windows Phone 7.1

Google data is good API tool for C# or other language to connect with Google related service, however here is no official Google Reader API on document. and Google data don’t support for Windows phone (only for Windows mobile for now). However it could be found on web for some of unofficial document for Google Reader API as follows: Unofficial Google Reader API R2 google reader on Google code pyfeed on Google code But however to come out detail implement for Windows Phone, it quit need time to work detail. Allow me try to list some major problems of this. Most important of using HttpWebRequest is the error repose > > The remote server returned an error: NotFound > > It is most common error code your will find during you try to login or get any feedback on Window Phone. It could be either you missing your GET parameter...
繼續閱讀

About Metro app Suspend/Resume and system sleep/Hibernate

According to Metro Application Lifetime sample and related document, it description about Metro app about suspend/resume. However, I also find I could not make my Metro app enter suspend mode, so I try to figure out some answer from MSFT forum. Refer here and here. Here is my summary for this: When leave app about 5 sec or trigger another app about 5 sec, the “suspend” event will called. “Suspends”/”Resume” event will trigger automatically when you not attach debugger on release build. See “Star without Debugging” on “debug” tab. If you using debugger, you only trigger “suspend” manually. Sleep/Hibernate will trigger “Suspend” if your app is release version without debugger attach.
繼續閱讀

HOW TO COMMUNICATE BETWEEN METRO UI AND DESKTOP UI ON WIN8 (part2)

From last article “HOW TO COMMUNICATE BETWEEN METRO UI AND DESKTOP UI ON WIN8”, it talking about to pass the control between Metro/Desktop application. However during programing on Metro and Desktop, you might need some communication mechanism for Metro/Desktop application. I just provide my experience for this kind of question, here is my solution for communicate between Metro and Desktop on Win8 Customer Preview.  (I also feedback on MSFT forum here) Write a application to listen TCP as information center which call “DesktopSvr” (ex: here) Metro app try to send message to localhost via streamsocket (P.S. localhost is not work, but 127.0.0.1 work well). “DesktopSvr” will pass desktop app via IPC or anyway you familiar. Metro application communication guidline: Desktop might also pass some data to “DesktopSvr” it will be our information center. Metro: Since Metro UI will not get any TCP feedback if app under suspends, so communicate between...
繼續閱讀

How to communicate between Metro UI and Desktop UI on Win8

It just a summarize to explain MSFT sample: Association launching sample. Metro UI to call Desktop UI File extension call: Add default open on registry if you want create new one. [HKEY_CLASSES_ROOT.XXX] Using Windows.System.Launcher.launchFileAsync Protocol call: (such as “http://”, “mailto://”) Add default protocol on registry if you want create new one. [HKEY_CLASSES_ROOT%PROTOCOL%] [HKEY_CLASSES_ROOT\%PROTOCOL%DefaultIcon] @=”C:\Program Files\XXX.exe,0”[HKEY_CLASSES_ROOT\%PROTOCOL%shell] @=”play” [HKEY_CLASSES_ROOT\%PROTOCOL%shellopen] @=”” [HKEY_CLASSES_ROOT\%PROTOCOL%shellopencommand] @=”“C:\Program Files\XXX.exe” %1” [HKEY_CLASSES_ROOT%PROTOCOL%shellplaycommand] @=”“C:\Program Files\XXX.exe” %1” * Using Windows.System.Launcher.launchUriAsync P.S.: Since it is Async, please note you might need handle it well to make it work. :) Metro UI to call Desktop UI * File extension call * Add on “package.appxmanifest” “Declarations” to add “Protocol”. * Handle callback feedback and launch this app. * Double click file on desktop UI. * Protocol call: (such as “http://”, “mailto://”) * Add on “package.appxmanifest” “Declarations” to add “File Type Associations”. (ex: “sampleApp://”) * Handle callback feedback and launch this app. * Type “sampleApp://”...
繼續閱讀