星期六, 12月 29, 2007

Another 3rd Party WPF Controls : Infragistics


我又藉由一些文章 找到另一家3rd party的WPF controls

而且好像這家也十分有名 叫Infragistic

我也找到他們有做Ribbon的Solution

http://www.infragistics.com/uploadedImages/WhatsHot/xamRibbonCtpScreenshot.jpg

有興趣參考以下link吧..

http://www.infragistics.com/hot/wpf-beta.aspx#xamRibbon


Powered by ScribeFire.

Smart Routed Commands in WPF


這次從Minneapolis回來~ 我學到了許多有關Command System的一些設計與概念

覺得十分好... 也一直在反覆比較我們之前程式的架構.... 他們設計的方法與架構 真的是比較好的方法

然後我再回到WPF Command System....我又卡住了... 是二個截然不同的概念....


Design Pattern裡講的Command十分淺顯.. 但也還不夠複雜到應付中大型的Application

我看到的Command System比較偏向是Design Pattern裡寫的 將所有的operation寫在Command裡...

而每一個Command 會有自己所對應到的Execution的Context

WPF就不太一樣... 每一個Command 都是一個RoutedEvent 會藉由Bubbling的方法(由下而上) 讓Visual Tree自己決定是否執行

執行的operation也都散布在各位Visual Element裡

從比較high level的面向來看~~ 一個Visual Element也可以是所謂的Execution Context 是十分General的看法....


我在codeproject找到一篇 作者寫了一個Smart Routed Command 這樣的方法 其實就有種mix兩種方法的味道

看完文章之後 我對Command的疑惑又進了一步.... 不過還有一大段還是需要再多想多努力

Software Design 對我而言就好像練太極拳或是在修內功一樣....... 一分力一分功 永無止盡....Orz

CodeProject: Smart Routed Commands in WPF. Free source code and programming articles



Powered by ScribeFire.

WPFpedia actipro提供的一些WPF的資源


我剛玩完他們所有的WPF Control & Demo...

Impressed!!! 其實之前有嘗試要寫Ribbon這類的Control....

後來分析的結果覺得好像有點複雜 就沒繼續下去了 可是我卻發現他們寫的很好!!!!

然後我看他們的Transition Effect也Support好多種~~ 我之前寫的大概只support到五六種而已


也看到他們collect不到的WPF Resource放在WPFpedia.com裡~~ 所以也記一下 我會繼續挖寶

有不錯的再記上來囉...


WPFpedia.com (The WPF Resource Guide)

Powered by ScribeFire.

[WPF] Actipro WPF Studio


很久沒寫些WPF相關的東西了~~

最近又開始在看一下Blog~~ 終於看到一些我覺得早該有的東西了...

就是3rd Party的WPF Control.....

這次我看到的是有WPF Ribbon & Wizard....

有興趣到下面的link看看吧...:p

我一開始已經寫了一個Wizard的東西了~~ 也有Transition Effect

這個Library也有implement一些相關的概念.....




我下載了Free Evaluation來看~~ Ribbon讓我十分驚豔....




Actipro WPF Studio - The ultimate UI control suite for WPF



Powered by ScribeFire.

The New Iteration.... Designer如何跟Engineer合作


XAML在WPF扮演很關鍵的角色~~ 而XAML的引進 造成以往RD與Designer之間的合作更加緊密

這邊有一本書 (or whitepaper) 在敘述這樣的事情

工作一二年來也碰了這方面的事 也深深覺得真的還蠻不錯的...

可惜現在的WPF Performance實在是一大敗筆 .... 不過managed code與unamanged code或許一起比較performance有點不公平吧

The New Iteration: How XAML Transforms the Collaboration Between Developers and Designers in Windows Presentation Foundation (WPF)

Powered by ScribeFire.

星期三, 11月 21, 2007

Code Generation, Software Factories and Visual Studio Extensibility


我對automatically的Code Generation一直都很有興趣.....

在C# with Visual Studio .net 其實應該有能力可以做到了....

