summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2013-03-29 14:30:06 +0400
committerGravatar Vitaly Takmazov2013-03-29 14:30:06 +0400
commit32fc287a28c24ca980f4fe67ccab178c04cd9159 (patch)
treed1529dc0a60eca2032d55b8a7c68b5687f40ed83 /Juick
parentd8877eea3c619fe3d0228dbff2693a582e85fc6e (diff)
move message list markup to MessageList usercontrol
Diffstat (limited to 'Juick')
-rw-r--r--Juick/App.xaml.cs3
-rw-r--r--Juick/Controls/MessageList.xaml70
-rw-r--r--Juick/Controls/MessageList.xaml.cs22
-rw-r--r--Juick/Juick.csproj11
-rw-r--r--Juick/MainPage.xaml135
5 files changed, 108 insertions, 133 deletions
diff --git a/Juick/App.xaml.cs b/Juick/App.xaml.cs
index 8a1de0b..194e6fe 100644
--- a/Juick/App.xaml.cs
+++ b/Juick/App.xaml.cs
@@ -47,7 +47,8 @@ namespace Juick
private static RestClient _cl;
public static RestClient Client
{
- get { return _cl ?? (_cl = new RestClient("http://api.juick.com") { UserAgent = "Juick 0.999/Windows Phone " + Environment.OSVersion.Version }); }
+ get { return _cl ?? (_cl = new RestClient("http://api.juick.com") {
+ UserAgent = "Juick 0.999/Windows Phone " + Environment.OSVersion.Version }); }
}
/// <summary>
diff --git a/Juick/Controls/MessageList.xaml b/Juick/Controls/MessageList.xaml
new file mode 100644
index 0000000..7a5882f
--- /dev/null
+++ b/Juick/Controls/MessageList.xaml
@@ -0,0 +1,70 @@
+<UserControl x:Class="Juick.Controls.MessageList"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:bindings="clr-namespace:Juick.Classes"
+ xmlns:usercontrols="clr-namespace:Juick.Controls"
+ xmlns:converters="clr-namespace:Juick.Converters"
+ mc:Ignorable="d"
+ FontFamily="{StaticResource PhoneFontFamilyNormal}"
+ FontSize="{StaticResource PhoneFontSizeNormal}"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ d:DesignHeight="480" d:DesignWidth="480">
+ <UserControl.Resources>
+ <converters:MidToUriConverter x:Key="uriConverter" />
+ </UserControl.Resources>
+
+ <Grid x:Name="LayoutRoot">
+ <ScrollViewer>
+ <ItemsControl Margin="0, 0, -12, 0"
+ ItemsSource="{Binding Items}"
+ bindings:ScrollViewerMonitor.AtEndCommand="{Binding LoadMessagesPageCommand}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <HyperlinkButton NavigateUri="{Binding MID, Converter={StaticResource uriConverter}}">
+ <HyperlinkButton.Template>
+ <ControlTemplate>
+ <Border BorderBrush="{StaticResource PhoneForegroundBrush}" BorderThickness="0 0 0 1">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Image bindings:LowProfileImageLoader.UriSource="{Binding AvatarUri}" Grid.Row="0" Grid.Column="0" Margin="3" />
+ <TextBlock Text="{Binding Username}" Grid.Row="0" Grid.Column="1"
+ Margin="5,0,5,5" VerticalAlignment="Top"
+ HorizontalAlignment="Left"
+ FontFamily="{StaticResource PhoneFontFamilySemiLight}"
+ FontSize="{StaticResource PhoneFontSizeLarge}"
+ Style="{StaticResource PhoneTextAccentStyle}" />
+ <!--Style="{StaticResource PhoneTextNormalStyle}"-->
+ <usercontrols:HyperLinkRichTextBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
+ TextWrapping="Wrap" HorizontalAlignment="Left"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ Margin="5,0,5,5" VerticalAlignment="Top"
+ IsReadOnly="True" Text="{Binding MessageText}" />
+ <Image bindings:LowProfileImageLoader.UriSource="{Binding Attachment}" Grid.Row="2" Grid.Column="0" Margin="3" Grid.ColumnSpan="2" />
+ <TextBlock Text="{Binding Status}" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ Style="{StaticResource PhoneTextAccentStyle}"
+ FontSize="{StaticResource PhoneFontSizeSmall}"
+ Margin="5,0,5,5" VerticalAlignment="Top"
+ TextWrapping="Wrap" HorizontalAlignment="Left"/>
+ </Grid>
+ </Border>
+ </ControlTemplate>
+ </HyperlinkButton.Template>
+ </HyperlinkButton>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </Grid>
+</UserControl>
diff --git a/Juick/Controls/MessageList.xaml.cs b/Juick/Controls/MessageList.xaml.cs
new file mode 100644
index 0000000..0b74705
--- /dev/null
+++ b/Juick/Controls/MessageList.xaml.cs
@@ -0,0 +1,22 @@
+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;
+
+namespace Juick.Controls
+{
+ public partial class MessageList : UserControl
+ {
+ public MessageList()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Juick/Juick.csproj b/Juick/Juick.csproj
index 9dd60ae..8e47876 100644
--- a/Juick/Juick.csproj
+++ b/Juick/Juick.csproj
@@ -84,6 +84,9 @@
<Compile Include="Classes\ScrollViewerMonitor.cs" />
<Compile Include="Classes\TileHelper.cs" />
<Compile Include="Controls\HyperLinkRichTextBox.cs" />
+ <Compile Include="Controls\MessageList.xaml.cs">
+ <DependentUpon>MessageList.xaml</DependentUpon>
+ </Compile>
<Compile Include="Converters\MidToUriConverter.cs" />
<Compile Include="LoginView.xaml.cs">
<DependentUpon>LoginView.xaml</DependentUpon>
@@ -107,6 +110,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
+ <Page Include="Controls\MessageList.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="LoginView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -115,10 +122,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
- <DesignData Include="SampleData\MainViewModelSampleData.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </DesignData>
<Page Include="NewPostView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/Juick/MainPage.xaml b/Juick/MainPage.xaml
index 9df6925..8340a9f 100644
--- a/Juick/MainPage.xaml
+++ b/Juick/MainPage.xaml
@@ -7,19 +7,15 @@
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:converters="clr-namespace:Juick.Converters"
- xmlns:bindings="clr-namespace:Juick.Classes" xmlns:controls1="clr-namespace:Juick.Controls"
+ xmlns:bindings="clr-namespace:Juick.Classes"
+ xmlns:usercontrols="clr-namespace:Juick.Controls"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
- d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
phoneshell:SystemTray.IsVisible="True">
- <phone:PhoneApplicationPage.Resources>
- <converters:MidToUriConverter x:Key="uriConverter" />
- </phone:PhoneApplicationPage.Resources>
-
+
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
@@ -31,132 +27,15 @@
IsVisible="{Binding IsDataLoading}"
Text="Loading..." />
</phoneshell:SystemTray.ProgressIndicator>
- <!--Panorama control-->
- <!--<controls:Panorama Title="Juick20">-->
- <!--<controls:Panorama.TitleTemplate>
- <DataTemplate>
- <Grid Margin="0,80,0,0">
- <ContentPresenter>
- <TextBlock Foreground="Black" FontSize="20" Text="{Binding}"/>
- </ContentPresenter>
- </Grid>
- </DataTemplate>
- </controls:Panorama.TitleTemplate>-->
+
<controls:Pivot Title="juick" Grid.Row="1">
- <!--Use 'Orientation="Horizontal"' to enable a panel that lays out horizontally-->
- <!--<controls:PanoramaItem x:Name="MainPanoramaItem" Header="My feed" Margin="0, -40, 0, 0">-->
<controls:PivotItem Header="My feed" Margin="0, -5, 0, 0">
-
- <!--Double line list with image placeholder and text wrapping-->
- <ScrollViewer>
- <ItemsControl x:Name="Home"
- Margin="0, 0, -12, 0"
- ItemsSource="{Binding Items}"
- bindings:ScrollViewerMonitor.AtEndCommand="{Binding LoadMessagesPageCommand}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <HyperlinkButton NavigateUri="{Binding MID, Converter={StaticResource uriConverter}}">
- <HyperlinkButton.Template>
- <ControlTemplate>
- <Border BorderBrush="{StaticResource PhoneForegroundBrush}" BorderThickness="0 0 0 1">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Image bindings:LowProfileImageLoader.UriSource="{Binding AvatarUri}" Grid.Row="0" Grid.Column="0" Margin="3" />
- <TextBlock Text="{Binding Username}" Grid.Row="0" Grid.Column="1"
- Margin="5,0,5,5" VerticalAlignment="Top"
- HorizontalAlignment="Left"
- FontFamily="{StaticResource PhoneFontFamilySemiLight}"
- FontSize="{StaticResource PhoneFontSizeLarge}"
- Style="{StaticResource PhoneTextAccentStyle}" />
- <!--Style="{StaticResource PhoneTextNormalStyle}"-->
- <controls1:HyperLinkRichTextBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
- TextWrapping="Wrap" HorizontalAlignment="Left"
- Foreground="{StaticResource PhoneForegroundBrush}"
- Margin="5,0,5,5" VerticalAlignment="Top"
- IsReadOnly="True" Text="{Binding MessageText}" />
- <Image bindings:LowProfileImageLoader.UriSource="{Binding Attachment}" Grid.Row="2" Grid.Column="0" Margin="3" Grid.ColumnSpan="2" />
- <TextBlock Text="{Binding Status}" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"
- Foreground="{StaticResource PhoneForegroundBrush}"
- Style="{StaticResource PhoneTextAccentStyle}"
- FontSize="{StaticResource PhoneFontSizeSmall}"
- Margin="5,0,5,5" VerticalAlignment="Top"
- TextWrapping="Wrap" HorizontalAlignment="Left"/>
- </Grid>
- </Border>
- </ControlTemplate>
- </HyperlinkButton.Template>
- </HyperlinkButton>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- <!--</controls:PanoramaItem>-->
+ <usercontrols:MessageList x:Name="Home" />
</controls:PivotItem>
- <!--<controls:PanoramaItem x:Name="LastPanoramaItem" Header="Last" Margin="0, -40, 0, 0">-->
<controls:PivotItem Header="Last" Margin="0, -5, 0, 0">
- <!--Double line list with image placeholder and text wrapping-->
- <ScrollViewer>
- <ItemsControl x:Name="Last" Margin="0,0,-12,0"
- ItemsSource="{Binding Items}"
- bindings:ScrollViewerMonitor.AtEndCommand="{Binding LoadMessagesPageCommand}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <HyperlinkButton NavigateUri="{Binding MID, Converter={StaticResource uriConverter}}">
- <HyperlinkButton.Template>
- <ControlTemplate>
- <Border BorderBrush="{StaticResource PhoneForegroundBrush}" BorderThickness="0 0 0 1">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Image bindings:LowProfileImageLoader.UriSource="{Binding AvatarUri}" Grid.Row="0" Grid.Column="0" Margin="3" />
- <TextBlock Text="{Binding Username}" Grid.Row="0" Grid.Column="1"
- Margin="5,0,5,5" VerticalAlignment="Top"
- HorizontalAlignment="Left"
- FontFamily="{StaticResource PhoneFontFamilySemiLight}"
- FontSize="{StaticResource PhoneFontSizeLarge}"
- Style="{StaticResource PhoneTextAccentStyle}" />
- <controls1:HyperLinkRichTextBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
- TextWrapping="Wrap" HorizontalAlignment="Left"
- Foreground="{StaticResource PhoneForegroundBrush}"
- Margin="5,0,5,5" VerticalAlignment="Top"
- IsReadOnly="True" Text="{Binding MessageText}" />
- <Image bindings:LowProfileImageLoader.UriSource="{Binding Attachment}" Grid.Row="2" Grid.Column="0" Margin="3" Grid.ColumnSpan="2" />
- <TextBlock Text="{Binding Status}" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"
- Foreground="{StaticResource PhoneForegroundBrush}"
- Style="{StaticResource PhoneTextAccentStyle}"
- FontSize="{StaticResource PhoneFontSizeSmall}"
- Margin="5,0,5,5" VerticalAlignment="Top"
- TextWrapping="Wrap" HorizontalAlignment="Left"/>
- </Grid>
- </Border>
- </ControlTemplate>
- </HyperlinkButton.Template>
- </HyperlinkButton>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- <!--</controls:PanoramaItem>-->
- </controls:PivotItem>
- <!--</controls:Panorama>-->
+ <usercontrols:MessageList x:Name="Last"/>
+ </controls:PivotItem>
</controls:Pivot>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>