發表文章

目前顯示的是 11月, 2012的文章

[WPF] – Debugging DataBindings

圖片
最近從頭開始學習 WPF 其 DataBinding,那其如何 Dbugging DataBindings 的部份是我之前並沒有接觸過的,那記錄一下以後有需要時就可以拿來使用,以防跟之前一樣都是用土法鍊鋼的方式一直測試到 Binding 成功為止,也不知道那裡有問題. 按照上面所述的部份做設定即可 Debugging DataBindings 了.

[Windows] – Registering an Application to a URL Protocol

有些應用程式可以在 Web 按下 Hyper Link 後會開啟應用程式並傳入參數, 那此部份是如何達成的呢?在此記錄一下, 以防以後有需要時還要再重新找尋資料. Registering the Application Handling the Custom Protocol To register an application to handle a particular URL protocol, add a new key, along with the appropriate subkeys and values, to HKEY_CLASSES_ROOT. The root key must match the protocol scheme that is being added. For instance, to add an "alert:" protocol, add an alert key to HKEY_CLASSES_ROOT, as follows: HKEY_CLASSES_ROOT alert URL Protocol = "" Under this new key, the URL Protocol string value indicates that this key declares a custom protocol handler. Without this key, the handler application will not launch. The value should be an empty string. Keys should also be added for DefaultIcon and shell . The Default string value of the DefaultIcon key must be the file name to use as an icon for this new URL protocol. The string takes the form "path, iconindex" with a maximum length of MAX_PATH. The name of the firs

[MVVM] 初步認識 MVVM 設計模式

圖片
View :其實就是XAML檔,也就是使用者介面,使用者介面設計人員只需要在Blend中進行對它的編輯,並透過Binding來和ViewModel溝通(將DataContext指定為某個ViewModel,以更進一步的與其中的屬性進行Binding)。 ViewModel :顧名思義,ViewModel就是供View使用的Model,透過公開的屬性(public property)給View進行Binding,供其使用。 Model :用來描述資料實體(Entity)的簡單類別(Class),也可以在這邊實作商業邏輯以及與資料庫溝通等資料存取相關的功能。 *注意:上圖中的箭頭是有意義的,上層的物件可以向下存取,但是下層的物件並不會知道上層的東西長什麼樣子,透過此原則,才得以做到乾淨的分層與鬆散藕合。 而這個設計模式能幫我們帶來什麼好處呢? 對程式設計人員(Developer)來說: 1. 程式的階層切分更為乾淨、簡潔 2. 相對減少透過程式進行與使用者介面的互動 3. 可以根據設計期/執行期決定不同的資料來源 4. 程式的撰寫可以完全的與使用者介面上的控制項脫鉤,不需再撰寫使用者控制項的Event Handler 5. 可以完全將設計的重心著重在資料流和商業邏輯,而不需要花費心思在使用者介面和流程   對使用者介面設計人員(Designer)來說: 1. 只需要將心思著重在使用者介面操作的流程使用者介面的呈現方式 2. 可以藉由程式設計人員提供的設計時期資料製作更接近現實的使用者介面 3. 更輕鬆的透過Binding、Behavior和Action就可以實作出整個使用者介面 4. 與控制項的互動一樣只需要透過Binding進行設定,不需要費心在Event Handler上 5. 更輕鬆的透過Blend就進行完所有使用者介面的設計,並輕鬆和程式進行結合   轉貼至 : http://www.dotblogs.com.tw/ouch1978/archive/2011/04/23/introducing-mvvm.aspx

Flex – working with session on BlazeDS

when applying BlazeDS, you might notice that in web.xml, a listener named "flex.messaging.HttpFlexSession" should be inserted. It is how BlazeDS can work with session data. BlazeDS provide several classes which is useful for get access to the session and the HTTP pieces of the session, such as the HTTP servlet request and response. This lets you access HTTP data when you use a Flex application in the context of a larger web application where other classes, such as JSPs or Struts actions, might have stored information. flex.messaging.FlexContext flex.messaging.FlexSession The following example shows a Java class that calls FlexContext.getHttpRequest() to get an HTTPServletRequest object and calls FlexContext.getFlexSession() to get a FlexSession object. By exposing this class as a remote object, you can make it accessible to a Flex client application; you place the compiled class in the WEB_INF/classes directory package myROPackage; import flex.messaging.*; import java.io