From 0c5e49fa07adc2592f42b75728b10e77a242e842 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 24 May 2014 13:18:19 +0400 Subject: 2.0: dropped WP7 support, dropped WPtoolkit --- Juick.sln | 18 ++- Juick/Classes/TileHelper.cs | 130 ++++++++----------- Juick/Controls/MessageList.xaml | 63 +++++---- Juick/Juick.csproj | 98 +++++++++----- Juick/Properties/AssemblyInfo.cs | 4 +- Juick/Properties/WMAppManifest.xml | 33 ++++- Juick/Toolkit.Content/ApplicationBar.Add.png | Bin 339 -> 0 bytes Juick/Toolkit.Content/ApplicationBar.Cancel.png | Bin 350 -> 0 bytes Juick/Toolkit.Content/ApplicationBar.Check.png | Bin 414 -> 0 bytes Juick/Toolkit.Content/ApplicationBar.Delete.png | Bin 445 -> 0 bytes Juick/Toolkit.Content/ApplicationBar.Select.png | Bin 863 -> 0 bytes Juick/ViewModels/PageViewModel.cs | 165 ++++++++++++------------ Juick/packages.config | 3 +- 13 files changed, 278 insertions(+), 236 deletions(-) delete mode 100644 Juick/Toolkit.Content/ApplicationBar.Add.png delete mode 100644 Juick/Toolkit.Content/ApplicationBar.Cancel.png delete mode 100644 Juick/Toolkit.Content/ApplicationBar.Check.png delete mode 100644 Juick/Toolkit.Content/ApplicationBar.Delete.png delete mode 100644 Juick/Toolkit.Content/ApplicationBar.Select.png diff --git a/Juick.sln b/Juick.sln index 83cc7a9..8f1ff6d 100644 --- a/Juick.sln +++ b/Juick.sln @@ -1,20 +1,36 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2010 Express for Windows Phone +# Visual Studio 2012 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 + Debug|ARM = Debug|ARM + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x86 = Release|x86 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}.Debug|ARM.ActiveCfg = Debug|ARM + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Debug|ARM.Build.0 = Debug|ARM + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Debug|ARM.Deploy.0 = Debug|ARM + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Debug|x86.ActiveCfg = Debug|x86 + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Debug|x86.Build.0 = Debug|x86 + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Debug|x86.Deploy.0 = Debug|x86 {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 + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|ARM.ActiveCfg = Release|ARM + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|ARM.Build.0 = Release|ARM + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|ARM.Deploy.0 = Release|ARM + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|x86.ActiveCfg = Release|x86 + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|x86.Build.0 = Release|x86 + {324D7F67-600D-4239-90D9-07C9CA17A4F3}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Juick/Classes/TileHelper.cs b/Juick/Classes/TileHelper.cs index 223340b..aa26690 100644 --- a/Juick/Classes/TileHelper.cs +++ b/Juick/Classes/TileHelper.cs @@ -1,78 +1,52 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Phone.Shell; - -namespace Juick.Classes -{ - static class TileHelper - { - public static void UpdateFlipTile( - string title, - string backTitle, - string backContent, - string wideBackContent, - int? count, - string smallBackgroundImageStringUri, - string backgroundImageStringUri, - string backBackgroundImageStringUri, - string wideBackgroundImageStringUri, - string wideBackBackgroundImageStringUri) - { - if (!CanUseLiveTiles) - { - return; - } - var smallBackgroundImage = CreateRelativeUri(smallBackgroundImageStringUri); - var backgroundImage = CreateRelativeUri(backgroundImageStringUri); - var backBackgroundImage = CreateRelativeUri(backBackgroundImageStringUri); - var wideBackgroundImage = CreateRelativeUri(wideBackgroundImageStringUri); - var wideBackBackgroundImage = CreateRelativeUri(wideBackBackgroundImageStringUri); - - Type flipTileDataType = Type.GetType("Microsoft.Phone.Shell.FlipTileData, Microsoft.Phone"); - - // Get the ShellTile type so we can call the new version of "Update" that takes the new Tile templates. - Type shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone"); - - // Loop through any existing Tiles that are pinned to Start. - foreach (var tileToUpdate in ShellTile.ActiveTiles) - { - var UpdateTileData = flipTileDataType.GetConstructor(new Type[] { }).Invoke(null); - - // Set the properties. - SetProperty(UpdateTileData, "Title", title); - SetProperty(UpdateTileData, "Count", count); - SetProperty(UpdateTileData, "BackTitle", backTitle); - SetProperty(UpdateTileData, "BackContent", backContent); - SetProperty(UpdateTileData, "SmallBackgroundImage", smallBackgroundImage); - SetProperty(UpdateTileData, "BackgroundImage", backgroundImage); - SetProperty(UpdateTileData, "BackBackgroundImage", backBackgroundImage); - SetProperty(UpdateTileData, "WideBackgroundImage", wideBackgroundImage); - SetProperty(UpdateTileData, "WideBackBackgroundImage", wideBackBackgroundImage); - SetProperty(UpdateTileData, "WideBackContent", wideBackContent); - - // Invoke the new version of ShellTile.Update. - shellTileType.GetMethod("Update").Invoke(tileToUpdate, new Object[] { UpdateTileData }); - } - } - - static Uri CreateRelativeUri(string uriString) - { - return !string.IsNullOrEmpty(uriString) ? new Uri(uriString, UriKind.Relative) : null; - } - - static void SetProperty(object instance, string name, object value) - { - var setMethod = instance.GetType().GetProperty(name).GetSetMethod(); - setMethod.Invoke(instance, new object[] { value }); - } - - static readonly Version targetedVersion78 = new Version(7, 10, 8858); - - static bool CanUseLiveTiles - { - get { return Environment.OSVersion.Version >= targetedVersion78; } - } - } -} +using System; +using Microsoft.Phone.Shell; + +namespace Juick.Classes +{ + static class TileHelper + { + public static void UpdateFlipTile( + string title, + string backTitle, + string backContent, + string wideBackContent, + int? count, + string smallBackgroundImageStringUri, + string backgroundImageStringUri, + string backBackgroundImageStringUri, + string wideBackgroundImageStringUri, + string wideBackBackgroundImageStringUri) + { + var smallBackgroundImage = CreateRelativeUri(smallBackgroundImageStringUri); + var backgroundImage = CreateRelativeUri(backgroundImageStringUri); + var backBackgroundImage = CreateRelativeUri(backBackgroundImageStringUri); + var wideBackgroundImage = CreateRelativeUri(wideBackgroundImageStringUri); + var wideBackBackgroundImage = CreateRelativeUri(wideBackBackgroundImageStringUri); + + // Loop through any existing Tiles that are pinned to Start. + foreach (var tileToUpdate in ShellTile.ActiveTiles) + { + var updateTileData = new FlipTileData + { + Title = title, + Count = count, + BackTitle = backTitle, + BackContent = backContent, + SmallBackgroundImage = smallBackgroundImage, + BackgroundImage = backgroundImage, + BackBackgroundImage = backBackgroundImage, + WideBackgroundImage = wideBackgroundImage, + WideBackBackgroundImage = wideBackBackgroundImage, + WideBackContent = wideBackContent + }; + + tileToUpdate.Update(updateTileData); + } + } + + static Uri CreateRelativeUri(string uriString) + { + return !string.IsNullOrEmpty(uriString) ? new Uri(uriString, UriKind.Relative) : null; + } + } +} diff --git a/Juick/Controls/MessageList.xaml b/Juick/Controls/MessageList.xaml index af23c5a..93dd08f 100644 --- a/Juick/Controls/MessageList.xaml +++ b/Juick/Controls/MessageList.xaml @@ -1,32 +1,31 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/Juick/Juick.csproj b/Juick/Juick.csproj index 0125586..dd4c351 100644 --- a/Juick/Juick.csproj +++ b/Juick/Juick.csproj @@ -11,16 +11,18 @@ Properties Juick Juick - v4.0 - $(TargetFrameworkVersion) - WindowsPhone71 - Silverlight + v8.0 + + + + + WindowsPhone true true true - Juick.xap + Juick_$(Configuration)_$(Platform).xap Properties\AppManifest.xml Juick.App true @@ -29,6 +31,7 @@ true true 4.0.30816.0 + 11.0 true @@ -40,6 +43,7 @@ true prompt 4 + false pdbonly @@ -51,30 +55,63 @@ prompt 4 true + false + + + true + Bin\x86\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + full + + + prompt + MinimumRecommendedRules.ruleset + false + + + Bin\x86\Release + CODE_ANALYSIS;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + pdbonly + + + true + prompt + MinimumRecommendedRules.ruleset + + + true + Bin\ARM\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + full + + + prompt + MinimumRecommendedRules.ruleset + false + + + Bin\ARM\Release + CODE_ANALYSIS;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + pdbonly + + + true + prompt + MinimumRecommendedRules.ruleset - - - + + False - ..\packages\WPtoolkit.4.2013.08.16\lib\sl4-windowsphone71\Microsoft.Phone.Controls.Toolkit.dll + ..\packages\RestSharp.104.4.0\lib\sl4-wp71\RestSharp.WindowsPhone.dll - - - - False - ..\packages\RestSharp.104.3.3\lib\sl4-wp71\RestSharp.WindowsPhone.dll - - - - - - - - - - @@ -155,7 +192,9 @@ - + + Designer + Designer @@ -165,11 +204,6 @@ PreserveNewest - - - - - @@ -215,8 +249,8 @@ - - + + + + + + + \ No newline at end of file diff --git a/Juick/Toolkit.Content/ApplicationBar.Add.png b/Juick/Toolkit.Content/ApplicationBar.Add.png deleted file mode 100644 index 4b524d6..0000000 Binary files a/Juick/Toolkit.Content/ApplicationBar.Add.png and /dev/null differ diff --git a/Juick/Toolkit.Content/ApplicationBar.Cancel.png b/Juick/Toolkit.Content/ApplicationBar.Cancel.png deleted file mode 100644 index 4dd724f..0000000 Binary files a/Juick/Toolkit.Content/ApplicationBar.Cancel.png and /dev/null differ diff --git a/Juick/Toolkit.Content/ApplicationBar.Check.png b/Juick/Toolkit.Content/ApplicationBar.Check.png deleted file mode 100644 index 7a07466..0000000 Binary files a/Juick/Toolkit.Content/ApplicationBar.Check.png and /dev/null differ diff --git a/Juick/Toolkit.Content/ApplicationBar.Delete.png b/Juick/Toolkit.Content/ApplicationBar.Delete.png deleted file mode 100644 index 95bb16d..0000000 Binary files a/Juick/Toolkit.Content/ApplicationBar.Delete.png and /dev/null differ diff --git a/Juick/Toolkit.Content/ApplicationBar.Select.png b/Juick/Toolkit.Content/ApplicationBar.Select.png deleted file mode 100644 index 995deaa..0000000 Binary files a/Juick/Toolkit.Content/ApplicationBar.Select.png and /dev/null differ diff --git a/Juick/ViewModels/PageViewModel.cs b/Juick/ViewModels/PageViewModel.cs index 0d57f6a..9781a9e 100644 --- a/Juick/ViewModels/PageViewModel.cs +++ b/Juick/ViewModels/PageViewModel.cs @@ -1,82 +1,83 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Net; -using System.Windows; -using Juick.Classes; -using JuickApi; -using RestSharp; -using Microsoft.Phone.Controls; -using System.Windows.Controls; - -namespace Juick.ViewModels -{ - public class PageViewModel : ViewModelBase - { - public PageViewModel(AppViewModel context) - { - _context = context; - Items = new ObservableCollection(); - LoadMessagesPageCommand = new DelegateCommand(CheckNewData, () => !context.IsDataLoading); - NavigateNextCommand = new DelegateCommand(NavigateToThread, () => true); - } - - private readonly AppViewModel _context; - private string _restUri; - - public string RestUri - { - get { return _restUri; } - set - { - _restUri = value; - } - } - - public virtual string Caption { get; set; } - - public ObservableCollection Items { get; private set; } - - public DelegateCommand LoadMessagesPageCommand { get; private set; } - - public DelegateCommand NavigateNextCommand { get; private set; } - - public void NavigateToThread(SelectionChangedEventArgs param) - { - if (param == null) return; - if (param.AddedItems.Count > 0) - ((App)Application.Current).NavigateTo( - new Uri(string.Format("/ThreadView.xaml?mid={0}", ((PostItem)param.AddedItems[0]).MID), UriKind.Relative)); - } - - public void CheckNewData(LinkUnlinkEventArgs e) - { - const int offset = 5; - if (e == null) return; - var item = e.ContentPresenter.Content; - if (item.Equals(Items[Items.Count - offset])) { - RefreshData(); - } - } - - public void RefreshData() - { - var requestUri = RestUri + "&rnd=" + Environment.TickCount; - if (Items.Count > 0) - { - requestUri += string.Format("&before_mid={0}", Items[Items.Count - 1].MID); - } - - var request = new RestRequest(requestUri); - _context.Client.ExecuteAsync>(request, response => - { - _context.IsDataLoading = false; - if (response.Data == null) - return; - response.Data.Select(x => new PostItem(x)).ToList().ForEach(i => Items.Add(i)); - }); - _context.IsDataLoading = true; - } - } -} +using System; +using System.Linq; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using Juick.Classes; +using JuickApi; +using RestSharp; +using Microsoft.Phone.Controls; + +namespace Juick.ViewModels +{ + public class PageViewModel : ViewModelBase + { + public PageViewModel(AppViewModel context) + { + _context = context; + Items = new ObservableCollection(); + LoadMessagesPageCommand = new DelegateCommand(CheckNewData, () => !context.IsDataLoading); + NavigateNextCommand = new DelegateCommand(NavigateToThread, () => true); + } + + private readonly AppViewModel _context; + private string _restUri; + + public string RestUri + { + get { return _restUri; } + set + { + _restUri = value; + } + } + + public virtual string Caption { get; set; } + + public ObservableCollection Items { get; private set; } + + public DelegateCommand LoadMessagesPageCommand { get; private set; } + + public DelegateCommand NavigateNextCommand { get; private set; } + + public void NavigateToThread(GestureEventArgs param) + { + PostItem post = ((FrameworkElement)param.OriginalSource).DataContext as PostItem; + + if (post != null) + ((App)Application.Current).NavigateTo( + new Uri(string.Format("/ThreadView.xaml?mid={0}", post.MID), UriKind.Relative)); + } + + public void CheckNewData(ItemRealizationEventArgs e) + { + const int offset = 5; + if (e == null) return; + var item = e.Container.Content; + if (item.Equals(Items[Items.Count - offset])) { + RefreshData(); + } + } + + public void RefreshData() + { + var requestUri = RestUri + "&rnd=" + Environment.TickCount; + if (Items.Count > 0) + { + requestUri += string.Format("&before_mid={0}", Items[Items.Count - 1].MID); + } + + var request = new RestRequest(requestUri); + _context.Client.ExecuteAsync>(request, response => + { + _context.IsDataLoading = false; + if (response.Data == null) + return; + response.Data.Select(x => new PostItem(x)).ToList().ForEach(i => Items.Add(i)); + }); + _context.IsDataLoading = true; + } + } +} diff --git a/Juick/packages.config b/Juick/packages.config index 97ef741..7999f81 100644 --- a/Juick/packages.config +++ b/Juick/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file -- cgit v1.2.3