summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
Diffstat (limited to 'Juick')
-rw-r--r--Juick/ThreadView.xaml13
-rw-r--r--Juick/ThreadView.xaml.cs17
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