天氣預報的部分代碼公佈到了博客後,很多網友就要求喜歡能下載到整個項目。昨天早上把源代碼傳到了csdn,晚上寫了一篇博文介紹序列化谷歌數據的工具類,順便把整個項目的源代碼下載地址加上了。
很多網友反映csdn的積分問題,在此把下載地址更新一下。
天氣預報源代碼(一):http://www.cnblogs.com/wildfeng/archive/2012/03/21/2410504.html
wp7天氣預報源代碼(二)公佈源代碼下載地址:http://www.cnblogs.com/wildfeng/archive/2012/03/24/2415327.html
新下載地址:http://download.csdn.net/detail/wildfeng04/4170526(無需積分)
原下載地址:http://download.csdn.net/detail/wildfeng04/4168595
因爲我最新版本1.5已經在csdn上傳過了,系統不讓我再傳。不管是重新壓縮還是更改名字還是新建文件夾都沒法跳過。(csdn過濾太嚴了 - -)
我新上傳了1.4版本,有些小BUG,不過不影響整體,通過此鏈接下載無需積分。
在此鄭重聲明一下,csdn是我第一個接觸的技術交流社區,我寫的源代碼只會傳到csdn的資源裏和大家分享。但我也需要積分去下載別人的資料,我也只會在csdn裏下載,別的地方都不知道。申請的csdn的號用不了5分鐘吧,隨便一個新號都能下載的,希望大家都能有消費精神,積分又不是人民幣。
下面我順便介紹一些UI方面的代碼吧。
設計UI,用Blend最爲適合了。學siliverlight的時候初次解除Blend,感覺很多地方跟flash很像。以前就有點flash的底子,對於Blend就沒有感覺到那麼難了。
此空間的文檔大綱可以很清晰得看出,這是由一個三行一列的佈局表格組成,行高分別爲46*、100*、30。每一行中各有一個控件。代碼如下:
UserControl標籤就是指用戶自定義控件。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<UserControl mc:Ignorable= "d" x:Class= "Weather.ForecastTile" d:DesignWidth= "120" d:DesignHeight= "170" > <Grid
x:Name= "LayoutRoot" > <Grid.RowDefinitions> <RowDefinition
Height= "46*" /> <RowDefinition
Height= "100*" /> <RowDefinition
Height= "30" /> </Grid.RowDefinitions> <Grid.Background> <ImageBrush
Stretch= "Fill" ImageSource= "/Weather;component/UserControl/forecast_tile.png" /> </Grid.Background> <TextBlock
Name= "txtWhichDay" HorizontalAlignment= "Center" VerticalAlignment= "Bottom" Text= "今天" Foreground= "White" FontFamily= "Segoe
WP Bold"
FontSize= "32" Grid.Row= "0" /> <Image
Name= "imgWeathericon" Margin= "0,0,0,0" Source= "/Images/forecasts/day/sunny.png" Grid.Row= "1" Stretch= "Uniform" /> <TextBlock
x:Name= "txtTemperature" Grid.Row= "2" Foreground= "White" FontSize= "20" HorizontalAlignment= "Center" VerticalAlignment= "Top" FontFamily= "Arial" Text= "-13°/-15°" /> </Grid> </UserControl> |
然後在寫好此控件的屬性器,那麼自己做的控件就弄好了。用法就跟微軟工具箱裏面的控件一個用法了,就不用多說了。
代碼如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
public partial
class
ForecastTile : UserControl { public ForecastTile() { //
爲初始化變量所必需 InitializeComponent(); } public ImageSource
Weathericon { get {
return imgWeathericon.Source;
} set {
imgWeathericon.Source = value; } } public string
WhichDay { get {
return txtWhichDay.Text;
} set {
txtWhichDay.Text = value; } } public string
Temperature { get {
return txtTemperature.Text;
} set {
txtTemperature.Text = value; } } } |
這個控件因爲是靜止的,我沒有做任何動態的效果,沒有做Storyboard。以後的文章會詳細講這個地方。我第一次接觸的時候感覺跟flash裏面的時間軸類似,可以製作影片剪輯。
4月中旬就要考試了,沒多少時間可以寫博文了,得抓緊學習了。