三月 14
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 metro app via TCP seems not possible here.
- Metro app only get TCP event when it is remain as alive. (ex: StreamSocket.)
- Metro app only take feedback and response when event register. (ex: SystemTriggerType), so Metro app might need take more pooling query information to our “DesktopSvr”.
- Metro app might not to communicate to another Metro app, it is possible for “Metro A” to pass to “DesktopSvr” and “Metro B” also try to retrival information to “Desktop”.
- Desktop:
- Desktop is easy to communicate with other desktop app via original way.
- Desktop might also need pass information to “DesktopSvr” first, and Metro app will try to get it from “DesktopSvr”.
三月 07
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%\shell\open]
@=”"
[HKEY_CLASSES_ROOT\\%PROTOCOL%\shell\open\command]
@=”\”C:\\Program Files\\XXX.exe\” %1″
[HKEY_CLASSES_ROOT\%PROTOCOL%\shell\play\command]
@=”\”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.
How we use it?
-
To transfer control between Metro/Desktop.
-
To Write a launcher on Metro UI for your desktop application.
-
Express app on Metro UI and Pro app on desktop.
Refer:
二月 17
最近再研究如何寫出一個aggregator, 首先把LINQ跟JSON都看了一下。試著想找出一可以方便在各大相片網站找資料的共通語言,由於codeplex上面有Linq.Flickr這個open source 的library,也開始試著研究。
參考: 使用linq.flickr搜尋相片
Note:
- 由於改WLWPlurk,稱這次機會把手邊平台由VS2008改成VS2010。也裝了Visual Studio Achievements。
- 為了開發快一點也把順手語言改成C#,不過後來發現Linq.Flickr是.Net3.5的~ 竟然也踩到了3.5 與 4.0 不共通的弊病。 所以也在Add reference 卡了一下。
- Flickr user name 不是URL上面的userID 而是user definded 的名字,為了這個我還以為是我安裝有問題~ 認真的trace 下Linq.Flickr去。
二月 15
(copy from my another site)
由於要修改去年寫給自己用的小工具 (WLWPlurk),看到其他在Codeplex上面的人都是用WIX(Windows Installer XML)來做包裝plugin的動作。
所以也去好好的搜尋一下有沒有相關可以用的東西。 由於我自己也不是專業在做Installer的人~ 裡面的一些設定也真的把我搞糊塗,才了解前因後果。還好找到了相關的文件WiX Script for installing Live Writer Plugins,雖然他上面的sample是針對 WIX 2.0,不過我也把它修改過後分享給大家。
希望有需要的人就拿去用吧。
- Install WIX 3.6 from http://wix.sourceforge.net/downloadv3.html
- Setup your path setting to your install path.
- Inser follow code (it should be XXX.WXS)
(refer from http://wlwextensionlearning.blogspot.com/2012/02/windows-live-writer-plugin-how-to.html)
- You might need repace follow string as follows:
- {$Plugin Name$} : your plugin name
- {$InstallGUID$}: A GUID for your installation program
- {$Manufacturer$}: Manufacturer name
- {$PluginGUID$}: A GUID for your plugin
- {$Description$}: A description for your plugin
- {$FILE_ID$}: ID for your binary which need install. (could be multiple file)
- {$FILE_NAME$}: Name for your binary which need install. (could be multiple file)
- {$FILE_Address$}: File address for your binary which need install. (could be multiple file)
- Compiler your WIX source code
- candle XXX.wxs
- light -ext WixUIExtension XXX.wixobj
二月 14
這幾天弄了好久~ 好不容易把Windows Installer XML (WIX) 3.6給搞懂。
等等寫另外一篇來記錄詳細資料,在這裡先請有需要安裝檔的去下載吧。
http://wlwplurk.codeplex.com/releases/52834/download/342411
有任何需要改進的麻煩留言告訴我!!
二月 13
欠了好久~ 總算一口氣把它寫完:
請到這裡下載: http://wlwplurk.codeplex.com/
1. Upgrade code with VS2010.
2. Add login page for change account. Using registry to save your login information.
3. Add post content page to let you modify your plurk before post it.
How to use it:
Just download this binary, extract it and put on your Windows Live Writer plugin folder such as C:\Program Files\Windows Live\Writer\Plugins
This project implement base on two major component:
1. Json.net (http://json.codeplex.com/)
2. NPlurk (http://nplurk.codeplex.com/)
You need plurk API key from http://www.plurk.com/API/ to use this source code.
12月 01

HW-59T - Improving performance with the Windows Performance Toolkit
refer: http://channel9.msdn.com/Events/BUILD/BUILD2011/HW-59T
Note:
- Motivation for performance analysis:
- Performance related to multiple layered impact such as : hardware, OS, other application and process impact.
- Stage of performance improvement:
- Preception –> Measurement –> Analysis.
- It will be back and forth after analysis and re-preception.
- Tool list:
- Trace Capture: Windows Performance Recorder
- Tacce Analysis: Windows Performance Analizer
- Things to look out:
- Don’t assume you know what’s wrong.
- Don’t enable too much instrumentation
- Don’t trace longer than you need.
PLAT-203T Async everywhere: creating responsive APIs & apps
refer: http://channel9.msdn.com/Events/BUILD/BUILD2011/PLAT-203T
Note:
- Async only support on some API:
- XAML, Tile on UI
- GPS and portable debice on Device
- All network and communicate
- Applifetime, Authentication, Crytography on Fundamental
- Await
- Await is a simple way to against async API.
- Await will make the async highest priority and let the compiler know here need to wait the result come back. Code will run as sequencial.
- Error handling
try {
FileOpenPicker p = new FileOpenPicker();
p.FileTypeFilter.Add(”.jpg”);ry
var operation = p.PickSingleFileAsync();
operation.Completed = (IAsyncOperation<StorageFile> f) =>
{
MyButton.Content = f.GetResults().FileName;
};
operation.Start();
catch(…) {}
- try catch will only cover RED one, it need refine code to cover whole scope
try {
FileOpenPicker p = new FileOpenPicker();
p.FileTypeFilter.Add(”.jpg”);
MyButton.Content =
(await p.PickSingleFileAsync()).FileName;
} catch(Exception e) {}
- It will separate into “RED” and “Green” one but still cover on try catch.
- 5 top tips from presenter.
- Don’t worry about the COM apartment.
- Remember to start your operation.
- File picker cancel != Async Cancel
- It will complete but return NULL.
- “use exception for exceptional things”
- Don’t worry about Dispatcher.Invoke…
- Don’t worry about the concurrency
Refer: http://blogs.msdn.com/b/ericlippert/archive/2010/10/29/asynchronous-programming-in-c-5-0-part-two-whence-await.aspx
11月 16

APP-186T - Build advanced touch apps in Windows 8
refer: http://channel9.msdn.com/Events/BUILD/BUILD2011/APP-186T
- Major point of touch app design:
- Unify pen and touch into PointerPoint
- Get mouse and pen for free
- performance performance and performance
- Touch and Gesture support in framework
- Metro app with HTML or XAML—> Gesture event
- ICoreWindow –> Using point (touch simulate mouse click)
- Windows Runtime –> PointerPoint with GestureRecognizer
- PointerPoint:
- Whole related point implement is here, HID data also can get using PointerPoint.
- GestureRecognizer:
- It just like the Win7 multiple touch support on MSFT, it support kind of gesture such as:
- Tap, Hold, rotate and Scale
- But more support on Win8 such as:
- HoldWithMouse?
- RightTap
- To simulate with right click on mouse, such your finger about right click here.
- mmmm….. it should be MSFT patent here for right click.
- For desktop developer, MSFT also support full Windows Runtime about Gesture support –> Great!
- WM_Point –> the same as usual
- InteractionContexts –> mirror GestureRecognizer. Don’t forget WM_TOUCH and WM_GESTURE still support here.
- Pointer device –> identify source device (touch panel, mouse or other.)
11月 09

It need note that Windows 8 has two version of IE (it should say, one application but two entry for different mode)
But it is very tricky, if you type “open http://Web” on desktop explorer will open “Metro IE”
When you try to use this command to open web side, please note metro browser will be default option, not desktop browser.
ShellExecute(NULL,TEXT(”open”), TEXT(”http://msdn.microsoft.com”), TEXT(”"),NULL,SW_SHOWNORMAL);
To specific using desktop browser, it should specific command on [HKEY_CLASSES_ROOT\http\shell\open\command]
Recent Comments