2009年11月11日

Silverlight Unloaded Event & ZIndex


Silverlight 有一個問題,就是沒有提供 Unloaded Event,
如果你設計了一個 UserControl 並在 Loaded 中加入了 event
那麼這個 UserControl 若移出 Parent 後再加入,
就會再呼叫一次 Loaded,而 event 便再增加一次。

因此,圖形物件的 layer 在進行變更時,
要記得利用 Canvas.SetZIndex 來處理,
而不要用 Panel.Children.Remove() 及 Panel.Children.Add().

2009年11月2日

Rich Internet Application Market Share


因為訂閱了 Google Blog 有關 Silverlight 的快訊,
收到了 Kimo Chung's AS3 Playground: Why Silverlight? um, I don't know.
這篇文章,
也因此發現了有關 RIA 市場占有率的現況,
提供大家分享。

Silverlight 全世界的安裝比例,大約為 29%,
台灣的安裝比列則是41%。



[Reference]
Rich Internet Application Statistics
Rich Internet Application Market Share

2009年10月29日

Silverlight Game Loop

撰寫遊戲程式,經常需要利用 main loop 處理一些工作。
以下是 Silverlight 使用 loop 的方法。
public Page()
{    
    InitializeComponent();
    CompositionTarget.Rendering += new EventHandler(SnowFlakeTimer);
} 

private void SnowFlakeTimer(object sender, EventArgs e)
{
    // do your task    
}

[Reference]
Silverlight Tip of the Day #50 – Main Game Loop Revisited!

Getting Query String Values in Silverlight

Silverlight 可以直接取得網址後面的參數,
方法如下:
string val = System.Windows.Browser.HtmlPage.Document.QueryString["foo"];

[Reference]
Getting Query String Values in Silverlight

2009年10月28日

Silverlight TextBox 斷行處理

下列的範例,可以將 TextBlock.Text 所取得的字串, 拆解成字串陣列。

string text = TheTextBox.Text;
text = text.Replace(Environment.NewLine, "\r");
string[] texts = text.Split(new char[] { '\r'  });

2009年10月27日

SyntaxHihglighter Test

為了讓程式碼看起來更整潔, 試了一下 SyntaxHihglighte, 有興趣的人可以到官網取得相關資訊。
不過為了讓 blogger 不要自動加入換行, 之前的程式碼卻變得更零亂了。
function test() : String
{
  return 10;
}

Deploying Vue & .NET with Google OAuth on GCP Cloud Run

Deploying Vue & .NET with Google OAuth on GCP Cloud Run Deploying Vue & .NET with Google OAuth on GCP Cloud Run...