From 83ea4b07788df8d5da9286372ca9bdf76b5513fd Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 23 Apr 2013 12:29:01 +0400 Subject: Move PostItem DataTemplate to Resources, add sample data to ThreadView, enable bitmap CacheMode, remove incomplete Validation --- Juick/App.xaml | 19 +++++---- Juick/Controls/MessageList.xaml | 45 ++------------------- Juick/DataTemplates/PostItemDataTemplate.xaml | 44 ++++++++++++++++++++ Juick/Juick.csproj | 13 +++++- Juick/LoginView.xaml | 3 +- Juick/MainPage.xaml | 2 +- Juick/NewPostView.xaml | 2 +- Juick/SampleData/ThreadViewModelSampleData.xaml | 16 ++++++++ Juick/ThreadView.xaml | 53 ++++--------------------- Juick/ViewModels/LoginViewModel.cs | 5 +-- Juick/ViewModels/NewPostViewModel.cs | 28 +++++++++++++ 11 files changed, 128 insertions(+), 102 deletions(-) create mode 100644 Juick/DataTemplates/PostItemDataTemplate.xaml create mode 100644 Juick/SampleData/ThreadViewModelSampleData.xaml create mode 100644 Juick/ViewModels/NewPostViewModel.cs diff --git a/Juick/App.xaml b/Juick/App.xaml index 0c60cc0..1b67f8c 100644 --- a/Juick/App.xaml +++ b/Juick/App.xaml @@ -1,20 +1,25 @@ - + xmlns:sys="clr-namespace:System;assembly=mscorlib" + x:Class="Juick.App" + > - + + + + + - + \ No newline at end of file diff --git a/Juick/Controls/MessageList.xaml b/Juick/Controls/MessageList.xaml index afa6c69..ac6db00 100644 --- a/Juick/Controls/MessageList.xaml +++ b/Juick/Controls/MessageList.xaml @@ -12,10 +12,10 @@ FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" d:DesignHeight="480" d:DesignWidth="480"> - + + ItemsSource="{Binding Items}" IsFlatList="true" ItemTemplate="{StaticResource PostItemDataTemplate}"> - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Juick/DataTemplates/PostItemDataTemplate.xaml b/Juick/DataTemplates/PostItemDataTemplate.xaml new file mode 100644 index 0000000..285a5dc --- /dev/null +++ b/Juick/DataTemplates/PostItemDataTemplate.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Juick/Juick.csproj b/Juick/Juick.csproj index 33fbd5c..9d7c770 100644 --- a/Juick/Juick.csproj +++ b/Juick/Juick.csproj @@ -27,6 +27,8 @@ true ..\ true + true + 4.0.30816.0 true @@ -107,7 +109,6 @@ - @@ -119,6 +120,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -190,6 +195,12 @@ + + + MSBuild:MarkupCompilePass1 + + + diff --git a/Juick/NewPostView.xaml b/Juick/NewPostView.xaml index f3a911b..1ed01b5 100644 --- a/Juick/NewPostView.xaml +++ b/Juick/NewPostView.xaml @@ -11,7 +11,7 @@ Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480" - shell:SystemTray.IsVisible="True"> + shell:SystemTray.IsVisible="True" CacheMode="BitmapCache"> diff --git a/Juick/SampleData/ThreadViewModelSampleData.xaml b/Juick/SampleData/ThreadViewModelSampleData.xaml new file mode 100644 index 0000000..784bee3 --- /dev/null +++ b/Juick/SampleData/ThreadViewModelSampleData.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/Juick/ThreadView.xaml b/Juick/ThreadView.xaml index 14a6f75..d52a343 100644 --- a/Juick/ThreadView.xaml +++ b/Juick/ThreadView.xaml @@ -11,67 +11,30 @@ FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" - mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480" - phoneshell:SystemTray.IsVisible="True"> + mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480" + phoneshell:SystemTray.IsVisible="True" CacheMode="BitmapCache"> - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Juick/ViewModels/LoginViewModel.cs b/Juick/ViewModels/LoginViewModel.cs index 95528fe..2bc5bda 100644 --- a/Juick/ViewModels/LoginViewModel.cs +++ b/Juick/ViewModels/LoginViewModel.cs @@ -2,12 +2,11 @@ using System.Net; using System.Windows; using Juick.Classes; -using Juick.ViewModels.Validation; using RestSharp; namespace Juick.ViewModels { - public class LoginViewModel : DataViewModelBase + public class LoginViewModel : ViewModelBase { private string _username; private string _password; @@ -64,7 +63,7 @@ namespace Juick.ViewModels } else { - AddError("Username", "Invalid username or password", false); + //AddError("Username", "Invalid username or password", false); } }); } diff --git a/Juick/ViewModels/NewPostViewModel.cs b/Juick/ViewModels/NewPostViewModel.cs new file mode 100644 index 0000000..3c28cc7 --- /dev/null +++ b/Juick/ViewModels/NewPostViewModel.cs @@ -0,0 +1,28 @@ +using System; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Ink; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace Juick.ViewModels +{ + public class NewPostViewModel : ViewModelBase + { + public PostItem ReplyTo { get; set; } + + public PostItem Draft { get; set; } + + public BitmapImage Attachment { get; set; } + + public NewPostViewModel(PostItem replyTo) + { + ReplyTo = replyTo; + } + } +} -- cgit v1.2.3