Skip to content

Instantly share code, notes, and snippets.

@kongliangzhong
Created March 27, 2013 02:38
Show Gist options
  • Save kongliangzhong/5251129 to your computer and use it in GitHub Desktop.
Save kongliangzhong/5251129 to your computer and use it in GitHub Desktop.
windows phone 8 dev in c#
C#:
1) output debug info in console:
System.Diagnostics;
...
Debug.WriteLine("");
2) a regex that matchs html link:
var regEx = new Regex(
//@"\<a\s(href\=""|[^\>]+?\shref\="")(?<link>[^""]+)"".*?\>(?<text>.*?)(\<\/a\>|$)",
@"\<a\s(href(\s)*\=(\s)*"")(?<link>[^""]+)"".*?\>(?<text>.*?)(\<\/a\>|$)",
//@"(<a\s[^>]*href=")(.*?)("[^>]*>).*?(</a>)",
//@"#(<a[^>]*?)$filter_string(.*?)<\/a>#s",
RegexOptions.IgnoreCase | RegexOptions.Multiline);
3) decode utf8 string:
string decodeStr = System.Text.RegularExpressions.Regex.Unescape(utf8Str);
XAML:
1) define a BitmapImage and Image
<x:String x:Key="SubscribeButtonImageUri">/WeiboSubscribe;Assets\e113.png</x:String>
<BitmapImage x:Key="SubscribeButtonImageSource" UriSource="SubscribeButtonImageUri"/>
<Image Source="Assets\e113.png" />
windows phone 8:
1) WebBrowser.InvokeScript error, code: 80020006
cannot find javascript function. wait for page load completed.
You'll get the 80020101 error if the javascript method can't be found or th JS throws an error
2) as System.Diagnostics.Debug.Writeline("") can not write to output, use
System.Diagnostics.Debugger.Log(4, "info", "msg") instead.
3)Error HRESULT E_FAIL has been returned from a call to a COM component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment