Skip to content

Commit

Permalink
话题页面
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Mar 3, 2012
1 parent 310758a commit 2dc615b
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 8 deletions.
2 changes: 1 addition & 1 deletion BoardPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<Button x:Name="LoadMore" Content="载入更多" Click="LoadMore_Click"/>
<Button Margin="-12 0" x:Name="LoadMore" Content="载入更多" Click="LoadMore_Click"/>
</StackPanel>
</ScrollViewer>
</Grid>
Expand Down
7 changes: 0 additions & 7 deletions SampleData/CurrentBoardViewModelSampleData.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@
<local:CurrentBoardViewModel.Topics>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="20" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="13" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="14" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
</local:CurrentBoardViewModel.Topics>

</local:CurrentBoardViewModel>
23 changes: 23 additions & 0 deletions SampleData/CurrentTopicViewModelSampleData.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<local:CurrentTopicViewModel
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:sbbs_client_wp7"
xmlns:sbbs="clr-namespace:sbbs_client_wp7.Sbbs"
Board="C_CPlusPlus"
Title="8G的U盘现在的市场价是多少?">

<local:CurrentTopicViewModel.Topics>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="20" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="13" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="14" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
<sbbs:TopicViewModel Title="江南听雨BBS技术站务2011年下半年总结" Author="moqi88" Board="BBSView" Id="43647" Replies="10" Read="100" Top="False" Mark="False"/>
</local:CurrentTopicViewModel.Topics>

</local:CurrentTopicViewModel>
70 changes: 70 additions & 0 deletions TopicPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<phone:PhoneApplicationPage
x:Class="sbbs_client_wp7.TopicPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
shell:SystemTray.IsVisible="True"
toolkit:TiltEffect.IsTiltEnabled="True"
d:DataContext="{d:DesignData SampleData/CurrentTopicViewModelSampleData.xaml}">

<shell:SystemTray.ProgressIndicator>
<shell:ProgressIndicator Text="载入中..."
IsVisible="{Binding IsLoaded, Converter={StaticResource BoolReverseConverter}}"
IsIndeterminate="{Binding IsLoaded, Converter={StaticResource BoolReverseConverter}}"/>
</shell:SystemTray.ProgressIndicator>

<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="BoardName" Text="{Binding Board}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="BoardDescription" Text="{Binding Title}" TextWrapping="Wrap" Margin="9,-7,0,0" Foreground="{StaticResource PhoneAccentBrush}" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
</StackPanel>

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"></Grid>
</Grid>

<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/new.png" Text="回复"/>
<shell:ApplicationBarIconButton IconUri="/Images/refresh.png" Text="刷新"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
23 changes: 23 additions & 0 deletions TopicPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace sbbs_client_wp7
{
public partial class TopicPage : PhoneApplicationPage
{
public TopicPage()
{
InitializeComponent();
}
}
}
96 changes: 96 additions & 0 deletions ViewModels/CurrentTopicViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Collections.ObjectModel;

namespace sbbs_client_wp7
{
using Sbbs;

public class CurrentTopicViewModel : INotifyPropertyChanged
{
private string board;
private string title;
private bool isLoaded;
private ObservableCollection<TopicViewModel> topics;

public string Board
{
get
{
return board;
}
set
{
if (board != value)
{
board = value;
NotifyPropertyChanged("Board");
}
}
}

public string Title
{
get
{
return title;
}
set
{
if (title != value)
{
title = value;
NotifyPropertyChanged("Title");
}
}
}

public ObservableCollection<TopicViewModel> Topics
{
get
{
return topics;
}
set
{
if (topics != value)
{
topics = value;
NotifyPropertyChanged("Topics");
}
}
}

public bool IsLoaded
{
get
{
return isLoaded;
}
set
{
if (isLoaded != value)
{
isLoaded = value;
NotifyPropertyChanged("IsLoaded");
}
}
}

public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (null != handler)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
12 changes: 12 additions & 0 deletions sbbs-client-wp7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,16 @@
<Compile Include="Tile.xaml.cs">
<DependentUpon>Tile.xaml</DependentUpon>
</Compile>
<Compile Include="TopicPage.xaml.cs">
<DependentUpon>TopicPage.xaml</DependentUpon>
</Compile>
<Compile Include="ValueConverters\BoardValueConverter.cs" />
<Compile Include="ValueConverters\BoolConverter.cs" />
<Compile Include="ValueConverters\RepliesHotConverter.cs" />
<Compile Include="Sbbs\BoardViewModel.cs" />
<Compile Include="Sbbs\TopicViewModel.cs" />
<Compile Include="ViewModels\CurrentBoardViewModel.cs" />
<Compile Include="ViewModels\CurrentTopicViewModel.cs" />
<Compile Include="ViewModels\MainViewModel.cs" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -114,10 +118,18 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</DesignData>
<DesignData Include="SampleData\CurrentTopicViewModelSampleData.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</DesignData>
<Page Include="Tile.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TopicPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
Expand Down

0 comments on commit 2dc615b

Please sign in to comment.