好像是叫CodeDom的東西吧..... 之前組讀書會的時候 也有同事報過一樣的主題

雖然我還沒有時間好好去試..... 不過先記錄下來 發現這一篇blog也有蠻有詳盡的references


------------------------------------------------------------------------------------------------------------------------------------



Last night I presented Code Generation, Software Factories and Visual Studio Extensibility at Direct Supply. Below is the project download with all of the source followed by many useful links related to the various topics.


[ Download the sample project: SmallSharpTools.VisualStudioPlugins.zip ]



CodeDom



Templated Code Generation



Software Factories



Visual Studio Extensibility



Video



If you have any other links that you feel are useful, please add them below in the comments.





Powered by ScribeFire.

星期三, 11月 14, 2007

Visual Studio Debugger Visualizer for WPF Visual Tree



Visual Studio 2005有一種Visualizer Plugin的功能 可以自己撰寫對於特種的Data Type的視覺化的表現

而這篇Codeproject的作者 做出了一個VS2005 Visualizer 可以Show出WPF Element的Visual Tree的元件

十分好用~~

而我也稍微改了一下code....做了另一個Logical Tree的版本..... 現在我可以輕鬆地在VS2005 IDE裡 很容易了解Visual/Logical Tree的樣子了


Woodstock for WPF - The Code Project - Windows Presentation Foundation



Powered by ScribeFire.

星期一, 11月 05, 2007

Over-coming the Interop Airspace Issue in WPF


我只能說.... 對於host的handle-based control到WPF裡

雖然不滿意 但可以接受~~

但事實上 我也從未奢想這件事是有辦法達成的


但跟上一篇同一個作者居然實作出來了... 我只能說 真的太厲害了~~~

不過目前除了有一些bugs之外 其實十分耗資源... 可能沒辦法當成是一個比較formal的解法


Over-coming the Interop Airspace Issue in WPF


看到了吧.... 下面的圖就是把一個Broswer Control貼到一個WPF 3D Model上.....

這是一個很厲害的技法....也宣告WPF基本上解除所有的限制封印了....





Powered by ScribeFire.

Build your own DirectShow Graph in WPF MediaElement



對於WPF的MediaElement 我已經苦思許久 不得其解

對於一家Playback or Video Editing的公司 MediaElement是個完全沒辦法使用的東西

而Microsoft也未提供任何更進階的控制項 讓我們來使用 甚至連我們想自行開發都不太容易

再過幾天剛好會跟Microsoft的人一起開會... 我想趁這個機會好好再問他們一下 有沒有什們suggestion or future plan


不過在上星期我已經找到一篇Blog能達到我想做的事了... 以下兩篇

WPF - Hackery! Part I

WPF - Hackery! Part II


第一篇主要是演示拉一個MediaElement 然後自己建一個Capture的Graph,於是可以看到MediaElement也可以秀出Capture的畫面了

真的很厲害 :-)..... (要run sample前記得 register那個DirectShow Filter哦.... regsvr32 xxxx.ax)

This webcam makes me look greasy!


This is a live webcam brought into WPF using my MediaBridge hack. I swear I don't look that greasy IRL.


WPF Modified Graph



Powered by ScribeFire.

星期五, 10月 12, 2007

WPF Book Control


之前我曾經有用過Flash or 一些作法 來做幾本電子書.........

之前的SilverLight也有一個demo叫Page Turn也蠻炫的


不過今天才發現這本Pure WPF的Book Control

這本才真的比較棒~~ 翻頁不是四四角角的 而是有點柔軟的感覺

裡面可以放一大堆Control, 3D Object, Video, ...etc 應有盡有

而且還有Full Source

還真的不錯 值得一看....







Powered by ScribeFire.

Routed Events In WPF


今天在解一個Bugs.... 就發現先前設計的一個Control有一些功能沒有想的很完善.......

於是又重新再思考了一下..... 發現自以為對WPF裡的Routed Event, 包括三種方式Tunnel, Bubble, 與Direct很熟悉

