diff options
author | Vitaly Takmazov | 2013-04-16 00:00:41 +0400 |
---|---|---|
committer | Vitaly Takmazov | 2013-04-16 00:00:41 +0400 |
commit | e7fb2a3794bc7fb3c6592312d2628d9d11eedf3b (patch) | |
tree | a9251f39e7cd17943aab14f622a952ab5e52cfeb | |
parent | 72fff339e1652564c53d9c639c7af13617fb6fc9 (diff) | |
parent | 24f6729fb64679bb54feca2ed35577c0bf7dcb43 (diff) |
Merge branch 'master' of bitbucket.org:vitalyster/juick-windowsphone
-rw-r--r-- | Juick/ThreadView.xaml | 13 | ||||
-rw-r--r-- | Juick/ThreadView.xaml.cs | 17 |
2 files changed, 23 insertions, 7 deletions
diff --git a/Juick/ThreadView.xaml b/Juick/ThreadView.xaml index 0665055..14a6f75 100644 --- a/Juick/ThreadView.xaml +++ b/Juick/ThreadView.xaml @@ -76,16 +76,15 @@ </Grid>
</Grid>
- <!--Sample code showing usage of ApplicationBar-->
- <!-- phone:PhoneApplicationPage.ApplicationBar>
+ <phone:PhoneApplicationPage.ApplicationBar>
<phoneshell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
- <phoneshell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
- <phoneshell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
+ <!--<phoneshell:ApplicationBarIconButton IconUri="/Images/appbar.feature.email.rest.png" Text="New post" Click="ApplicationBarIconButtonClick1"/>
+ <phoneshell:ApplicationBarIconButton IconUri="/Images/appbar.refresh.rest.png" Text="Refresh" Click="ApplicationBarIconButtonClick" />-->
+
<phoneshell:ApplicationBar.MenuItems>
- <phoneshell:ApplicationBarMenuItem Text="MenuItem 1"/>
- <phoneshell:ApplicationBarMenuItem Text="MenuItem 2"/>
+ <phoneshell:ApplicationBarMenuItem Text="Recommend/Unrecommend" Click="RecommendBarMenuItem_Click"/>
</phoneshell:ApplicationBar.MenuItems>
</phoneshell:ApplicationBar>
- </phone:PhoneApplicationPage.ApplicationBar -->
+ </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
diff --git a/Juick/ThreadView.xaml.cs b/Juick/ThreadView.xaml.cs index b197a8b..4e1da97 100644 --- a/Juick/ThreadView.xaml.cs +++ b/Juick/ThreadView.xaml.cs @@ -7,6 +7,8 @@ using Microsoft.Phone.Controls; using Microsoft.Phone.Shell;
using System.Windows.Data;
using System.Windows;
+using RestSharp;
+using System.Net;
namespace Juick
{
@@ -72,5 +74,20 @@ namespace Juick // Reset selected index to -1 (no selection)
((ListBox)sender).SelectedIndex = -1;
}
+
+ void RecommendBarMenuItem_Click(object sender, EventArgs e)
+ {
+ var request = new RestRequest("/post", Method.POST);
+ request.AddParameter("body", "! #" + Model.Mid);
+ App.AppContext.Client.ExecuteAsync(request, response =>
+ {
+ App.AppContext.IsDataLoading = false;
+ if (response.StatusCode != HttpStatusCode.OK && !string.IsNullOrEmpty(response.Content))
+ {
+ MessageBox.Show(string.Concat(response.StatusCode, ": ", response.Content));
+ }
+ });
+ App.AppContext.IsDataLoading = true;
+ }
}
}
\ No newline at end of file |