summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore27
-rw-r--r--Juick.sln22
-rw-r--r--Juick.vsmdi6
-rw-r--r--Juick/Api/Message.cs27
-rw-r--r--Juick/Api/User.cs21
-rw-r--r--Juick/App.xaml20
-rw-r--r--Juick/App.xaml.cs171
-rw-r--r--Juick/ApplicationIcon.pngbin0 -> 1881 bytes
-rw-r--r--Juick/Background.pngbin0 -> 3521 bytes
-rw-r--r--Juick/Classes/AccountManager.cs65
-rw-r--r--Juick/Juick.csproj142
-rw-r--r--Juick/LoginView.xaml52
-rw-r--r--Juick/LoginView.xaml.cs35
-rw-r--r--Juick/MainPage.xaml118
-rw-r--r--Juick/MainPage.xaml.cs84
-rw-r--r--Juick/NewPostView.xaml51
-rw-r--r--Juick/NewPostView.xaml.cs95
-rw-r--r--Juick/PanoramaBackground.pngbin0 -> 96017 bytes
-rw-r--r--Juick/Properties/AppManifest.xml6
-rw-r--r--Juick/Properties/AssemblyInfo.cs37
-rw-r--r--Juick/Properties/WMAppManifest.xml35
-rw-r--r--Juick/SampleData/MainViewModelSampleData.xaml16
-rw-r--r--Juick/SplashScreenImage.jpgbin0 -> 9417 bytes
-rw-r--r--Juick/SubmissionInfo/ManualTestResults.xml54
-rw-r--r--Juick/SubmissionInfo/Settings.xml9
-rw-r--r--Juick/ThreadView.xaml75
-rw-r--r--Juick/ThreadView.xaml.cs56
-rw-r--r--Juick/ViewModels/MainViewModel.cs101
-rw-r--r--Juick/ViewModels/MessageViewModel.cs159
-rw-r--r--Juick/ViewModels/ThreadViewModel.cs70
30 files changed, 1554 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2170ecb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+Thumbs.db
+*.obj
+*.exe
+*.pdb
+*.user
+*.aps
+*.pch
+*.vspscc
+*_i.c
+*_p.c
+*.ncb
+*.suo
+*.sln.docstates
+*.tlb
+*.tlh
+*.bak
+*.cache
+*.ilk
+*.log
+[Bb]in
+[Dd]ebug*/
+*.lib
+*.sbr
+obj/
+[Rr]elease*/
+_ReSharper*/
+[Tt]est[Rr]esult* \ No newline at end of file
diff --git a/Juick.sln b/Juick.sln
new file mode 100644
index 0000000..868fde2
--- /dev/null
+++ b/Juick.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Juick", "Juick\Juick.csproj", "{324D7F67-600D-4239-90D9-07C9CA17A4F3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Juick.vsmdi b/Juick.vsmdi
new file mode 100644
index 0000000..b212917
--- /dev/null
+++ b/Juick.vsmdi
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
+ <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
+ <RunConfiguration id="4b682546-b069-48c9-b38b-7d8ad4c56ea2" name="Local" storage="local.testsettings" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ </TestList>
+</TestLists> \ No newline at end of file
diff --git a/Juick/Api/Message.cs b/Juick/Api/Message.cs
new file mode 100644
index 0000000..b4d4ddc
--- /dev/null
+++ b/Juick/Api/Message.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+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.Shapes;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Json;
+
+namespace Juick.Api
+{
+ [DataContract]
+ public class Message
+ {
+ [DataMember] public int mid;
+ [DataMember] public int rid;
+ [DataMember] public string body;
+ [DataMember] public User user;
+ [DataMember] public DateTime timestamp;
+ [DataMember] public int replies;
+ }
+}
diff --git a/Juick/Api/User.cs b/Juick/Api/User.cs
new file mode 100644
index 0000000..f7bd6eb
--- /dev/null
+++ b/Juick/Api/User.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Net;
+using System.Runtime.Serialization;
+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.Shapes;
+
+namespace Juick.Api
+{
+ [DataContract]
+ public class User
+ {
+ [DataMember] public int uid;
+ [DataMember] public string uname;
+ }
+}
diff --git a/Juick/App.xaml b/Juick/App.xaml
new file mode 100644
index 0000000..0c60cc0
--- /dev/null
+++ b/Juick/App.xaml
@@ -0,0 +1,20 @@
+<Application
+ x:Class="Juick.App"
+ 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:sys="clr-namespace:System;assembly=mscorlib">
+
+ <!--Application Resources-->
+ <Application.Resources>
+ </Application.Resources>
+
+ <Application.ApplicationLifetimeObjects>
+ <!--Required object that handles lifetime events for the application-->
+ <shell:PhoneApplicationService
+ Launching="Application_Launching" Closing="Application_Closing"
+ Activated="Application_Activated" Deactivated="Application_Deactivated"/>
+ </Application.ApplicationLifetimeObjects>
+
+</Application> \ No newline at end of file
diff --git a/Juick/App.xaml.cs b/Juick/App.xaml.cs
new file mode 100644
index 0000000..54abe20
--- /dev/null
+++ b/Juick/App.xaml.cs
@@ -0,0 +1,171 @@
+using System;
+using System.Windows;
+using System.Windows.Navigation;
+using Juick.Classes;
+using Juick.ViewModels;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Shell;
+using RestSharp;
+
+namespace Juick
+{
+ public partial class App : Application
+ {
+ private static MainViewModel viewModel = null;
+
+ /// <summary>
+ /// A static ViewModel used by the views to bind against.
+ /// </summary>
+ /// <returns>The MainViewModel object.</returns>
+ public static MainViewModel ViewModel
+ {
+ get
+ {
+ // Delay creation of the view model until necessary
+ return viewModel ?? (viewModel = new MainViewModel());
+ }
+ }
+
+ private static AccountManager _acc;
+
+ public static AccountManager Account
+ {
+ get { return _acc ?? (_acc = new AccountManager()); }
+ }
+
+ 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}); }
+ }
+
+ /// <summary>
+ /// Provides easy access to the root frame of the Phone Application.
+ /// </summary>
+ /// <returns>The root frame of the Phone Application.</returns>
+ public PhoneApplicationFrame RootFrame { get; private set; }
+
+ /// <summary>
+ /// Constructor for the Application object.
+ /// </summary>
+ public App()
+ {
+ // Global handler for uncaught exceptions.
+ UnhandledException += Application_UnhandledException;
+
+ // Standard Silverlight initialization
+ InitializeComponent();
+
+ // Phone-specific initialization
+ InitializePhoneApplication();
+
+ // Show graphics profiling information while debugging.
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // Display the current frame rate counters.
+ Current.Host.Settings.EnableFrameRateCounter = true;
+
+ // Show the areas of the app that are being redrawn in each frame.
+ //Application.Current.Host.Settings.EnableRedrawRegions = true;
+
+ // Enable non-production analysis visualization mode,
+ // which shows areas of a page that are handed off to GPU with a colored overlay.
+ //Application.Current.Host.Settings.EnableCacheVisualization = true;
+
+ // Disable the application idle detection by setting the UserIdleDetectionMode property of the
+ // application's PhoneApplicationService object to Disabled.
+ // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
+ // and consume battery power when the user is not using the phone.
+ PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
+ }
+
+ }
+
+ // Code to execute when the application is launching (eg, from Start)
+ // This code will not execute when the application is reactivated
+ private void Application_Launching(object sender, LaunchingEventArgs e)
+ {
+
+ }
+
+ // Code to execute when the application is activated (brought to foreground)
+ // This code will not execute when the application is first launched
+ private void Application_Activated(object sender, ActivatedEventArgs e)
+ {
+ // Ensure that application state is restored appropriately
+ if (!App.ViewModel.IsDataLoaded)
+ {
+ App.ViewModel.LoadData();
+ }
+ }
+
+ // Code to execute when the application is deactivated (sent to background)
+ // This code will not execute when the application is closing
+ private void Application_Deactivated(object sender, DeactivatedEventArgs e)
+ {
+ // Ensure that required application state is persisted here.
+ }
+
+ // Code to execute when the application is closing (eg, user hit Back)
+ // This code will not execute when the application is deactivated
+ private void Application_Closing(object sender, ClosingEventArgs e)
+ {
+ }
+
+ // Code to execute if a navigation fails
+ private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
+ {
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // A navigation has failed; break into the debugger
+ System.Diagnostics.Debugger.Break();
+ }
+ }
+
+ // Code to execute on Unhandled Exceptions
+ private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+ {
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // An unhandled exception has occurred; break into the debugger
+ System.Diagnostics.Debugger.Break();
+ }
+ }
+
+ #region Phone application initialization
+
+ // Avoid double-initialization
+ private bool phoneApplicationInitialized = false;
+
+ // Do not add any additional code to this method
+ private void InitializePhoneApplication()
+ {
+ if (phoneApplicationInitialized)
+ return;
+
+ // Create the frame but don't set it as RootVisual yet; this allows the splash
+ // screen to remain active until the application is ready to render.
+ RootFrame = new PhoneApplicationFrame();
+ RootFrame.Navigated += CompleteInitializePhoneApplication;
+
+ // Handle navigation failures
+ RootFrame.NavigationFailed += RootFrame_NavigationFailed;
+
+ // Ensure we don't initialize again
+ phoneApplicationInitialized = true;
+ }
+
+ // Do not add any additional code to this method
+ private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
+ {
+ // Set the root visual to allow the application to render
+ if (RootVisual != RootFrame)
+ RootVisual = RootFrame;
+
+ // Remove this handler since it is no longer needed
+ RootFrame.Navigated -= CompleteInitializePhoneApplication;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Juick/ApplicationIcon.png b/Juick/ApplicationIcon.png
new file mode 100644
index 0000000..5859393
--- /dev/null
+++ b/Juick/ApplicationIcon.png
Binary files differ
diff --git a/Juick/Background.png b/Juick/Background.png
new file mode 100644
index 0000000..e46f21d
--- /dev/null
+++ b/Juick/Background.png
Binary files differ
diff --git a/Juick/Classes/AccountManager.cs b/Juick/Classes/AccountManager.cs
new file mode 100644
index 0000000..f7fcc75
--- /dev/null
+++ b/Juick/Classes/AccountManager.cs
@@ -0,0 +1,65 @@
+using System;
+using System.IO;
+using System.IO.IsolatedStorage;
+using System.Linq;
+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.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace Juick.Classes
+{
+ public class AccountManager
+ {
+ const string FileName = "account.xml";
+ public NetworkCredential Credentials
+ {
+ get
+ {
+ return new NetworkCredential
+ {
+ UserName = IsolatedStorageSettings.ApplicationSettings.Contains("user") ?
+ IsolatedStorageSettings.ApplicationSettings["user"] as string : null,
+ Password = IsolatedStorageSettings.ApplicationSettings.Contains("password") ?
+ IsolatedStorageSettings.ApplicationSettings["password"] as string : null,
+ };
+ }
+ set
+ {
+ var creds = value;
+ if (creds != null)
+ {
+ IsolatedStorageSettings.ApplicationSettings["user"] = value.UserName;
+ IsolatedStorageSettings.ApplicationSettings["password"] = value.Password;
+ } else
+ {
+ IsolatedStorageSettings.ApplicationSettings["user"] = null;
+ IsolatedStorageSettings.ApplicationSettings["password"] = null;
+ }
+ }
+ }
+
+ public void SignIn(Page page, string login, string pass)
+ {
+ Credentials = new NetworkCredential(login, pass);
+ page.NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
+ page.Dispatcher.BeginInvoke(() => page.NavigationService.RemoveBackEntry());
+ }
+
+ public void SignOut(Page page)
+ {
+ Credentials = null;
+ page.NavigationService.Navigate(new Uri("/LoginView.xaml", UriKind.Relative));
+ page.Dispatcher.BeginInvoke(() => page.NavigationService.RemoveBackEntry());
+ }
+ }
+}
diff --git a/Juick/Juick.csproj b/Juick/Juick.csproj
new file mode 100644
index 0000000..e550947
--- /dev/null
+++ b/Juick/Juick.csproj
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.20506</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{324D7F67-600D-4239-90D9-07C9CA17A4F3}</ProjectGuid>
+ <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Juick</RootNamespace>
+ <AssemblyName>Juick</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
+ <TargetFrameworkProfile>WindowsPhone71</TargetFrameworkProfile>
+ <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
+ <SilverlightApplication>true</SilverlightApplication>
+ <SupportedCultures>
+ </SupportedCultures>
+ <XapOutputs>true</XapOutputs>
+ <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
+ <XapFilename>Juick.xap</XapFilename>
+ <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
+ <SilverlightAppEntry>Juick.App</SilverlightAppEntry>
+ <ValidateXaml>true</ValidateXaml>
+ <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>Bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>Bin\Release</OutputPath>
+ <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.Phone" />
+ <Reference Include="Microsoft.Phone.Controls" />
+ <Reference Include="Microsoft.Phone.Interop" />
+ <Reference Include="Microsoft.Xna.Framework" />
+ <Reference Include="Newtonsoft.Json.WindowsPhone, Version=4.0.2.0, Culture=neutral, processorArchitecture=MSIL" />
+ <Reference Include="RestSharp.WindowsPhone, Version=102.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Servicemodel.Web" />
+ <Reference Include="System.Windows" />
+ <Reference Include="system" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Net" />
+ <Reference Include="System.Xml" />
+ <Reference Include="mscorlib.extensions" />
+ <Reference Include="System.Xml.Serialization" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Api\Message.cs" />
+ <Compile Include="Api\User.cs" />
+ <Compile Include="App.xaml.cs">
+ <DependentUpon>App.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Classes\AccountManager.cs" />
+ <Compile Include="LoginView.xaml.cs">
+ <DependentUpon>LoginView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="MainPage.xaml.cs">
+ <DependentUpon>MainPage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="NewPostView.xaml.cs">
+ <DependentUpon>NewPostView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="ThreadView.xaml.cs">
+ <DependentUpon>ThreadView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="ViewModels\MessageViewModel.cs" />
+ <Compile Include="ViewModels\MainViewModel.cs" />
+ <Compile Include="ViewModels\ThreadViewModel.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ApplicationDefinition Include="App.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </ApplicationDefinition>
+ <Page Include="LoginView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="MainPage.xaml">
+ <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>
+ </Page>
+ <Page Include="ThreadView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Properties\AppManifest.xml" />
+ <None Include="Properties\WMAppManifest.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="ApplicationIcon.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Background.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Resource Include="wp7.jpg" />
+ <Resource Include="PanoramaBackground.png" />
+ <Content Include="SplashScreenImage.jpg" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ProjectExtensions />
+</Project> \ No newline at end of file
diff --git a/Juick/LoginView.xaml b/Juick/LoginView.xaml
new file mode 100644
index 0000000..6f47b72
--- /dev/null
+++ b/Juick/LoginView.xaml
@@ -0,0 +1,52 @@
+<phone:PhoneApplicationPage
+ x:Class="Juick.LoginView"
+ 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"
+ FontFamily="{StaticResource PhoneFontFamilyNormal}"
+ FontSize="{StaticResource PhoneFontSizeNormal}"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ SupportedOrientations="Portrait" Orientation="Portrait"
+ mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
+ shell:SystemTray.IsVisible="True">
+
+ <!--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="ApplicationTitle" Text="JUICK" Style="{StaticResource PhoneTextNormalStyle}"/>
+ <TextBlock x:Name="PageTitle" Text="signup" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
+ </StackPanel>
+
+ <!--ContentPanel - place additional content here-->
+ <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
+ <TextBlock Height="30" HorizontalAlignment="Left" Margin="37,119,0,0" Name="textBlock1" Text="Username" VerticalAlignment="Top" />
+ <TextBox Height="72" HorizontalAlignment="Left" Margin="25,155,0,0" Name="textBox1" Text="{Binding Username}" VerticalAlignment="Top" Width="409" />
+ <TextBlock Height="30" HorizontalAlignment="Left" Margin="37,246,0,0" Name="textBlock2" Text="Password" VerticalAlignment="Top" />
+ <Button Content="Sign in" Height="72" HorizontalAlignment="Left" Margin="120,360,0,0" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click" />
+ <Button Content="Skip" Height="72" HorizontalAlignment="Right" Margin="0,360,22,0" Name="button2" VerticalAlignment="Top" Width="160" Click="button2_Click" />
+ <PasswordBox Height="72" HorizontalAlignment="Left" Password="{Binding Password}" Margin="25,282,0,0" Name="textBox2" VerticalAlignment="Top" Width="409" />
+ </Grid>
+ </Grid>
+
+ <!--Sample code showing usage of ApplicationBar-->
+ <!--<phone:PhoneApplicationPage.ApplicationBar>
+ <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
+ <shell:ApplicationBar.MenuItems>
+ <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
+ <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
+ </shell:ApplicationBar.MenuItems>
+ </shell:ApplicationBar>
+ </phone:PhoneApplicationPage.ApplicationBar>-->
+
+</phone:PhoneApplicationPage>
diff --git a/Juick/LoginView.xaml.cs b/Juick/LoginView.xaml.cs
new file mode 100644
index 0000000..d653932
--- /dev/null
+++ b/Juick/LoginView.xaml.cs
@@ -0,0 +1,35 @@
+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 Juick.Classes;
+using Microsoft.Phone.Controls;
+
+namespace Juick
+{
+ public partial class LoginView : PhoneApplicationPage
+ {
+ public LoginView()
+ {
+ InitializeComponent();
+ DataContext = App.Account.Credentials;
+ }
+
+ private void button1_Click(object sender, RoutedEventArgs e)
+ {
+ App.Account.SignIn(this, textBox1.Text, textBox2.Password);
+ }
+
+ private void button2_Click(object sender, RoutedEventArgs e)
+ {
+ App.Account.SignOut(this);
+ }
+ }
+} \ No newline at end of file
diff --git a/Juick/MainPage.xaml b/Juick/MainPage.xaml
new file mode 100644
index 0000000..3d7245c
--- /dev/null
+++ b/Juick/MainPage.xaml
@@ -0,0 +1,118 @@
+<phone:PhoneApplicationPage
+ x:Class="Juick.MainPage"
+ 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: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"
+ mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
+ d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
+ FontFamily="{StaticResource PhoneFontFamilyNormal}"
+ FontSize="{StaticResource PhoneFontSizeNormal}"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ SupportedOrientations="Portrait" Orientation="Portrait"
+ shell:SystemTray.IsVisible="False">
+
+ <!--LayoutRoot is the root grid where all page content is placed-->
+ <Grid x:Name="LayoutRoot" Background="Transparent">
+
+ <!--Panorama control-->
+ <controls:Panorama Title="Juick" FontSize="20">
+
+
+ <!--Use 'Orientation="Horizontal"' to enable a panel that lays out horizontally-->
+ <controls:PanoramaItem x:Name="MainPanoramaItem" Header="My feed" Margin="0, -40, 0, 0">
+ <!--Double line list with image placeholder and text wrapping-->
+ <ListBox Margin="0,0,-12,0" ItemsSource="{Binding MyFeed}" SelectionChanged="ListBoxSelectionChanged">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid >
+
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <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}" />
+ <TextBlock Text="{Binding MessageText}" Grid.Row="1" Grid.Column="1"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ Style="{StaticResource PhoneTextNormalStyle}"
+ Margin="5,0,5,5" VerticalAlignment="Top"
+ TextWrapping="Wrap" HorizontalAlignment="Left"/>
+ <TextBlock Text="{Binding Status}" Grid.Row="2" Grid.Column="1"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ Style="{StaticResource PhoneTextAccentStyle}"
+ FontSize="{StaticResource PhoneFontSizeSmall}"
+ Margin="5,0,5,5" VerticalAlignment="Top"
+ TextWrapping="Wrap" HorizontalAlignment="Left"/>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </controls:PanoramaItem>
+ <controls:PanoramaItem x:Name="LastPanoramaItem" Header="Last" Margin="0, -40, 0, 0">
+ <!--Double line list with image placeholder and text wrapping-->
+ <ListBox Margin="0,0,-12,0" ItemsSource="{Binding Last}" SelectionChanged="LastBoxSelectionChanged">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Image Source="{Binding UserAvatar}" Grid.Row="0" Grid.Column="0" />
+ <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}" />
+ <TextBlock Text="{Binding MessageText}" Grid.Row="1" Grid.Column="1"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ Style="{StaticResource PhoneTextNormalStyle}"
+ Margin="5,0,5,5" VerticalAlignment="Top"
+ TextWrapping="Wrap" HorizontalAlignment="Left"/>
+ <TextBlock Text="{Binding Status}" Grid.Row="2" Grid.Column="1"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ Style="{StaticResource PhoneTextAccentStyle}"
+ FontSize="{StaticResource PhoneFontSizeSmall}"
+ Margin="5,0,5,5" VerticalAlignment="Top"
+ TextWrapping="Wrap" HorizontalAlignment="Left"/>
+ </Grid>
+
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </controls:PanoramaItem>
+ </controls:Panorama>
+ </Grid>
+ <phone:PhoneApplicationPage.ApplicationBar>
+ <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button0.png" Text="New message" Click="ApplicationBarIconButton_Click_1"/>
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Refresh" Click="ApplicationBarIconButton_Click" />
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Sign out" Click="ApplicationBarMenuItem_Click" />
+
+ <shell:ApplicationBar.MenuItems>
+ <shell:ApplicationBarMenuItem Text="New message" Click="ApplicationBarIconButton_Click_1"/>
+ <shell:ApplicationBarMenuItem Text="Refresh" Click="ApplicationBarIconButton_Click"/>
+ <shell:ApplicationBarMenuItem Text="Sign out" Click="ApplicationBarMenuItem_Click" />
+ </shell:ApplicationBar.MenuItems>
+ </shell:ApplicationBar>
+ </phone:PhoneApplicationPage.ApplicationBar>
+</phone:PhoneApplicationPage> \ No newline at end of file
diff --git a/Juick/MainPage.xaml.cs b/Juick/MainPage.xaml.cs
new file mode 100644
index 0000000..4468f6a
--- /dev/null
+++ b/Juick/MainPage.xaml.cs
@@ -0,0 +1,84 @@
+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 Juick.Classes;
+using Microsoft.Phone.Controls;
+
+namespace Juick
+{
+ public partial class MainPage : PhoneApplicationPage
+ {
+ // Constructor
+ public MainPage()
+ {
+ InitializeComponent();
+
+ // Set the data context of the listbox control to the sample data
+ DataContext = App.ViewModel;
+ Loaded += MainPage_Loaded;
+ }
+
+ // Load data for the ViewModel MyFeed
+ private void MainPage_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (!App.ViewModel.IsDataLoaded)
+ {
+ if (string.IsNullOrEmpty(App.Account.Credentials.UserName))
+ NavigationService.Navigate(new Uri("/LoginView.xaml", UriKind.Relative));
+ else
+ App.ViewModel.LoadData();
+ }
+ }
+
+ private void ListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ // If selected index is -1 (no selection) do nothing
+ if (((ListBox)sender).SelectedIndex == -1)
+ return;
+
+ // Navigate to the new page
+ NavigationService.Navigate(new Uri("/ThreadView.xaml?mid=" + App.ViewModel.MyFeed[((ListBox)sender).SelectedIndex].MID, UriKind.Relative));
+
+ // Reset selected index to -1 (no selection)
+ ((ListBox)sender).SelectedIndex = -1;
+ }
+
+ private void LastBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ // If selected index is -1 (no selection) do nothing
+ if (((ListBox)sender).SelectedIndex == -1)
+ return;
+
+ // Navigate to the new page
+ NavigationService.Navigate(new Uri(string.Format("/ThreadView.xaml?mid={0}&last=true", App.ViewModel.Last[((ListBox)sender).SelectedIndex].MID), UriKind.Relative));
+
+ // Reset selected index to -1 (no selection)
+ ((ListBox)sender).SelectedIndex = -1;
+ }
+
+ private void ApplicationBarIconButton_Click(object sender, EventArgs e)
+ {
+ App.ViewModel.MyFeed.Clear();
+ App.ViewModel.Last.Clear();
+ App.ViewModel.LoadData();
+ }
+
+ private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
+ {
+ App.Account.SignOut(this);
+ }
+
+ private void ApplicationBarIconButton_Click_1(object sender, EventArgs e)
+ {
+ NavigationService.Navigate(new Uri("/NewPostView.xaml", UriKind.Relative));
+ }
+ }
+} \ No newline at end of file
diff --git a/Juick/NewPostView.xaml b/Juick/NewPostView.xaml
new file mode 100644
index 0000000..caa2b4f
--- /dev/null
+++ b/Juick/NewPostView.xaml
@@ -0,0 +1,51 @@
+<phone:PhoneApplicationPage
+ x:Class="Juick.NewPostView"
+ 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"
+ FontFamily="{StaticResource PhoneFontFamilyNormal}"
+ FontSize="{StaticResource PhoneFontSizeNormal}"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ SupportedOrientations="Portrait" Orientation="Portrait"
+ mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
+ shell:SystemTray.IsVisible="True">
+
+ <!--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="ApplicationTitle" Text="JUICK" Style="{StaticResource PhoneTextNormalStyle}"/>
+ <TextBlock x:Name="PageTitle" Text="new message" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
+ </StackPanel>
+
+ <!--ContentPanel - place additional content here-->
+ <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
+ <TextBlock Height="30" HorizontalAlignment="Left" Margin="12,34,0,0" Name="textBlock1" Text="Write a message" VerticalAlignment="Top" />
+ <TextBox Height="333" HorizontalAlignment="Left" Margin="0,70,0,0" Name="textBox1" Text="" VerticalAlignment="Top" Width="450" TextWrapping="Wrap" MaxWidth="Infinity" />
+ <Button Content="Publish" Height="72" HorizontalAlignment="Left" Margin="290,409,0,0" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click" />
+ <Button Content="Attach" Height="72" HorizontalAlignment="Left" Margin="0,409,0,0" Name="button2" VerticalAlignment="Top" Width="143" Click="button2_Click" />
+ <Image Height="150" HorizontalAlignment="Left" Margin="12,504,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="425" />
+ </Grid>
+ </Grid>
+
+ <!--Sample code showing usage of ApplicationBar-->
+ <!--<phone:PhoneApplicationPage.ApplicationBar>
+ <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
+ <shell:ApplicationBar.MenuItems>
+ <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
+ <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
+ </shell:ApplicationBar.MenuItems>
+ </shell:ApplicationBar>
+ </phone:PhoneApplicationPage.ApplicationBar>-->
+
+</phone:PhoneApplicationPage>
diff --git a/Juick/NewPostView.xaml.cs b/Juick/NewPostView.xaml.cs
new file mode 100644
index 0000000..68b7efb
--- /dev/null
+++ b/Juick/NewPostView.xaml.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Browser;
+using System.Reflection;
+using System.Text;
+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.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Resources;
+using System.Windows.Shapes;
+using Juick.Classes;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Tasks;
+using Microsoft.Xna.Framework.Media;
+using RestSharp;
+
+namespace Juick
+{
+ public partial class NewPostView : PhoneApplicationPage
+ {
+ private PhotoChooserTask chooser;
+ public NewPostView()
+ {
+ InitializeComponent();
+ }
+
+ // When page is navigated to set data context to selected item in list
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ string _rid, _mid;
+ if (NavigationContext.QueryString.TryGetValue("mid", out _mid))
+ {
+ PageTitle.Text = "reply";
+ button1.Content = "reply";
+ textBox1.Text = "#" + _mid;
+ }
+ if (NavigationContext.QueryString.TryGetValue("rid", out _rid))
+ {
+ textBox1.Text += "/" + _rid;
+ }
+ }
+
+ private void button1_Click(object sender, RoutedEventArgs e)
+ {
+
+ var request = new RestRequest("/post", Method.POST);
+ request.AddParameter("body", textBox1.Text);
+ if (image1.Source != null)
+ {
+ using (var ms = new MemoryStream())
+ {
+ var wb = new WriteableBitmap(image1, null);
+ wb.SaveJpeg(ms, (int) image1.Width, (int) image1.Height, 0, 100);
+ request.AddFile("attach", ms.ToArray(), "file.jpg");
+ }
+ }
+
+ App.Client.ExecuteAsync(request, response =>
+ {
+ if (response.StatusCode != HttpStatusCode.OK)
+ {
+ MessageBox.Show(response.StatusCode.ToString());
+ }
+ });
+
+ NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
+ Dispatcher.BeginInvoke(() => NavigationService.RemoveBackEntry());
+ }
+
+
+ private void button2_Click(object sender, RoutedEventArgs e)
+ {
+ chooser = new PhotoChooserTask {ShowCamera = true};
+ chooser.Completed += (o, result) =>
+ {
+ if (result.TaskResult == TaskResult.OK)
+ {
+
+ BinaryReader reader = new BinaryReader(result.ChosenPhoto);
+ image1.Source = new BitmapImage(new Uri(result.OriginalFileName));
+
+ }
+ };
+ chooser.Show();
+ }
+ }
+} \ No newline at end of file
diff --git a/Juick/PanoramaBackground.png b/Juick/PanoramaBackground.png
new file mode 100644
index 0000000..691d2dc
--- /dev/null
+++ b/Juick/PanoramaBackground.png
Binary files differ
diff --git a/Juick/Properties/AppManifest.xml b/Juick/Properties/AppManifest.xml
new file mode 100644
index 0000000..a955232
--- /dev/null
+++ b/Juick/Properties/AppManifest.xml
@@ -0,0 +1,6 @@
+<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Deployment.Parts>
+ </Deployment.Parts>
+</Deployment>
diff --git a/Juick/Properties/AssemblyInfo.cs b/Juick/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..d3496e2
--- /dev/null
+++ b/Juick/Properties/AssemblyInfo.cs
@@ -0,0 +1,37 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Resources;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Juick")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Juick")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("22b71975-113b-4746-92ee-48b2d7aa377b")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/Juick/Properties/WMAppManifest.xml b/Juick/Properties/WMAppManifest.xml
new file mode 100644
index 0000000..3bf3f96
--- /dev/null
+++ b/Juick/Properties/WMAppManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
+ <App xmlns="" ProductID="{c0b72e47-109a-478a-af50-75937b8af908}" Title="Juick" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="Juick author" Description="Sample description" Publisher="Juick">
+ <IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
+ <Capabilities>
+ <Capability Name="ID_CAP_GAMERSERVICES"/>
+ <Capability Name="ID_CAP_IDENTITY_DEVICE"/>
+ <Capability Name="ID_CAP_IDENTITY_USER"/>
+ <Capability Name="ID_CAP_LOCATION"/>
+ <Capability Name="ID_CAP_MEDIALIB"/>
+ <Capability Name="ID_CAP_MICROPHONE"/>
+ <Capability Name="ID_CAP_NETWORKING"/>
+ <Capability Name="ID_CAP_PHONEDIALER"/>
+ <Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
+ <Capability Name="ID_CAP_SENSORS"/>
+ <Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
+ <Capability Name="ID_CAP_ISV_CAMERA"/>
+ <Capability Name="ID_CAP_CONTACTS"/>
+ <Capability Name="ID_CAP_APPOINTMENTS"/>
+ </Capabilities>
+ <Tasks>
+ <DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
+ </Tasks>
+ <Tokens>
+ <PrimaryToken TokenID="JuickToken" TaskName="_default">
+ <TemplateType5>
+ <BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
+ <Count>0</Count>
+ <Title>Juick</Title>
+ </TemplateType5>
+ </PrimaryToken>
+ </Tokens>
+ </App>
+</Deployment>
diff --git a/Juick/SampleData/MainViewModelSampleData.xaml b/Juick/SampleData/MainViewModelSampleData.xaml
new file mode 100644
index 0000000..736a16e
--- /dev/null
+++ b/Juick/SampleData/MainViewModelSampleData.xaml
@@ -0,0 +1,16 @@
+<ViewModels:MainViewModel
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="clr-namespace:Juick" xmlns:ViewModels="clr-namespace:Juick.ViewModels"
+ SampleProperty="Sample Text Property Value">
+
+ <ViewModels:MainViewModel.MyFeed>
+ <local:MessageViewModel Username="design one" MessageText="Maecenas praesent accumsan bibendum" Status="Maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur"/>
+ <local:MessageViewModel Username="design two" MessageText="Dictumst eleifend facilisi faucibus" Status="Pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent"/>
+ <local:MessageViewModel Username="design three" MessageText="Habitant inceptos interdum lobortis" Status="Accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat"/>
+ <local:MessageViewModel Username="design four" MessageText="Nascetur pharetra placerat pulvinar" Status="Pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum"/>
+ <local:MessageViewModel Username="design five" MessageText="Sagittis senectus sociosqu suscipit" Status="Dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis"/>
+ <local:MessageViewModel Username="design six" MessageText="Torquent ultrices vehicula volutpat" Status="Senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend"/>
+ </ViewModels:MainViewModel.MyFeed>
+
+</ViewModels:MainViewModel> \ No newline at end of file
diff --git a/Juick/SplashScreenImage.jpg b/Juick/SplashScreenImage.jpg
new file mode 100644
index 0000000..353b192
--- /dev/null
+++ b/Juick/SplashScreenImage.jpg
Binary files differ
diff --git a/Juick/SubmissionInfo/ManualTestResults.xml b/Juick/SubmissionInfo/ManualTestResults.xml
new file mode 100644
index 0000000..241b27c
--- /dev/null
+++ b/Juick/SubmissionInfo/ManualTestResults.xml
@@ -0,0 +1,54 @@
+<ManualTestResults version="1.0.0.3">
+ <ManualTestCases>
+ <ManualTestCase Name="4.7.1">Pending</ManualTestCase>
+ <ManualTestCase Name="5.1.1">Pending</ManualTestCase>
+ <ManualTestCase Name="5.1.2">Pending</ManualTestCase>
+ <ManualTestCase Name="5.1.3">Pending</ManualTestCase>
+ <ManualTestCase Name="5.2.2">Pending</ManualTestCase>
+ <ManualTestCase Name="5.2.3">Pending</ManualTestCase>
+ <ManualTestCase Name="5.2.4.1">Pending</ManualTestCase>
+ <ManualTestCase Name="5.2.4.2">Pending</ManualTestCase>
+ <ManualTestCase Name="5.2.4.3">Pending</ManualTestCase>
+ <ManualTestCase Name="5.2.4.4">Pending</ManualTestCase>
+ <ManualTestCase Name="5.2.6">Pending</ManualTestCase>
+ <ManualTestCase Name="5.3.1">Pending</ManualTestCase>
+ <ManualTestCase Name="5.3.2">Pending</ManualTestCase>
+ <ManualTestCase Name="5.3.3">Pending</ManualTestCase>
+ <ManualTestCase Name="5.4.1">Pending</ManualTestCase>
+ <ManualTestCase Name="5.5.1">Pending</ManualTestCase>
+ <ManualTestCase Name="5.5.2">Pending</ManualTestCase>
+ <ManualTestCase Name="5.6.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.2.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.2.2">Pending</ManualTestCase>
+ <ManualTestCase Name="6.3.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.3.2.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.3.2.2">Pending</ManualTestCase>
+ <ManualTestCase Name="6.3.3.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.4.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.4.2">Pending</ManualTestCase>
+ <ManualTestCase Name="6.4.3">Pending</ManualTestCase>
+ <ManualTestCase Name="6.4.4">Pending</ManualTestCase>
+ <ManualTestCase Name="6.4.5">Pending</ManualTestCase>
+ <ManualTestCase Name="6.4.6">Pending</ManualTestCase>
+ <ManualTestCase Name="6.4.7">Pending</ManualTestCase>
+ <ManualTestCase Name="6.5.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.5.2">Pending</ManualTestCase>
+ <ManualTestCase Name="6.5.3">Pending</ManualTestCase>
+ <ManualTestCase Name="6.5.4">Pending</ManualTestCase>
+ <ManualTestCase Name="6.6.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.6.3">Pending</ManualTestCase>
+ <ManualTestCase Name="6.6.4">Pending</ManualTestCase>
+ <ManualTestCase Name="6.7.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.7.2">Pending</ManualTestCase>
+ <ManualTestCase Name="6.8.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.9.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.9.2">Pending</ManualTestCase>
+ <ManualTestCase Name="6.9.3">Pending</ManualTestCase>
+ <ManualTestCase Name="6.9.4">Pending</ManualTestCase>
+ <ManualTestCase Name="6.9.5">Pending</ManualTestCase>
+ <ManualTestCase Name="6.10.1">Pending</ManualTestCase>
+ <ManualTestCase Name="6.10.2">Pending</ManualTestCase>
+ <ManualTestCase Name="6.10.3">Pending</ManualTestCase>
+ </ManualTestCases>
+</ManualTestResults> \ No newline at end of file
diff --git a/Juick/SubmissionInfo/Settings.xml b/Juick/SubmissionInfo/Settings.xml
new file mode 100644
index 0000000..f140d85
--- /dev/null
+++ b/Juick/SubmissionInfo/Settings.xml
@@ -0,0 +1,9 @@
+<MarketplaceDetails>
+ <SmallAppTile>
+ </SmallAppTile>
+ <LargeAppTile>
+ </LargeAppTile>
+ <PCAppTile>
+ </PCAppTile>
+ <ScreenShots>;;;;;;;;</ScreenShots>
+</MarketplaceDetails> \ No newline at end of file
diff --git a/Juick/ThreadView.xaml b/Juick/ThreadView.xaml
new file mode 100644
index 0000000..20529c2
--- /dev/null
+++ b/Juick/ThreadView.xaml
@@ -0,0 +1,75 @@
+<phone:PhoneApplicationPage
+ x:Class="Juick.ThreadView"
+ 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"
+ 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">
+
+ <!--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="ApplicationTitle" Text="JUICK" Style="{StaticResource PhoneTextNormalStyle}"/>
+ </StackPanel>
+
+ <!--ContentPanel - place additional content here-->
+ <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
+ <ListBox Margin="0,0,-12,0" ItemsSource="{Binding Items}" SelectionChanged="ListBox_SelectionChanged">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <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}" />
+ <TextBlock Text="{Binding MessageText}" Grid.Row="1" Grid.Column="1"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+
+ Style="{StaticResource PhoneTextNormalStyle}"
+ Margin="5,0,5,5" VerticalAlignment="Top"
+ TextWrapping="Wrap" HorizontalAlignment="Left"/>
+ </Grid>
+
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </Grid>
+ </Grid>
+
+ <!--Sample code showing usage of ApplicationBar-->
+ <phone:PhoneApplicationPage.ApplicationBar>
+ <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
+ <shell:ApplicationBar.MenuItems>
+ <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
+ <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
+ </shell:ApplicationBar.MenuItems>
+ </shell:ApplicationBar>
+ </phone:PhoneApplicationPage.ApplicationBar>
+
+</phone:PhoneApplicationPage>
diff --git a/Juick/ThreadView.xaml.cs b/Juick/ThreadView.xaml.cs
new file mode 100644
index 0000000..c984dd1
--- /dev/null
+++ b/Juick/ThreadView.xaml.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Linq;
+using System.Windows.Controls;
+using System.Windows.Navigation;
+using Juick.ViewModels;
+using Microsoft.Phone.Controls;
+
+namespace Juick
+{
+ public partial class ThreadView : PhoneApplicationPage
+ {
+ public ThreadView()
+ {
+ InitializeComponent();
+ model = new ThreadViewModel();
+ DataContext = model;
+ }
+
+ public ThreadViewModel model;
+
+ // When page is navigated to set data context to selected item in list
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ string _mid = "";
+ string _last = "";
+ bool last = false;
+ if (NavigationContext.QueryString.TryGetValue("last", out _last))
+ {
+ last = bool.Parse(_last);
+ }
+ if (NavigationContext.QueryString.TryGetValue("mid", out _mid))
+ {
+ int MID = int.Parse(_mid);
+ model.Root = last ? App.ViewModel.Last.Single(i => i.MID == MID) : App.ViewModel.MyFeed.Single(i => i.MID == MID);
+ model.LoadData();
+ }
+ }
+
+ private void ListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
+ {
+ // If selected index is -1 (no selection) do nothing
+ if (((ListBox)sender).SelectedIndex == -1)
+ return;
+
+ // Navigate to the new page
+ var item = model.Items[((ListBox) sender).SelectedIndex];
+ var destUri = string.Format("/NewPostView.xaml?mid={0}", item.MID);
+ if (item.RID > 0)
+ destUri += string.Format("&rid={0}", item.RID);
+ NavigationService.Navigate(new Uri(destUri , UriKind.Relative));
+
+ // Reset selected index to -1 (no selection)
+ ((ListBox)sender).SelectedIndex = -1;
+ }
+ }
+} \ No newline at end of file
diff --git a/Juick/ViewModels/MainViewModel.cs b/Juick/ViewModels/MainViewModel.cs
new file mode 100644
index 0000000..a504658
--- /dev/null
+++ b/Juick/ViewModels/MainViewModel.cs
@@ -0,0 +1,101 @@
+using System;
+using System.ComponentModel;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+using System.Runtime.Serialization.Json;
+using System.Collections.ObjectModel;
+using System.Windows;
+using Juick.Api;
+using RestSharp;
+
+namespace Juick.ViewModels
+{
+ public class MainViewModel : INotifyPropertyChanged
+ {
+ public MainViewModel()
+ {
+ this.MyFeed = new ObservableCollection<MessageViewModel>();
+ this.Last = new ObservableCollection<MessageViewModel>();
+ }
+
+ /// <summary>
+ /// A collection for MessageViewModel objects.
+ /// </summary>
+ public ObservableCollection<MessageViewModel> MyFeed { get; private set; }
+
+ /// <summary>
+ /// A collection for MessageViewModel objects.
+ /// </summary>
+ public ObservableCollection<MessageViewModel> Last { get; private set; }
+
+ public bool IsDataLoaded
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Creates and adds a few MessageViewModel objects into the MyFeed collection.
+ /// </summary>
+ public void LoadData()
+ {
+ var request = new RestRequest("/home?1=1" + "&rnd=" + Environment.TickCount);
+ App.Client.Authenticator = new HttpBasicAuthenticator(App.Account.Credentials.UserName, App.Account.Credentials.Password);
+ App.Client.ExecuteAsync(request, response =>
+ {
+ if (response.StatusCode != HttpStatusCode.OK)
+ {
+ MessageBox.Show(response.StatusCode.ToString());
+ return;
+ }
+ var ser = new DataContractJsonSerializer(typeof (List<Message>));
+
+ var messages =
+ (List<Message>)ser.ReadObject(new MemoryStream(response.RawBytes));
+ MyFeed.Clear();
+ messages.ForEach(post => MyFeed.Add(new MessageViewModel(post)
+ {
+ Status =
+ string.Format(
+ "Posted on: {0}, replies: {1}",
+ post.timestamp,
+ post.replies)
+ }));
+ NotifyPropertyChanged("MyFeed");
+
+ });
+ var lastrequest = new RestRequest("/messages?1=1" + "&rnd=" + Environment.TickCount);
+ App.Client.ExecuteAsync(lastrequest, response =>
+ {
+ var ser = new DataContractJsonSerializer(typeof(List<Message>));
+ using (var ms = new MemoryStream(response.RawBytes))
+ {
+ var messages =
+ (List<Message>)ser.ReadObject(ms);
+ if (messages == null) return;
+ Last.Clear();
+ messages.ForEach(post => Last.Add(new MessageViewModel(post)
+ {
+ Status = string.Format(
+ "Posted on: {0}, replies: {1}",
+ post.timestamp, post.replies
+ )
+ }));
+ NotifyPropertyChanged("Last");
+ }
+ });
+ }
+
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ private void NotifyPropertyChanged(String propertyName)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (null != handler)
+ {
+ handler(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Juick/ViewModels/MessageViewModel.cs b/Juick/ViewModels/MessageViewModel.cs
new file mode 100644
index 0000000..32da0aa
--- /dev/null
+++ b/Juick/ViewModels/MessageViewModel.cs
@@ -0,0 +1,159 @@
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+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.Shapes;
+using Juick.Api;
+
+namespace Juick
+{
+ public class MessageViewModel : INotifyPropertyChanged
+ {
+ public MessageViewModel()
+ {
+
+ }
+
+ public MessageViewModel(Message message)
+ {
+ MID = message.mid;
+ RID = message.rid;
+ Username = message.user.uname;
+ MessageText = HttpUtility.HtmlDecode(message.body);
+ }
+ private int _mid;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public int MID
+ {
+ get
+ {
+ return _mid;
+ }
+ set
+ {
+ if (value != _mid)
+ {
+ _mid = value;
+ NotifyPropertyChanged("MID");
+ }
+ }
+ }
+
+ private int _rid;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public int RID
+ {
+ get
+ {
+ return _rid;
+ }
+ set
+ {
+ if (value != _rid)
+ {
+ _rid = value;
+ NotifyPropertyChanged("RID");
+ }
+ }
+ }
+ private string _username;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public string Username
+ {
+ get
+ {
+ return _username;
+ }
+ set
+ {
+ if (value != _username)
+ {
+ _username = value;
+ NotifyPropertyChanged("Username");
+ }
+ }
+ }
+
+ private Image _avatar;
+ public Image UserAvatar
+ {
+ get { return _avatar; }
+ set
+ {
+ if (value != _avatar)
+ {
+ _avatar = value;
+ NotifyPropertyChanged("Useravatar");
+ }
+ }
+ }
+
+ private string _messageText;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public string MessageText
+ {
+ get
+ {
+ return _messageText;
+ }
+ set
+ {
+ if (value != _messageText)
+ {
+ _messageText = value;
+ NotifyPropertyChanged("MessageText");
+ }
+ }
+ }
+
+ private string _status;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public string Status
+ {
+ get
+ {
+ return _status;
+ }
+ set
+ {
+ if (value != _status)
+ {
+ _status = value;
+ NotifyPropertyChanged("Status");
+ }
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ private void NotifyPropertyChanged(String propertyName)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (null != handler)
+ {
+ handler(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Juick/ViewModels/ThreadViewModel.cs b/Juick/ViewModels/ThreadViewModel.cs
new file mode 100644
index 0000000..48ebe65
--- /dev/null
+++ b/Juick/ViewModels/ThreadViewModel.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.IO;
+using System.Net;
+using System.Net.Browser;
+using System.Runtime.Serialization.Json;
+using Juick.Api;
+using RestSharp;
+
+namespace Juick.ViewModels
+{
+ public class ThreadViewModel : INotifyPropertyChanged
+ {
+ public ThreadViewModel()
+ {
+ this.Items = new ObservableCollection<MessageViewModel>();
+ }
+
+ /// <summary>
+ /// A collection for MessageViewModel objects.
+ /// </summary>
+ public ObservableCollection<MessageViewModel> Items { get; private set; }
+
+ public bool IsDataLoaded
+ {
+ get;
+ private set;
+ }
+
+ public MessageViewModel Root { get; set; }
+
+ /// <summary>
+ /// Creates and adds a few MessageViewModel objects into the MyFeed collection.
+ /// </summary>
+ public void LoadData()
+ {
+ var request = new RestRequest("/thread?mid={mid}" + "&rnd=" + Environment.TickCount);
+ request.AddUrlSegment("mid", string.Format("{0}",Root.MID));
+ App.Client.Authenticator = new HttpBasicAuthenticator(App.Account.Credentials.UserName, App.Account.Credentials.Password);
+ App.Client.ExecuteAsync(request, response =>
+ {
+ using (var responseStream = new MemoryStream(response.RawBytes))
+ {
+ var ser = new DataContractJsonSerializer(typeof (List<Message>));
+ var messages = (List<Message>) ser.ReadObject(responseStream);
+ Items.Clear();
+ messages.ForEach(post =>
+ {
+ this.Items.Add(
+ new MessageViewModel(post));
+ });
+ IsDataLoaded = true;
+ NotifyPropertyChanged("Items");
+ }
+ });
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ private void NotifyPropertyChanged(String propertyName)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (null != handler)
+ {
+ handler(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+}