以為已經掌握到訣竅 但是因為之前的設計不完善 怎麼想就是想到一些漏洞

直到看到下面的兩種Add Handler的方法 我才恍然大悟.... 我未曾懂過....

也難怪WPF的Controls的Event機制並沒有照著普通的.Net的event or delegate方法 而是還有什麼AddHandler, ...etc之類的東西

就是為了要Support Routed Event


全文可以再參考一次msdn WPF Event

唔.... 沒有一直持續設計與思考 我還真的沒發現自己沒真正懂過.....

Design的路還很長.......


C# Method1-------------------------------------------------
void MakeButton()
{
Button b2 = new Button();
b2.AddHandler(Button.ClickEvent, new RoutedEventHandler(Onb2Click));
}
void Onb2Click(object sender, RoutedEventArgs e)
{
//logic to handle the Click event
}

The next example shows the C# operator syntax
(Microsoft Visual Basic .NET has slightly different operator syntax
because of its handling of indirection):

C# Method2-------------------------------------------------

void MakeButton2()
{
Button b2 = new Button();
b2.Click += new RoutedEventHandler(Onb2Click2);
}
void Onb2Click2(object sender, RoutedEventArgs e)
{
//logic to handle the Click event
}


Powered by ScribeFire.

星期一, 10月 08, 2007

GeekInterview


之前我有一個朋友很喜歡蒐集各類很Tricky的小問題 因為現在國外大型公司很喜歡問這些Tricky的問題

例如如何Swap一個Varaible不用記憶體啦~~ 或是...etc

比較偏程式的方面 或許我還有機會可以答的出來..... 但是如果是一些思考性的問題 我幾乎答對率都很低

像是三個燈泡在一間房子裡與外面有三個開關 你可以先在外面動三個開關 (開或關) 然後只能進房子一次 就要決定那一個開關是那一個燈泡

像這類的問題 我幾乎都答不出來 @@||

所以發現網上有一個site在整理這些東西~~ 所以覺得以後如果要面試一些會考這類問題的大公司 還是多多蒐集題庫可能比較保險

:-)


Link --> IT Interview Questions Open Database - GeekInterview.com

Powered by ScribeFire.

Marshaling Nested Data Structures


C++ & C#之間的Interop有許多方式,或是workaround

一個是C++/CLi, 一直是把C++ Class轉成Regular C,然後用Platform Invoke的方式,另一個是把C++包成COM

不過不論如何 都有可能會遇到可以傳遞Structure的問題 上一篇就是基本的Sample

但是Structure可能複雜到Nested怎麼辦.........找到了一篇Blog (Marshaling Nested Data Structure from jaredpar's WebLog)在描述如何解決


看完之後~~ 只能說 真的很麻煩!!!!


Powered by ScribeFire.

Code Snippets : Interop between C# & C++ (Managaed & Unmanaged)


雖然知道用法 卻每次都背不起來~~ 所以特別把關鍵的Sample Code Paste到Blog

以後查詢也會比較方便.....

主要是C++ & C#之間structure該如何傳遞

Source From MSDN

在下列程式碼中,建立了 Managed 結構,將其傳輸到 Unmanaged 記憶體後,再使用 PtrToStructure 方法傳輸回到 Managed 記憶體。
using System;
using System.Runtime.InteropServices;

public struct Point
{
public int x;
public int y;
}

class Example
{

static void Main()
{

// Create a point struct.
Point p;
p.x = 1;
p.y = 1;

Console.WriteLine("The value of first point is " + p.x + " and " + p.y + ".");

// Initialize unmanged memory to hold the struct.
IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(p));

try
{

// Copy the struct to unmanaged memory.
Marshal.StructureToPtr(p, pnt, false);

// Create another point.
Point anotherP;

// Set this Point to the value of the
// Point in unmanaged memory.
anotherP = (Point)Marshal.PtrToStructure(pnt, typeof(Point));

Console.WriteLine("The value of new point is " + anotherP.x + " and " + anotherP.y + ".");

}
finally
{
// Free the unmanaged memory.
Marshal.FreeHGlobal(pnt);
}



}

}
在下列程式碼中,示範了如何使用 PtrToStructure 方法,將記憶體的 Unmanaged 區塊封送處理成 Managed 結構。




Powered by ScribeFire.

星期六, 9月 22, 2007

Convert Position between WPF Controls & Screen



Lester's WPF blog : Code for getting screen relative Position in WPF
這幾天一直在try Windows Vista的Gagdget.... 中秋連假還一直在加班 :-(

最後有一個major bugs就是卡在這裡~~ 超麻煩的 不過還好給我找到了....

呵~


Powered by ScribeFire.

Transparent WPF Control over Unmanaged Window Handle



Transparent WPF control over unmanaged window handle - Just code - Tamir Khason

之前在合作一個case 好像我就有使用過這樣的技法~~ 不過這個link比較簡單...:p


Powered by ScribeFire.

星期一, 9月 17, 2007

DirectX-base UI : Become windowless


viksoe.dk - UI: Become windowless


晚上在研究VMR的時候~~~ 突然發現這個網站~~ 看完我真是驚為天人...而且還附上sample program & source code

一套UI Library/Control Set based on DirectX

我被他的Sample Program驚豔到了~~ 因為我還真有點分不出這不是Traditional SDK Controls,而是用DirectX寫的

wow~~ WPF好像沒他的performance那麼好~ 跑的很順很快 ..... 有稍微大概研究了一下source code 算是蠻完整的.....

:D

等我有空 一定要好好研究一番.....


Powered by ScribeFire.

星期六, 7月 21, 2007

Introduction to Boost Function

為了要在C++裡實現delegate/event 所以我自己寫了一個Functor的class

不過為了未來使用的方便,最好是找一個library來用

所以我選了boost的function來研究

以下列出一些tutorial給大家參考一下 ................


Boost源码剖析:C++泛型函数指针类

Boost.Function的基本使用

Chapter 6. Boost.Function

functor 還是 boost 的好用

functor 還是 boost 的好用 (續)


星期四, 7月 19, 2007

利用C++ Functor實現.Net的delegant/event



在C++中實現.NET風格的委託-開發者網路-C++-天極Yesky

CALLBACKS IN C++ USING TEMPLATE FUNCTORS

http://www.codeproject.com/cpp/#Delegates

A new way to implement Delegate in C++

最近為了一些原因,又得重新再檢視一次Design Pattern。

大多的Patterns我已經是滾瓜爛熟的.... 但是說真的每一個Pattern都有在用嗎?

其實我也覺得沒那麼常用~~ 有些Pattern知道十分強大,但是實作起來就沒那麼方便 或是真的很麻煩....


這次又重看一次Observer...... 很常見的Pattern,但是C++ implement起來就是得繼承來繼承去

但是近一年來我都是用C#,我用C#的event/delegant可以很輕易的不用繼承解決Observer的東西

於是我重回到C++思考.....  想到之前有人跟我說functor的概念~~~ 我一直以為就是function object

就是在STL裡 能夠customize 不用演算法的行為~~ 這樣的作法已經很厲害了....


沒想到Functor的確可以實現出類似C# event/delegant的概念~~~

所以貼上來給大家參考一下 :-)

(第二篇是1994年寫的.....也太神奇了~~ 那些code VC6有辦法compile嗎? 我到2007才準備開始用..)


星期一, 7月 16, 2007

UML 工具比較分析


這陣子在Survey UML Modelling的工作

有看到的是Visual Paradigm,有朋友說他們用的是Jude,還有說是IBM RSA,

又看到網路上一些比較

http://www.kenming.idv.tw/index.php?title=uml_amya_mam_ef_a_a&more=1&c=1&tb=1&pb=1

先列出來 我慢慢把這篇整理完整

Powered by ScribeFire.