190 Commits

Author SHA1 Message Date
swcs 81f099d419 update version 2014-03-13 21:25:04 +01:00
Stephen Erstad ec006b298d Added test for Json property for PocketItem
Tested that the Json property is set on the retrieved PocketItems and
that they represent a JSON object
2014-03-04 22:35:50 -06:00
Stephen Erstad 4fa0ee29fe Raw JSON on PocketItem Model
Implementation of setting the raw JSON representation of a PocketItem to
the PocketSharp model
2014-03-04 22:12:08 -06:00
swcs c21abd5f21 try to normalize URIs retrieved in video array; update tests; 2014-02-23 21:03:55 +01:00
swcs facba2894d update packages solution-wide 2014-02-21 23:50:24 +01:00
swcs 585c203f9a fix PocketAction conversion exception when no ID is given; fixes #20 2014-02-17 23:30:15 +01:00
swcs 07357b9327 add wp7 project 2014-02-11 21:55:22 +01:00
swcs 75e6a23905 update dependencies 2014-02-10 22:48:35 +01:00
swcs 44c4bc11db update nuspec file 2014-02-07 14:31:09 +01:00
swcs d3d8937c60 update changelog 2014-02-07 14:24:25 +01:00
swcs b2113eb065 allow toggle for disabling mobile param 2014-02-07 14:22:52 +01:00
swcs 13664c4201 fixes #18 - new registration via redirect 2014-02-07 14:12:09 +01:00
swcs 13c98e2d59 fixes #17 2014-02-07 14:10:12 +01:00
swcs 7b14044c53 password has to be at least 6 chars long 2014-02-06 13:28:28 +01:00
swcs 0be1efb2df start new exceptions 2014-01-18 21:36:01 +01:00
swcs 13e029a98a use FullTitle if no title given 2013-12-28 14:03:58 +01:00
swcs c6cf19ba4d bump version 2013-12-27 21:45:09 +01:00
swcs 50c15ad6ce remove exception debug code 2013-12-27 21:34:53 +01:00
swcs 670fecb1e0 respect given_url if no resolved_url is given 2013-12-27 21:34:22 +01:00
swcs 85c4ca2c65 update readme 2013-12-19 11:27:11 +01:00
swcs 0183a727ce update readme 2013-12-19 11:25:51 +01:00
swcs 25bb5028a5 Remove PocketSharp.Reader => moved to ReadSharp
See https://github.com/ceee/ReadSharp if you want to use ReadSharp
2013-12-19 11:24:22 +01:00
swcs 3201160d66 move image extractor into NReadability 2013-12-16 22:08:23 +01:00
swcs 996755ef50 extract images from article in Reader 2013-12-16 21:42:11 +01:00
swcs 6e6cef138a update tests; remove PocketArticle from PocketSharp 2013-12-16 21:11:04 +01:00
swcs bcb833ad0d remove PocketSharp dependency from Reader; move PocketArticle into Reader project; 2013-12-16 21:07:34 +01:00
swcs e33ec074fe PreRequest in IPocketClient 2013-12-15 12:49:45 +01:00
swcs a2e68af4dc update readme 2013-12-15 11:50:37 +01:00
swcs ab5361c370 bump version 2013-12-15 11:42:53 +01:00
swcs 4718faf76a HasImage and HasVideo has to be nullable for unresolved items 2013-12-15 11:10:56 +01:00
swcs f6e7594233 respect normal_uri, if submitted; PocketItem.ID as string 2013-12-15 11:00:00 +01:00
swcs c39f8ec7f0 make PocketBoolean internal 2013-12-07 20:42:12 +01:00
ScottIsAFool c1981bbb24 Fixed the HasImage and HasVideo properties 2013-12-07 17:30:53 +00:00
ScottIsAFool 425faf7a90 Added IsVideo, IsImage and ResolvedId props 2013-12-07 16:47:18 +00:00
swcs a1fae6b3ce fix PocketAction conversion 2013-12-04 22:14:29 +01:00
swcs 84981a5de3 add TweetID for Send actions 2013-12-04 20:31:23 +01:00
swcs 5480cebe49 publicly cache last response headers and data 2013-12-03 22:28:22 +01:00
swcs 3fca5a059b update tests 2013-12-02 22:51:24 +01:00
swcs 5854c0c04f rebuild issue #13 in WP8 sample (via Button click) 2013-11-23 22:45:03 +01:00
swcs e2ca21b3be add tests for the since parameter 2013-11-21 21:45:49 +01:00
swcs 178920008b fixes #12
ObjectToArrayConverter returns null when the TokenType is Null.
2013-11-20 20:45:55 +01:00
swcs 67c48839d9 fixes #12
Update ObjectToArrayConverter to return null when JObject cannot be
created
2013-11-19 19:30:59 +01:00
swcs e2bf62e506 Fix accessCode in examples 2013-11-18 23:12:30 +01:00
swcs 31c69fb12b merge 2013-11-18 22:52:39 +01:00
ScottIsAFool 42693a967e Added HttpClientHandler and timeout to ctors 2013-11-18 18:05:02 +00:00
swcs 29f57085aa add IE11 user agent for PocketReader; update to RC3 2013-11-16 15:34:36 +01:00
swcs 5ba027bafc test SendActions 2013-11-16 15:27:54 +01:00
swcs 33e6e9b02d add SendActions method 2013-11-16 15:09:21 +01:00
swcs 44376c0852 IPocketReader interface 2013-11-15 14:30:20 +01:00
swcs a643e5c556 update readme 2013-11-15 14:23:21 +01:00
swcs b2ce585966 bodyOnly and noHeadline options for PocketReader.Read 2013-11-15 14:20:56 +01:00
swcs 6f6d054044 update readme 2013-11-15 13:52:22 +01:00
swcs ff4fae1d35 add second NuGet package for PocketReader; allow user agent in PocketReader constructor 2013-11-15 13:43:27 +01:00
swcs f5c8d45013 move PocketReader into own project 2013-11-15 13:28:16 +01:00
swcs ad40a25b0b make user agent a public property in PocketReader 2013-11-14 20:02:56 +01:00
swcs eb3ac1f152 Update README.md 2013-11-14 19:53:56 +01:00
swcs 3bff4d823f update dependencies 2013-11-14 19:33:55 +01:00
swcs 0427399746 add stress tests 2013-11-13 20:23:02 +01:00
swcs ee989fc019 custom UriConverter to check for invalid URIs 2013-11-12 22:08:02 +01:00
swcs 2a9c30a69b add PreRequest action for all requests 2013-11-11 22:00:41 +01:00
swcs 95d7a5d993 make CancellationToken an optional parameter 2013-11-08 09:31:35 +01:00
swcs bf5d8a50ce cancellationToken for ALL methods - completed; remove obsolete methods in preparation for v3 2013-11-08 01:44:32 +01:00
swcs 10e9575303 cancellationToken for Modify methods 2013-11-08 01:33:32 +01:00
swcs feff91ffd8 cancellationToken for Get methods 2013-11-08 01:24:58 +01:00
swcs 50d896c670 cancellationToken for Add and Account methods 2013-11-08 01:12:34 +01:00
swcs f0ffeb5a68 Merge branch 'stress' 2013-11-08 00:56:02 +01:00
swcs 6b3819b87b require Uri to be absolute in Add method 2013-11-08 00:55:44 +01:00
swcs 8df2836563 add CancellationToken to PocketClient; methods later; 2013-11-06 20:47:53 +01:00
swcs d856e75e76 make test playlists working for XUnit update 2013-11-05 23:31:19 +01:00
swcs 82c9ecd6b5 remove Utilities.DictionaryToList - not needed 2013-11-05 23:17:45 +01:00
swcs 7147d8022e update docs 2013-11-05 23:13:14 +01:00
swcs b1888ac20e Merge branch 'master' of github.com:ceee/PocketSharp 2013-11-04 22:46:47 +01:00
swcs cb8d1d9d43 make Test playlists; refactored PocketItem inline lists (setters are working now); 2013-11-04 22:46:30 +01:00
swcs 2b932d4c07 Update README.md 2013-11-04 08:26:23 +01:00
swcs bc30ea613a Merge branch 'ScottIsAFool-master' 2013-11-03 20:24:45 +01:00
swcs b1b145204e add regions 2013-11-03 20:24:32 +01:00
swcs 01be59b347 add FillAccount method for stress tests 2013-11-03 20:18:57 +01:00
ScottIsAFool af3e2b400b Added IPocketClient interface
Any future public methods that get added in any partial files just need
adding to the interface file too.
2013-11-03 18:07:26 +00:00
swcs 396cf69a40 convert nulls for bool and int in JSOn reader; update stress tests 2013-11-03 18:27:35 +01:00
swcs 088f6a4e0e add stress test wrapper and URL csv's 2013-11-02 10:32:38 +01:00
swcs 25a25472b3 add test for too short passwords in registration 2013-11-02 10:18:33 +01:00
swcs b5b7638ea7 bump version 2013-11-01 16:41:14 +01:00
swcs 6616c2e223 Merge branch 'master' of github.com:ceee/PocketSharp 2013-11-01 16:38:47 +01:00
swcs 145b4456ea remove website 2013-11-01 16:38:24 +01:00
swcs 8dedf11d24 require password in RegisterAccount to be at least 3 chars long 2013-11-01 16:35:16 +01:00
swcs 9caeefbe3c Update README.md 2013-10-29 09:02:15 +01:00
swcs de143d4605 Update README.md 2013-10-29 09:01:06 +01:00
swcs e63dfb60d0 update changelog 2013-10-27 13:35:44 +01:00
swcs 9b19739fc9 update nuspec 2013-10-27 13:32:33 +01:00
swcs ff8bbf17d3 fix serious issue in retrieving <body> in BodyOnly serializer for NReadability 2013-10-27 13:27:45 +01:00
swcs da892067ad resolve conflicts; make GetAccessCode obsolete 2013-10-26 13:16:35 +02:00
swcs 3992a988fc Merge branch 'master' of github.com:ScottIsAFool/PocketSharp into ScottIsAFool-master 2013-10-26 13:05:14 +02:00
ScottIsAFool 2a98cfb0e4 Added new method to return username too 2013-10-25 15:49:47 +01:00
swcs 3057612872 update contributors 2013-10-25 15:22:13 +02:00
swcs 56180b5829 update contributors 2013-10-25 15:21:26 +02:00
swcs 2a08adef45 update version 2013-10-25 15:19:42 +02:00
swcs abfb9f6d78 remove unused using 2013-10-25 15:05:47 +02:00
swcs a1f6637e9d retrieve API usage limits; rename Statistics() to GetUserStatistics(); 2013-10-25 00:52:29 +02:00
swcs 8bce874504 Merge branch 'ScottIsAFool-master' 2013-10-25 00:05:46 +02:00
swcs 50ee8905c5 add PORTABLE constant to SgmlReader 2013-10-25 00:05:42 +02:00
swcs 4d2650072f Merge branch 'master' of github.com:ScottIsAFool/PocketSharp into ScottIsAFool-master 2013-10-24 22:40:18 +02:00
ScottIsAFool 65e31ac2e2 Missed files for propertychanged 2013-10-24 21:37:52 +01:00
swcs 456c4f17f2 Merge branch 'master' of github.com:ScottIsAFool/PocketSharp into ScottIsAFool-master 2013-10-24 21:55:40 +02:00
ScottIsAFool ee1e32b9ab Added Fody/PropertyChanged 2013-10-24 18:44:22 +01:00
swcs 9d677eea5a Merge pull request #7 from ScottIsAFool/master
Made CallbackUri public
2013-10-24 00:44:11 -07:00
ScottIsAFool 64098518fa Made CallbackUri public 2013-10-24 06:52:09 +01:00
swcs cc6aab227d Update README.md 2013-10-23 20:27:19 +02:00
swcs 543b3e8191 Update README.md 2013-10-23 20:26:40 +02:00
swcs 2186561fd8 update readme 2013-10-22 21:46:55 +02:00
swcs 8650883975 Merge branch 'master' of github.com:ceee/PocketSharp 2013-10-22 21:46:35 +02:00
swcs 6ede86c367 allow PocketSharp to be used in .NET 4.0 2013-10-22 21:46:24 +02:00
swcs d373bdd9bf Update README.md 2013-10-21 22:12:53 +02:00
swcs b4ae55d8ab update assembly information 2013-10-20 22:20:37 +02:00
swcs aae43cf00d bump version; update docs 2013-10-19 16:40:14 +02:00
swcs a0e8022f1d Merge branch 'master' of github.com:ceee/PocketSharp 2013-10-19 16:35:02 +02:00
swcs 4119dec95d move utilites; catch HttpRequestException; Read Article from URI 2013-10-19 16:30:01 +02:00
swcs cf2d929d3a Update README.md 2013-10-18 19:28:32 +02:00
swcs e772b8df9e update some spelling mistakes 2013-10-17 15:43:23 +02:00
swcs d9c4b4c51f update documentation and website 2013-10-17 15:34:05 +02:00
swcs 4222e873c7 Merge branch 'master' of github.com:ceee/PocketSharp 2013-10-17 14:51:36 +02:00
swcs 6e02a797b5 remove MaxAutomaticRedirections as not supported on all platforms 2013-10-17 14:51:11 +02:00
swcs 329e16ebd5 update portableports assembly names 2013-10-17 14:33:34 +02:00
swcs 52bac490b4 update portable ports names 2013-10-17 14:28:56 +02:00
swcs 1d500d0d4b update Reader comments and bump assembly version 2013-10-17 14:24:07 +02:00
swcs a731a744bc add Reader Tests; add PocketArticle response object 2013-10-17 14:17:48 +02:00
swcs 352af4f736 fix NReadability CSS issue 2013-10-17 13:28:17 +02:00
swcs 1c74d6ebf4 move Ports into internal namespace; Update JSON.NET 2013-10-17 12:49:52 +02:00
swcs c4d6ea45ea Update README.md 2013-10-16 20:37:19 +02:00
swcs 649ded199d extend NReadability to allow output of body only 2013-10-15 22:21:17 +02:00
swcs ef10ca23a4 rewrite doctype to HTML5 2013-10-15 22:01:22 +02:00
swcs 9c0cf6cb3a allow better customization of nreadability output from PocketSharp assembly 2013-10-15 21:52:33 +02:00
swcs dbb495ce76 Merge branch 'master' of github.com:ceee/PocketSharp 2013-10-15 21:09:38 +02:00
swcs 4e6fdc33d6 update SgmlReader Port to include HTML DTD 2013-10-15 21:09:22 +02:00
swcs 9cc1f231d9 Update README.md 2013-10-15 19:47:42 +02:00
swcs 4136e4cc4b move PocketReader into PocketSharp project 2013-10-14 21:27:45 +02:00
swcs 7aee628000 add reader project (work in progress) 2013-10-13 20:55:28 +02:00
swcs ff3c6a6826 remove Reader for now ... 2013-10-08 22:25:11 +02:00
swcs 2ec09a4a67 Merge pull request #5 from ceee/reader
converted SgmlReader & NReadability to PCL; start reader project
2013-10-01 14:30:30 -07:00
swcs 266f494db6 converted SgmlReader & NReadability to PCL; start reader project 2013-10-01 23:26:28 +02:00
swcs c2b6eab709 update version 2013-09-30 23:30:16 +02:00
swcs f19fdd227b fix RetrieveFilter.All; improve search speed 2013-09-30 23:24:18 +02:00
swcs f231231f4e fix readme formatting issue 2013-09-29 23:28:06 +02:00
swcs a1a5076895 update website 2013-09-29 23:24:07 +02:00
swcs 11769d65fd update readme 2013-09-29 23:22:03 +02:00
swcs 2aa7e3de90 update assembly version 2013-09-28 19:22:24 +02:00
swcs 7564855597 update comments 2013-09-27 09:34:55 +02:00
swcs 3564bc8273 allow dashes in username 2013-09-27 01:08:13 +02:00
swcs 2154740550 add account registration 2013-09-27 01:03:02 +02:00
swcs 966a35e2c6 add statistics API 2013-09-27 00:12:02 +02:00
swcs 90199ebe1f add Whats Next section to readme 2013-09-22 18:26:12 +02:00
swcs 208b157465 update website 2013-09-21 21:11:52 +02:00
swcs 54a82ea215 remove retrieve file 2013-09-21 21:06:38 +02:00
swcs 5136fe0ac4 update Microsoft.Net.HTTP package; update version and docs 2013-09-21 21:06:18 +02:00
swcs 74063723df ability to retrieve all tags 2013-09-21 20:48:50 +02:00
swcs cb6fc4e113 rename Retrieve => Get; add overload for Get for filters 2013-09-21 20:20:50 +02:00
swcs f8eaf47f80 update method documentation 2013-09-21 00:06:56 +02:00
swcs a8cc4c14de invalid retrieval Tests 2013-09-20 23:20:44 +02:00
swcs d7e324129c update version 2013-09-19 18:24:56 +02:00
swcs 1912563cc3 RemoveTag method; fix tag conversion; add modify tests 2013-09-19 18:08:41 +02:00
swcs 64c74b11d7 add item retrieval by ID 2013-09-19 12:13:07 +02:00
swcs e9699caf4e remove actionresults from response due to inconsistent behaviour 2013-09-19 11:47:57 +02:00
swcs 76af7fec0e add modification tests 2013-09-19 11:47:23 +02:00
swcs 4e40aaa0dc update readme 2013-09-18 21:19:38 +02:00
swcs 242428f94c bump version 2013-09-18 21:17:56 +02:00
swcs d009afd033 correct serialization of DateTime and Boolean values 2013-09-18 21:14:07 +02:00
swcs de1e4efc70 update retrieve tests 2013-09-18 21:01:51 +02:00
swcs e198ecdd6b update docs 2013-09-17 23:28:28 +02:00
swcs fb92cb19c8 update retrieve methods - work with named parameters 2013-09-17 23:08:15 +02:00
swcs 79184d194e fix tag parameter conversion; lead image generation; add complex item test; 2013-09-17 22:48:35 +02:00
swcs 9d0fb6484f fix modification requests 2013-09-17 21:43:31 +02:00
swcs e45414bd51 remove depr. classes 2013-09-16 23:34:26 +02:00
swcs e522c8e30a simplify parameter creation; fix several deserialization issues 2013-09-16 23:34:13 +02:00
swcs 6cf9892f78 disposable base for tests; classes for other tests 2013-09-15 21:52:28 +02:00
swcs d3c40c1a76 add tests for Retrieve methods 2013-09-15 21:44:09 +02:00
swcs c01098af04 update website and docs 2013-09-15 15:46:13 +02:00
swcs 813b1ab5b0 update assembly info; create new nuspec file 2013-09-15 15:19:33 +02:00
swcs 91b18e1eab add silverlight example 2013-09-15 12:38:41 +02:00
swcs b6bd02a5cc add WP8 example 2013-09-14 19:33:38 +02:00
swcs 25a3f4ef2f add WPF example 2013-09-14 15:47:51 +02:00
swcs 6114c3af9a exception handling / validation for requests and parsing 2013-09-14 15:12:28 +02:00
swcs a507cf6d0a add custom deserializers; update data-attributes for json.net 2013-09-14 13:40:20 +02:00
swcs 25321ee107 update tests 2013-09-12 11:40:25 +02:00
swcs f9268ea6be start async + pcl implementation 2013-09-12 11:39:48 +02:00
swcs f2134b8c80 prepare Models for PCL 2013-09-11 22:31:32 +02:00
swcs c7565d7684 make components async (won't work yet) 2013-09-11 22:31:01 +02:00
swcs a4666f843c update readme 2013-09-09 20:51:50 +02:00
swcs c545152957 update readme 2013-09-06 11:36:41 +02:00
swcs 490b005002 update readme 2013-09-05 21:58:13 +02:00
swcs a07a509042 update history listing for website 2013-08-19 09:06:54 +02:00
swcs 5c7f398b51 bump version; 2013-08-16 14:02:12 +02:00
197 changed files with 116344 additions and 14686 deletions
+2 -8
View File
@@ -1,21 +1,15 @@
; This file is for unifying the coding style for different editors and IDEs
; editorconfig.org
; defaults by Tobias Klika
; 2013
root = true
; default settings for all files
[*]
end_of_line = crlf ; this is git standard, so it won't convert it anymore
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
trim_trailing_whitespace = false
+1 -1
View File
@@ -165,4 +165,4 @@ $RECYCLE.BIN/
# =========================
PocketSharp.Console/
!PocketSharp.Website/Release/
!PocketSharp.Website/Release/
BIN
View File
Binary file not shown.
+8 -5
View File
@@ -18,9 +18,9 @@
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>
@@ -50,9 +50,12 @@
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir "$(SolutionDir) " </RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties Configuration=$(Configuration) $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
@@ -118,7 +121,7 @@
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
return true;
}

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

+126
View File
@@ -0,0 +1,126 @@
### 3.2.0 (2014-03-13)
- add raw JSON to each PocketItem (PR #22)
### 3.1.1 (2014-02-23)
- fix SendActions when sending _add_ requests (fixes #20)
- try to normalize URIs retrieved in video array
### 3.1.0 (2014-02-07)
- Use FullTitle if no other title props are available
- Default mobile authentication screen with toggle for desktop (fixes #17)
- Use new registration endpoint
### 3.0.2 (2013-12-27)
- assign given_url to `Uri` when item couldn't be resolved by Pocket
### 3.0.1 (2013-12-15)
- added `PreRequest` to interface
### 3.0.0 (2013-12-15)
- `cancellationToken` support for all methods
- Toggle inclusion of title in PocketArticle.Content
- Make setters for inline objects in PocketItem (images, videos, ...)
- IPocketClient interface
- PreRequest callback allows injection of `Action<string>` before every request
- `lastHeaders` and `lastRequestData` in PocketClient for better debugging
- Submit multiple actions in one request with `SendActions`
- New `IsVideo`, `IsImage` and `ResolvedId` as new properties in PocketItem
- Split PocketReader into own NuGet package
- A lot of bugfixes
### 2.2.2 (2013-11-01)
- Password validation in RegisterAccount
### 2.2.1 (2013-10-27)
- Fix NReadability parsing issue
### 2.2.0 (2013-10-26)
- Made `GetAccessCode` obsolete
- Return username after authentication with `GetUser`
### 2.1.0 (2013-10-25)
- Rename `Statistics()` to `GetUserStatistics()`
- Made `CallbackUri` public
- Added Fody/PropertyChanged
- Method `GetUsageLimits()` to retrieve API usage limits
- Add PORTABLE constant to SgmlReader
### 2.0.1 (2013-10-19)
- Catch HttpRequestExceptions and provide as InnerException for PocketException
- Read Article from URI (method overload)
### 2.0.0 (2013-10-17)
- Add Reader API _(does not use the official Article View API, which is private. The PocketReader is based on a custom PCL port of NReadability and SgmlReader)_
### 1.5.1 (2013-09-30)
- `RetrieveFilter.All` didn't work
- improve search speed
### 1.5.0 (2013-09-28)
- add statistics API
- add registration API
### 1.4.0 (2013-09-21)
- rename `Retrieve` to `Get`
- update IntelliSense documentation
- add `GetTags` method
### 1.3.0 (2013-09-19)
- get Item by ID
- tag modification bugfixes
### 1.2.1 (2013-09-18)
- correct parameter conversion for DateTime and Boolean
### 1.2.0 (2013-09-17)
- simplified retrieve methods
### 1.1.0 (2013-09-17)
- fix modification requests
### 1.0.0 (2013-09-15)
- convert to PCL
- implement async
### 0.3.2 (2013-08-16)
- tag modification fixed
- full retrieval of items for Retrieve method
### 0.3.1 (2013-07-07)
- authentication fixes
### 0.3.0 (2013-07-02)
- update authentication process
### 0.2.0 (2013-06-27)
- add, modify item
- modify tags
### 0.1.0 (2013-06-26)
- authentication
- retrieve functionality
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2013 cee, Tobias Klika
Copyright (c) 2014 cee, Tobias Klika
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -0,0 +1,8 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="PocketSharp.Silverlight.App"
>
<Application.Resources>
</Application.Resources>
</Application>
@@ -0,0 +1,68 @@
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;
namespace PocketSharp.Silverlight
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}
@@ -0,0 +1,16 @@
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="PocketSharp.Silverlight.MainPage"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Button Content="Load Items" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="380" Height="34" Click="Button_Click"/>
<sdk:DataGrid x:Name="Content" HorizontalAlignment="Left" Height="241" Margin="10,49,0,0" VerticalAlignment="Top" Width="380" FrozenColumnCount="2"/>
</Grid>
</UserControl>
@@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace PocketSharp.Silverlight
{
public partial class MainPage : UserControl
{
ObservableCollection<Site> _Sites = new ObservableCollection<Site>();
public ObservableCollection<Site> Sites { get { return _Sites; } }
public class Site
{
public string Url { get; set; }
public string Content { get; set; }
}
public MainPage()
{
InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
// !! please don't misuse this account !!
PocketClient client = new PocketClient(
consumerKey: "15396-f6f92101d72c8e270a6c9bb3",
callbackUri: "http://frontendplay.com",
accessCode: "80acf6c5-c198-03c0-b94c-e74402"
);
List<PocketSharp.Models.PocketItem> items = null;
try
{
items = await client.Get();
items.ForEach(item =>
{
Sites.Add(new Site()
{
Content = item.Title,
Url = item.Uri.ToString()
});
});
Content.ItemsSource = Sites;
}
catch (PocketException ex)
{
Debug.WriteLine(ex.Message);
}
}
}
}
@@ -0,0 +1,172 @@
<?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>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp.Silverlight</RootNamespace>
<AssemblyName>PocketSharp.Silverlight</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>PocketSharp.Silverlight.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>PocketSharp.Silverlight.App</SilverlightAppEntry>
<TestPageFileName>PocketSharp.SilverlightTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
<ExpressionBlendVersion>12.0.40612.10</ExpressionBlendVersion>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</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</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Silverlight, Version=1.0.165.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.Extensions.Silverlight.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.IO, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Runtime, Version=2.6.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks, Version=2.6.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core">
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Windows.Controls.Data" />
<Reference Include="System.Windows.Controls.Data.Input" />
<Reference Include="System.Windows.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PocketSharp\PocketSharp.csproj">
<Project>{817200c3-a327-4e35-9b5f-63a51c088577}</Project>
<Name>PocketSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\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>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
</Project>
@@ -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>
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("PocketSharp.Silverlight")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PocketSharp.Silverlight")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("656345d2-af4c-4f88-9c9f-ebf54d7691db")]
// 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")]
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="sl50" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="sl50" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="sl50" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="sl50" />
</packages>
@@ -0,0 +1,10 @@
<Application x:Class="PocketSharp.WP8.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:d="http://schemas.microsoft.com/expression/blend/2008" d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006">
<!--Application Resources-->
<Application.Resources>
<local:LocalizedStrings xmlns:local="clr-namespace:PocketSharp.WP8" x:Key="LocalizedStrings" />
</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>
@@ -0,0 +1,246 @@
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using PocketSharp.WP8.Resources;
using PocketSharp.WP8.ViewModels;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Navigation;
namespace PocketSharp.WP8
{
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
if (viewModel == null)
viewModel = new MainViewModel();
return viewModel;
}
}
/// <summary>
/// Provides easy access to the root frame of the Phone Application.
/// </summary>
/// <returns>The root frame of the Phone Application.</returns>
public static PhoneApplicationFrame RootFrame { get; private set; }
/// <summary>
/// Constructor for the Application object.
/// </summary>
public App()
{
// Global handler for uncaught exceptions.
UnhandledException += Application_UnhandledException;
// Standard XAML initialization
InitializeComponent();
// Phone-specific initialization
InitializePhoneApplication();
// Language display initialization
InitializeLanguage();
// Show graphics profiling information while debugging.
if (Debugger.IsAttached)
{
// Display the current frame rate counters.
Application.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 GPU with a colored overlay.
//Application.Current.Host.Settings.EnableCacheVisualization = true;
// Prevent the screen from turning off while under the debugger by disabling
// the application's idle detection.
// 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 (Debugger.IsAttached)
{
// A navigation has failed; break into the debugger
Debugger.Break();
}
}
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
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;
// Handle reset requests for clearing the backstack
RootFrame.Navigated += CheckForResetNavigation;
// 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;
}
private void CheckForResetNavigation(object sender, NavigationEventArgs e)
{
// If the app has received a 'reset' navigation, then we need to check
// on the next navigation to see if the page stack should be reset
if (e.NavigationMode == NavigationMode.Reset)
RootFrame.Navigated += ClearBackStackAfterReset;
}
private void ClearBackStackAfterReset(object sender, NavigationEventArgs e)
{
// Unregister the event so it doesn't get called again
RootFrame.Navigated -= ClearBackStackAfterReset;
// Only clear the stack for 'new' (forward) and 'refresh' navigations
if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh)
return;
// For UI consistency, clear the entire page stack
while (RootFrame.RemoveBackEntry() != null)
{
; // do nothing
}
}
#endregion
// Initialize the app's font and flow direction as defined in its localized resource strings.
//
// To ensure that the font of your application is aligned with its supported languages and that the
// FlowDirection for each of those languages follows its traditional direction, ResourceLanguage
// and ResourceFlowDirection should be initialized in each resx file to match these values with that
// file's culture. For example:
//
// AppResources.es-ES.resx
// ResourceLanguage's value should be "es-ES"
// ResourceFlowDirection's value should be "LeftToRight"
//
// AppResources.ar-SA.resx
// ResourceLanguage's value should be "ar-SA"
// ResourceFlowDirection's value should be "RightToLeft"
//
// For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072.
//
private void InitializeLanguage()
{
try
{
// Set the font to match the display language defined by the
// ResourceLanguage resource string for each supported language.
//
// Fall back to the font of the neutral language if the Display
// language of the phone is not supported.
//
// If a compiler error is hit then ResourceLanguage is missing from
// the resource file.
RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage);
// Set the FlowDirection of all elements under the root frame based
// on the ResourceFlowDirection resource string for each
// supported language.
//
// If a compiler error is hit then ResourceFlowDirection is missing from
// the resource file.
FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection);
RootFrame.FlowDirection = flow;
}
catch
{
// If an exception is caught here it is most likely due to either
// ResourceLangauge not being correctly set to a supported language
// code or ResourceFlowDirection is set to a value other than LeftToRight
// or RightToLeft.
if (Debugger.IsAttached)
{
Debugger.Break();
}
throw;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1,44 @@
<phone:PhoneApplicationPage
x:Class="PocketSharp.WP8.DetailsPage"
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"
d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<!--Data context is set to sample data above and first item in sample data collection below and LayoutRoot contains the root grid where all other page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent" d:DataContext="{Binding Items[0]}">
<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 Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding LineOne}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel contains details text. Place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<TextBlock Text="{Binding LineThree}" TextWrapping="Wrap" Style="{StaticResource PhoneTextNormalStyle}"/>
</Grid>
<!--Uncomment to see an alignment grid to help ensure your controls are
aligned on common boundaries. The image has a top margin of -32px to
account for the System Tray. Set this to 0 (or remove the margin altogether)
if the System Tray is hidden.
Before shipping remove this XAML and the image itself.-->
<!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->
</Grid>
</phone:PhoneApplicationPage>
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using PocketSharp.WP8.Resources;
namespace PocketSharp.WP8
{
public partial class DetailsPage : PhoneApplicationPage
{
// Constructor
public DetailsPage()
{
InitializeComponent();
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
// When page is navigated to set data context to selected item in list
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (DataContext == null)
{
string selectedIndex = "";
if (NavigationContext.QueryString.TryGetValue("selectedItem", out selectedIndex))
{
int index = int.Parse(selectedIndex);
DataContext = App.ViewModel.Items[index];
}
}
}
// Sample code for building a localized ApplicationBar
//private void BuildLocalizedApplicationBar()
//{
// // Set the page's ApplicationBar to a new instance of ApplicationBar.
// ApplicationBar = new ApplicationBar();
// // Create a new button and set the text value to the localized string from AppResources.
// ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
// appBarButton.Text = AppResources.AppBarButtonText;
// ApplicationBar.Buttons.Add(appBarButton);
// // Create a new menu item with the localized string from AppResources.
// ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
// ApplicationBar.MenuItems.Add(appBarMenuItem);
//}
}
}
@@ -0,0 +1,14 @@
using PocketSharp.WP8.Resources;
namespace PocketSharp.WP8
{
/// <summary>
/// Provides access to string resources.
/// </summary>
public class LocalizedStrings
{
private static AppResources _localizedResources = new AppResources();
public AppResources LocalizedResources { get { return _localizedResources; } }
}
}
@@ -0,0 +1,46 @@
<phone:PhoneApplicationPage
x:Class="PocketSharp.WP8.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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<!--Data context is set to sample data above and LayoutRoot contains the root grid where all other 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 Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
<Button Click="Button_Click">Load Data</Button>
</StackPanel>
<!--ContentPanel contains LongListSelector and LongListSelector ItemTemplate. Place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:LongListSelector x:Name="MainLongListSelector" Margin="0,0,-12,0" ItemsSource="{Binding Items}" SelectionChanged="MainLongListSelector_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
</Grid>
</phone:PhoneApplicationPage>
@@ -0,0 +1,46 @@
using Microsoft.Phone.Controls;
using PocketSharp.WP8.ViewModels;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
namespace PocketSharp.WP8
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
// Set the data context of the LongListSelector control to the sample data
DataContext = App.ViewModel;
}
// Load data for the ViewModel Items
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
// Handle selection changed on LongListSelector
private void MainLongListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// If selected item is null (no selection) do nothing
if (MainLongListSelector.SelectedItem == null)
return;
// Navigate to the new page
NavigationService.Navigate(new Uri("/DetailsPage.xaml?selectedItem=" + (MainLongListSelector.SelectedItem as ItemViewModel).ID, UriKind.Relative));
// Reset selected item to null (no selection)
MainLongListSelector.SelectedItem = null;
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
await App.ViewModel.LoadData();
}
}
}
@@ -0,0 +1,216 @@
<?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>{47721A56-2128-4C5A-8B92-995FFC353304}</ProjectGuid>
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp.WP8</RootNamespace>
<AssemblyName>PocketSharp.WP8</AssemblyName>
<TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>PocketSharp.WP8_$(Configuration)_$(Platform).xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>PocketSharp.WP8.App</SilverlightAppEntry>
<ValidateXaml>true</ValidateXaml>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</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>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\x86\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|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\x86\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\ARM\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|ARM' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\ARM\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="LocalizedStrings.cs" />
<Compile Include="DetailsPage.xaml.cs">
<DependentUpon>DetailsPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\AppResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>AppResources.resx</DependentUpon>
</Compile>
<Compile Include="ViewModels\ItemViewModel.cs" />
<Compile Include="ViewModels\MainViewModel.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="DetailsPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</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>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Properties\AppManifest.xml" />
<None Include="Properties\WMAppManifest.xml">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Assets\AlignmentGrid.png" />
<Content Include="Assets\ApplicationIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Tiles\FlipCycleTileLarge.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Tiles\FlipCycleTileMedium.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Tiles\FlipCycleTileSmall.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Tiles\IconicTileMediumLarge.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Tiles\IconicTileSmall.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\AppResources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>AppResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PocketSharp\PocketSharp.csproj">
<Project>{817200C3-A327-4E35-9B5F-63A51C088577}</Project>
<Name>PocketSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.16\lib\wp8\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.16\lib\wp8\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Phone">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.16\lib\wp8\Microsoft.Threading.Tasks.Extensions.Phone.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.Primitives.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).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 />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
</Project>
@@ -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>
@@ -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("PocketSharp.WP8")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PocketSharp.WP8")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("d4c30306-fbff-4433-8299-ecb70af9cfb6")]
// 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")]
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
<DefaultLanguage xmlns="" code="en-US"/>
<App xmlns="" ProductID="{47721a56-2128-4c5a-8b92-995ffc353304}" Title="PocketSharp.WP8" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="PocketSharp.WP8 author" Description="Sample description" Publisher="PocketSharp.WP8" PublisherID="{d8449fc0-02fe-4be1-b0a5-3fd20d58264c}">
<IconPath IsRelative="true" IsResource="false">Assets\ApplicationIcon.png</IconPath>
<Capabilities>
<Capability Name="ID_CAP_NETWORKING"/>
<Capability Name="ID_CAP_MEDIALIB_AUDIO"/>
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK"/>
<Capability Name="ID_CAP_SENSORS"/>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
</Capabilities>
<Tasks>
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
</Tasks>
<Tokens>
<PrimaryToken TokenID="PocketSharp.WP8Token" TaskName="_default">
<TemplateFlip>
<SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileSmall.png</SmallImageURI>
<Count>0</Count>
<BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileMedium.png</BackgroundImageURI>
<Title>PocketSharp.WP8</Title>
<BackContent></BackContent>
<BackBackgroundImageURI></BackBackgroundImageURI>
<BackTitle></BackTitle>
<DeviceLockImageURI></DeviceLockImageURI>
<HasLarge></HasLarge>
</TemplateFlip>
</PrimaryToken>
</Tokens>
<ScreenResolutions>
<ScreenResolution Name="ID_RESOLUTION_WVGA"/>
<ScreenResolution Name="ID_RESOLUTION_WXGA"/>
<ScreenResolution Name="ID_RESOLUTION_HD720P"/>
</ScreenResolutions>
</App>
</Deployment>
@@ -0,0 +1,138 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17626
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PocketSharp.WP8.Resources
{
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class AppResources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal AppResources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager
{
get
{
if (object.ReferenceEquals(resourceMan, null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PocketSharp.WP8.Resources.AppResources", typeof(AppResources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to LeftToRight.
/// </summary>
public static string ResourceFlowDirection
{
get
{
return ResourceManager.GetString("ResourceFlowDirection", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to us-EN.
/// </summary>
public static string ResourceLanguage
{
get
{
return ResourceManager.GetString("ResourceLanguage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to MY APPLICATION.
/// </summary>
public static string ApplicationTitle
{
get
{
return ResourceManager.GetString("ApplicationTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sample Runtime Property Value.
/// </summary>
public static string SampleProperty
{
get
{
return ResourceManager.GetString("SampleProperty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to button text.
/// </summary>
public static string AppBarButtonText
{
get
{
return ResourceManager.GetString("AppBarButtonText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to menu item.
/// </summary>
public static string AppBarMenuItemText
{
get
{
return ResourceManager.GetString("AppBarMenuItemText", resourceCulture);
}
}
}
}
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ResourceFlowDirection" xml:space="preserve">
<value>LeftToRight</value>
<comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment>
</data>
<data name="ResourceLanguage" xml:space="preserve">
<value>en-US</value>
<comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment>
</data>
<data name="ApplicationTitle" xml:space="preserve">
<value>MY APPLICATION</value>
</data>
<data name="SampleProperty" xml:space="preserve">
<value>Sample Runtime Property Value</value>
</data>
<data name="AppBarButtonText" xml:space="preserve">
<value>add</value>
</data>
<data name="AppBarMenuItemText" xml:space="preserve">
<value>Menu Item</value>
</data>
</root>
@@ -0,0 +1,16 @@
<vm:MainViewModel
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:PocketSharp.WP8.ViewModels"
SampleProperty="Sample Text Property Value">
<vm:MainViewModel.Items>
<vm:ItemViewModel ID="0" LineOne="design one" LineTwo="Maecenas praesent accumsan bibendum" LineThree="Maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur"/>
<vm:ItemViewModel ID="1" LineOne="design two" LineTwo="Dictumst eleifend facilisi faucibus" LineThree="Pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent"/>
<vm:ItemViewModel ID="2" LineOne="design three" LineTwo="Habitant inceptos interdum lobortis" LineThree="Accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat"/>
<vm:ItemViewModel ID="3" LineOne="design four" LineTwo="Nascetur pharetra placerat pulvinar" LineThree="Pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum"/>
<vm:ItemViewModel ID="4" LineOne="design five" LineTwo="Sagittis senectus sociosqu suscipit" LineThree="Dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis"/>
<vm:ItemViewModel ID="5" LineOne="design six" LineTwo="Torquent ultrices vehicula volutpat" LineThree="Senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend"/>
</vm:MainViewModel.Items>
</vm:MainViewModel>
@@ -0,0 +1,109 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace PocketSharp.WP8.ViewModels
{
public class ItemViewModel : INotifyPropertyChanged
{
private string _id;
/// <summary>
/// Sample ViewModel property; this property is used to identify the object.
/// </summary>
/// <returns></returns>
public string ID
{
get
{
return _id;
}
set
{
if (value != _id)
{
_id = value;
NotifyPropertyChanged("ID");
}
}
}
private string _lineOne;
/// <summary>
/// Sample ViewModel property; this property is used in the view to display its value using a Binding.
/// </summary>
/// <returns></returns>
public string LineOne
{
get
{
return _lineOne;
}
set
{
if (value != _lineOne)
{
_lineOne = value;
NotifyPropertyChanged("LineOne");
}
}
}
private string _lineTwo;
/// <summary>
/// Sample ViewModel property; this property is used in the view to display its value using a Binding.
/// </summary>
/// <returns></returns>
public string LineTwo
{
get
{
return _lineTwo;
}
set
{
if (value != _lineTwo)
{
_lineTwo = value;
NotifyPropertyChanged("LineTwo");
}
}
}
private string _lineThree;
/// <summary>
/// Sample ViewModel property; this property is used in the view to display its value using a Binding.
/// </summary>
/// <returns></returns>
public string LineThree
{
get
{
return _lineThree;
}
set
{
if (value != _lineThree)
{
_lineThree = value;
NotifyPropertyChanged("LineThree");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (null != handler)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
@@ -0,0 +1,107 @@
using PocketSharp.WP8.Resources;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading.Tasks;
namespace PocketSharp.WP8.ViewModels
{
public class MainViewModel : INotifyPropertyChanged
{
public MainViewModel()
{
this.Items = new ObservableCollection<ItemViewModel>();
}
/// <summary>
/// A collection for ItemViewModel objects.
/// </summary>
public ObservableCollection<ItemViewModel> Items { get; private set; }
private string _sampleProperty = "Sample Runtime Property Value";
/// <summary>
/// Sample ViewModel property; this property is used in the view to display its value using a Binding
/// </summary>
/// <returns></returns>
public string SampleProperty
{
get
{
return _sampleProperty;
}
set
{
if (value != _sampleProperty)
{
_sampleProperty = value;
NotifyPropertyChanged("SampleProperty");
}
}
}
/// <summary>
/// Sample property that returns a localized string
/// </summary>
public string LocalizedSampleProperty
{
get
{
return AppResources.SampleProperty;
}
}
public bool IsDataLoaded
{
get;
private set;
}
/// <summary>
/// Creates and adds a few ItemViewModel objects into the Items collection.
/// </summary>
public async Task LoadData()
{
// !! please don't misuse this account !!
PocketClient client = new PocketClient(
consumerKey: "15396-f6f92101d72c8e270a6c9bb3",
callbackUri: "http://frontendplay.com",
accessCode: "80acf6c5-c198-03c0-b94c-e74402"
);
List<PocketSharp.Models.PocketItem> items = null;
try
{
items = await client.Get();
items.ForEach(item =>
{
this.Items.Add(new ItemViewModel()
{
ID = item.ID.ToString(),
LineOne = item.Title,
LineTwo = item.Uri.ToString()
});
});
}
catch (PocketException ex)
{
Debug.WriteLine(ex.Message);
}
this.IsDataLoaded = true;
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (null != handler)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="wp80" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="wp80" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="wp80" />
</packages>
@@ -0,0 +1,8 @@
<Application x:Class="PocketSharp.Wpf.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace PocketSharp.Wpf
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
@@ -0,0 +1,18 @@
<Window x:Class="PocketSharp.Wpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Title="MainWindow" Height="443" Width="591">
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click" RenderTransformOrigin="0.547,0.566"/>
<ListView ItemsSource="{Binding Sites}" HorizontalAlignment="Left" Height="349" Margin="10,51,0,0" VerticalAlignment="Top" Width="561">
<ListView.View>
<GridView>
<GridViewColumn Width="160" Header="URL" DisplayMemberBinding="{Binding Url}" />
<GridViewColumn Width="401" Header="Content" DisplayMemberBinding="{Binding Content}" />
</GridView>
</ListView.View>
</ListView>
</Grid>
</Window>
@@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;
namespace PocketSharp.Wpf
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
ObservableCollection<Site> _Sites = new ObservableCollection<Site>();
public ObservableCollection<Site> Sites { get { return _Sites; } }
public class Site
{
public string Url { get; set; }
public string Content { get; set; }
}
public MainWindow()
{
InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
// !! please don't misuse this account !!
PocketClient client = new PocketClient(
consumerKey: "15396-f6f92101d72c8e270a6c9bb3",
callbackUri: "http://frontendplay.com",
accessCode: "80acf6c5-c198-03c0-b94c-e74402"
);
List<PocketSharp.Models.PocketItem> items = null;
try
{
items = await client.Get();
items.ForEach(item =>
{
Sites.Add(new Site()
{
Content = item.Title,
Url = item.Uri.ToString()
});
});
}
catch (PocketException ex)
{
Debug.Write(ex.Message);
}
}
}
}
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{775569C2-987F-4AC4-8BA5-A315A21ED1B7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp.Wpf</RootNamespace>
<AssemblyName>PocketSharp.Wpf</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Site.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PocketSharp\PocketSharp.csproj">
<Project>{817200c3-a327-4e35-9b5f-63a51c088577}</Project>
<Name>PocketSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<!-- 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>
-->
</Project>
@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("PocketSharp.Wpf")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PocketSharp.Wpf")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18213
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PocketSharp.Wpf.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PocketSharp.Wpf.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18213
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PocketSharp.Wpf.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PocketSharp.Wpf
{
public class Site
{
public string Url { get; set; }
public string Content { get; set; }
}
}
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.18.0" newVersion="4.2.18.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="net45" />
</packages>
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class AccountTests : TestsBase
{
public AccountTests() : base() { }
[Fact]
public async Task IsRegistrationURLSuccessfullyCreated()
{
string requestCode = await client.GetRequestCode();
Uri uri = client.GenerateRegistrationUri(requestCode);
Assert.True(uri.OriginalString.Contains(requestCode));
Assert.True(uri.OriginalString.Contains("force=signup"));
}
}
}
+68
View File
@@ -0,0 +1,68 @@
using PocketSharp.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class AddTests : TestsBase
{
public AddTests() : base() { }
[Fact]
public async Task AddSimpleItemWithUriOnly()
{
var uri = new Uri("http://frontendplay.com");
PocketItem item = await client.Add(uri);
Assert.Equal<Uri>(uri, item.Uri);
itemsToDelete.Add(item.ID);
}
[Fact]
public async Task ItemWithInstableImagesIsAdded()
{
var uri = new Uri("http://www.valoronline.com.br");
PocketItem item = await client.Add(uri);
Assert.NotNull(item);
itemsToDelete.Add(item.ID);
}
[Fact]
public async Task AddComplexItem()
{
PocketItem item = await client.Add(
uri: new Uri("http://frontendplay.com"),
tags: new string[] { "blog", "frontend", "cee" },
title: "ignored title",
tweetID: "380051788172632065"
);
List<PocketItem> items = await client.Get();
PocketItem itemDesired = null;
items.ForEach(itm =>
{
if (itm.ID == item.ID)
{
itemDesired = itm;
}
});
Assert.NotNull(itemDesired);
Assert.Equal(itemDesired.ID, item.ID);
Assert.Equal(itemDesired.Tags.Count, 3);
itemsToDelete.Add(item.ID);
}
}
}
File diff suppressed because one or more lines are too long
+283
View File
@@ -0,0 +1,283 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema;
using PocketSharp.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class GetTests : TestsBase
{
public GetTests() : base() { }
[Fact]
public async Task AreItemsRetrieved()
{
List<PocketItem> items = await client.Get();
Assert.True(items.Count > 0);
}
[Fact]
public async Task IsItemRetrievedById()
{
List<PocketItem> items = await client.Get();
PocketItem item = items[0];
PocketItem itemDuplicate = await client.Get(item.ID);
Assert.True(item.ID == itemDuplicate.ID);
Assert.True(item.Uri == itemDuplicate.Uri);
}
[Fact]
public async Task IsItemJsonPopulated()
{
List<PocketItem> items = await client.Get();
string schemaJson = @"{
'description': 'PocketItem',
'type': 'object'
}";
JsonSchema schema = JsonSchema.Parse(schemaJson);
foreach (var pocketItem in items)
{
Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json));
var jObject = JObject.Parse(pocketItem.Json);
Assert.True(jObject.IsValid(schema));
}
}
[Fact]
public async Task AreFilteredItemsRetrieved()
{
List<PocketItem> items = await client.Get(RetrieveFilter.Favorite);
Assert.True(items.Count > 0);
}
[Fact]
public async Task RetrieveWithMultipleFilters()
{
List<PocketItem> items = await client.Get(
state: State.unread,
tag: "pocket",
sort: Sort.title,
since: new DateTime(2010, 12, 10),
count: 2
);
Assert.InRange<int>(items.Count, 0, 2);
}
[Fact]
public async Task ItemContainsUri()
{
List<PocketItem> items = await client.Get(count: 1);
Assert.True(items.Count == 1);
Assert.True(items[0].Uri.ToString().StartsWith("http"));
}
[Fact]
public async Task InvalidRetrievalReturnsNoResults()
{
List<PocketItem> items = await client.Get(
favorite: true,
search: "xoiu987a#;"
);
Assert.False(items.Count > 0);
PocketItem item = await client.Get("99999999");
Assert.Null(item);
items = await client.Get(RetrieveFilter.Video);
Assert.False(items.Count > 0);
}
[Fact]
public async Task SearchReturnsResult()
{
List<PocketItem> items = await client.Search("pocket");
Assert.True(items.Count > 0);
Assert.True(items[0].FullTitle.ToLower().Contains("pocket"));
}
[Fact]
public async Task InvalidSearchReturnsNoResult()
{
List<PocketItem> items = await client.Search("adsüasd-opiu2;.398dfyx");
Assert.False(items.Count > 0);
}
[Fact]
public async Task RetrieveTagsReturnsResult()
{
List<PocketTag> items = await client.GetTags();
Assert.True(items.Count > 0);
}
[Fact]
public async Task SearchByTagsReturnsResult()
{
List<PocketItem> items = await client.SearchByTag("pocket");
Assert.True(items.Count == 1);
bool found = false;
items[0].Tags.ForEach(tag =>
{
if (tag.Name.Contains("pocket"))
{
found = true;
}
});
Assert.True(found);
}
[Fact]
public async Task InvalidSearchByTagsReturnsNoResult()
{
List<PocketItem> items = await client.SearchByTag("adsüasd-opiu2;.398dfyx");
Assert.False(items.Count > 0);
}
[Fact]
public async Task AreStatisticsRetrieved()
{
PocketStatistics statistics = await client.GetUserStatistics();
Assert.True(statistics.CountAll > 0);
}
[Fact]
public async Task AreLimitsRetrieved()
{
PocketLimits limits = await client.GetUsageLimits();
Assert.True(limits.RateLimitForConsumerKey > 9999);
}
[Fact]
public async Task IsNewPocketItemListGeneratorWorking()
{
List<PocketItem> items = await client.Get(count: 1, tag: "pocket");
PocketItem item = items[0];
Assert.True(item.Tags.Find(i => i.Name == "pocket") != null);
}
[Fact]
public async Task IsSinceParameterWorkingOnAddTags()
{
DateTime since = DateTime.UtcNow;
List<PocketItem> items = await client.Get(state: State.all);
PocketItem itemToModify = items[0];
Assert.True(items.Count >= 3);
items = await client.Get(state: State.all, since: since);
Assert.True(items == null || items.Count == 0);
await client.AddTags(itemToModify, new string[] { "pocketsharp" });
items = await client.Get(state: State.all, since: since);
Assert.True(items.Count > 0);
await client.RemoveTags(itemToModify, new string[] { "pocketsharp" });
}
[Fact]
public async Task IsSinceParameterWorkingOnFavoriteAndArchiveModification()
{
DateTime since = DateTime.UtcNow;
List<PocketItem> items = await client.Get(state: State.all);
PocketItem itemToModify = items[0];
Assert.True(items.Count >= 3);
items = await client.Get(state: State.all, since: since);
Assert.True(items == null || items.Count == 0);
await client.Favorite(itemToModify);
items = await client.Get(state: State.all, since: since);
Assert.True(items.Count > 0);
await client.Unfavorite(itemToModify);
since = DateTime.UtcNow.AddMinutes(-1);
await client.Archive(itemToModify);
items = await client.Get(state: State.all, since: since);
Assert.True(items.Count > 0);
await client.Unarchive(itemToModify);
}
[Fact]
public async Task IsSinceParameterWorkingOnAddAndDelete()
{
DateTime since = DateTime.UtcNow;
PocketItem item = await client.Add(new Uri("http://frontendplay.com"));
List<PocketItem> items = await client.Get(state: State.all, since: since);
since = DateTime.UtcNow;
await client.Delete(item);
items = await client.Get(state: State.all, since: since);
Assert.True(items.Count == 1 && items[0].IsDeleted);
}
[Fact]
public async Task AreUncachedItemsProperlyResolved()
{
PocketItem item = await client.Add(new Uri("http://de.ign.com/m/feature/21608/die-20-besten-kurzfilme-des-jahres-2013?bust=1"));
List<PocketItem> items = await client.Get(state: State.all);
Assert.NotNull(item.Uri);
Assert.NotNull(items[0].Uri);
Assert.Equal(item.Uri, items[0].Uri);
itemsToDelete.Add(item.ID);
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using PocketSharp.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class MiscTests : TestsBase
{
private int Incrementor = 0;
public MiscTests()
: base()
{
client.PreRequest = method => Incrementor++;
}
[Fact]
public async Task CheckPreRequestAction()
{
List<PocketItem> items = await client.Get(count: 1);
PocketItem item = items[0];
await client.Favorite(item);
await client.Unfavorite(item);
Assert.True(Incrementor >= 3);
}
}
}
+102
View File
@@ -0,0 +1,102 @@
using PocketSharp.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class ModifyTagsTests : TestsBase
{
public ModifyTagsTests() : base() { }
[Fact]
public async Task AreTagsAddedAndDeletedToAnItem()
{
PocketItem item = await Setup();
Assert.True(await client.AddTags(item, new string[] { "test_tag", "test_tag2" }));
item = await GetItemById(item.ID);
Assert.True(item.Tags.Count >= 2);
Assert.NotNull(item.Tags.Single<PocketTag>(tag => tag.Name == "test_tag"));
Assert.NotNull(item.Tags.Single<PocketTag>(tag => tag.Name == "test_tag2"));
Assert.True(await client.RemoveTags(item, new string[] { "test_tag", "test_tag2" }));
item = await GetItemById(item.ID);
Assert.Null(item.Tags.SingleOrDefault<PocketTag>(tag => tag.Name == "test_tag"));
Assert.Null(item.Tags.SingleOrDefault<PocketTag>(tag => tag.Name == "test_tag2"));
}
[Fact]
public async Task AreAllTagsRemovedFromItem()
{
PocketItem item = await Setup();
Assert.True(await client.AddTags(item, new string[] { "test_tag", "test_tag2" }));
item = await GetItemById(item.ID);
Assert.True(item.Tags.Count >= 2);
Assert.True(await client.RemoveTags(item));
item = await GetItemById(item.ID);
Assert.Null(item.Tags);
}
[Fact]
public async Task AreTagsReplaced()
{
PocketItem item = await Setup();
Assert.True(await client.ReplaceTags(item.ID, new string[] { "test_tag", "test_tag2" }));
item = await GetItemById(item.ID);
Assert.Equal(item.Tags.Count, 2);
Assert.NotNull(item.Tags.SingleOrDefault<PocketTag>(tag => tag.Name == "test_tag"));
Assert.NotNull(item.Tags.SingleOrDefault<PocketTag>(tag => tag.Name == "test_tag2"));
}
private async Task<PocketItem> Setup()
{
PocketItem item = await client.Add(
uri: new Uri("https://github.com"),
tags: new string[] { "github", "code", "social" }
);
itemsToDelete.Add(item.ID);
return await GetItemById(item.ID);
}
private async Task<PocketItem> GetItemById(string id, bool archive = false)
{
List<PocketItem> items = await client.Get(state: archive ? State.archive : State.unread);
PocketItem itemDesired = null;
items.ForEach(itm =>
{
if (itm.ID == id)
{
itemDesired = itm;
}
});
return itemDesired;
}
}
}
+135
View File
@@ -0,0 +1,135 @@
using PocketSharp.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class ModifyTests : TestsBase
{
public ModifyTests() : base() { }
[Fact]
public async Task IsAnItemArchivedAndUnarchived()
{
PocketItem item = await Setup();
Assert.True(await client.Archive(item));
item = await GetItemById(item.ID, true);
Assert.True(item.IsArchive);
Assert.True(await client.Unarchive(item));
item = await GetItemById(item.ID);
Assert.False(item.IsArchive);
}
[Fact]
public async Task IsAnItemFavoritedAndUnfavorited()
{
PocketItem item = await Setup();
Assert.True(await client.Favorite(item));
item = await GetItemById(item.ID);
Assert.True(item.IsFavorite);
Assert.True(await client.Unfavorite(item));
item = await GetItemById(item.ID);
Assert.False(item.IsFavorite);
}
[Fact]
public async Task IsAnItemDeleted()
{
PocketItem item = await Setup();
Assert.True(await client.Delete(item));
item = await GetItemById(item.ID);
Assert.Null(item);
}
[Fact]
public async Task AreMultipleActionsSent()
{
PocketItem item = await Setup();
bool success = await client.SendActions(new List<PocketAction>()
{
new PocketAction() { Action = "favorite", ID = item.ID },
new PocketAction() { Action = "tags_add", ID = item.ID, Tags = new string[] { "new_tag", "another_tag" } },
new PocketAction() { Action = "archive", ID = item.ID },
new PocketAction() { Action = "tag_rename", ID = item.ID, OldTag = "social", NewTag = "not_social" }
});
Assert.True(success);
item = await client.Get(item.ID);
Assert.True(item.IsFavorite);
Assert.True(item.IsArchive);
Assert.NotNull(item.Tags.Single<PocketTag>(tag => tag.Name == "new_tag"));
Assert.NotNull(item.Tags.Single<PocketTag>(tag => tag.Name == "another_tag"));
Assert.NotNull(item.Tags.Single<PocketTag>(tag => tag.Name == "not_social"));
}
[Fact]
public async Task AreMultipleAddActionsSent()
{
PocketItem item = await Setup();
bool success = await client.SendActions(new List<PocketAction>()
{
new PocketAction() { Action = "add", Uri = new Uri("http://msdn.microsoft.com/en-us/library/windows/apps/jj841126.aspx") },
new PocketAction() { Action = "add", Uri = new Uri("http://pokiapp.com/changelog") }
});
Assert.True(success);
}
private async Task<PocketItem> Setup()
{
PocketItem item = await client.Add(
uri: new Uri("https://github.com"),
tags: new string[] { "github", "code", "social" }
);
itemsToDelete.Add(item.ID);
return await GetItemById(item.ID);
}
private async Task<PocketItem> GetItemById(string id, bool archive = false)
{
List<PocketItem> items = await client.Get(state: archive ? State.archive : State.unread);
PocketItem itemDesired = null;
items.ForEach(itm =>
{
if (itm.ID == id)
{
itemDesired = itm;
}
});
return itemDesired;
}
}
}
+62 -10
View File
@@ -3,12 +3,12 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F1CEA363-7039-40BA-9744-0071F46BB90C}</ProjectGuid>
<ProjectGuid>{CA3C491B-A8CA-426C-A0BB-E91636767467}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp.Tests</RootNamespace>
<AssemblyName>PocketSharp.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
@@ -16,6 +16,8 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -35,9 +37,32 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="xunit">
<HintPath>..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
@@ -46,15 +71,30 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="MiscTests.cs" />
<Compile Include="AddTests.cs" />
<Compile Include="AccountTests.cs" />
<Compile Include="ModifyTagsTests.cs" />
<Compile Include="ModifyTests.cs" />
<Compile Include="GetTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StressTests.cs" />
<Compile Include="TestsBase.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PocketSharp\PocketSharp.csproj">
<Project>{817200c3-a327-4e35-9b5f-63a51c088577}</Project>
<Name>PocketSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="url-10000.csv" />
<None Include="url-100000.csv" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
@@ -76,6 +116,18 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<!-- 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">
+1 -1
View File
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fbe5a0d2-d0de-44b1-8b8a-cf8cd3ac2230")]
[assembly: Guid("87fcf138-5e6e-4584-ac3b-58c8ee6fccaa")]
// Version information for an assembly consists of the following four values:
//
+1
View File
@@ -0,0 +1 @@
<Playlist Version="1.0"><Add Test="PocketSharp.Tests.StressTests.Are0ItemsRetrievedProperly" /><Add Test="PocketSharp.Tests.StressTests.Are100ItemsRetrievedProperly" /><Add Test="PocketSharp.Tests.StressTests.Are10000ItemsRetrievedProperly" /><Add Test="PocketSharp.Tests.StressTests.IsSearchedSuccessfullyOn10000Items" /><Add Test="PocketSharp.Tests.StressTests.Are1000ItemsRetrievedProperly" /><Add Test="PocketSharp.Tests.StressTests.IsSearchedSuccessfullyOn10000Items (PocketSharp.Tests.StressTests.IsSearchedSuccessfullyOn10000Items (F:\Playground\CSharp\PocketSharp\PocketSharp.Tests\bin\Release\PocketSharp.Tests.dll))" /><Add Test="PocketSharp.Tests.StressTests.Are1000ItemsRetrievedProperly (PocketSharp.Tests.StressTests.Are1000ItemsRetrievedProperly (F:\Playground\CSharp\PocketSharp\PocketSharp.Tests\bin\Release\PocketSharp.Tests.dll))" /><Add Test="PocketSharp.Tests.StressTests.Are0ItemsRetrievedProperly (PocketSharp.Tests.StressTests.Are0ItemsRetrievedProperly (F:\Playground\CSharp\PocketSharp\PocketSharp.Tests\bin\Release\PocketSharp.Tests.dll))" /><Add Test="PocketSharp.Tests.StressTests.Are100ItemsRetrievedProperly (PocketSharp.Tests.StressTests.Are100ItemsRetrievedProperly (F:\Playground\CSharp\PocketSharp\PocketSharp.Tests\bin\Release\PocketSharp.Tests.dll))" /><Add Test="PocketSharp.Tests.StressTests.Are10000ItemsRetrievedProperly (PocketSharp.Tests.StressTests.Are10000ItemsRetrievedProperly (F:\Playground\CSharp\PocketSharp\PocketSharp.Tests\bin\Release\PocketSharp.Tests.dll))" /></Playlist>
+117
View File
@@ -0,0 +1,117 @@
using PocketSharp.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class StressTests : TestsBase
{
private static IEnumerable<string> urls;
private static string[] tags = new string[] { "css", "js", "csharp", "windows", "microsoft" };
public StressTests()
: base()
{
// !! please don't misuse this account !!
client = new PocketClient(
consumerKey: "20000-786d0bc8c39294e9829111d6",
callbackUri: "http://frontendplay.com",
accessCode: "9b8ecb6b-7801-1a5c-7b39-2ba05b"
);
urls = File.ReadAllLines("../../url-100000.csv").Select(item => item.Split(',')[1]);
}
[Fact]
public async Task Are100ItemsRetrievedProperly()
{
List<PocketItem> items = await client.Get(count: 100, state: State.all);
Assert.True(items.Count == 100);
}
[Fact]
public async Task Are1000ItemsRetrievedProperly()
{
List<PocketItem> items = await client.Get(count: 1000, state: State.all);
Assert.True(items.Count == 1000);
}
[Fact]
public async Task Are2500ItemsRetrievedProperly()
{
List<PocketItem> items = await client.Get(count: 2500, state: State.all);
Assert.True(items.Count == 2500);
}
[Fact]
public async Task Are5000ItemsRetrievedProperly()
{
List<PocketItem> items = await client.Get(count: 5000, state: State.all);
Assert.True(items.Count == 5000);
}
[Fact]
public async Task IsSearchSuccessfullyOnBigList()
{
List<PocketItem> items = await client.Get(search: "google");
Assert.True(items.Count > 0);
Assert.True(items[0].Title.ToLower().Contains("google") || items[0].Uri.ToString().ToLower().Contains("google"));
}
[Fact]
public async Task IsTagSearchSuccessfullyOnBigList()
{
List<PocketItem> items = await client.SearchByTag(tags[0]);
Assert.True(items.Count > 1);
bool found = false;
items[0].Tags.ForEach(tag =>
{
if (tag.Name.Contains(tags[0]))
{
found = true;
}
});
Assert.True(found);
}
[Fact]
public async Task RetrieveTagsReturnsResultOnBigList()
{
List<PocketTag> items = await client.GetTags();
items.ForEach(tag =>
{
Assert.True(tags.Contains(tag.Name));
});
Assert.Equal(items.Count, tags.Length);
}
private async Task FillAccount(int offset, int count)
{
int r;
int r2;
string[] tag;
Random rnd = new Random();
foreach (string url in urls.Skip(offset).Take(count))
{
r = rnd.Next(tags.Length);
r2 = rnd.Next(tags.Length);
tag = new string[] { tags[r], tags[r2] };
await client.Add(new Uri("http://" + url), tag);
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class TestsBase : IDisposable
{
protected PocketClient client;
protected List<string> itemsToDelete = new List<string>();
// setup
public TestsBase()
{
// !! please don't misuse this account !!
client = new PocketClient(
consumerKey: "15396-f6f92101d72c8e270a6c9bb3",
callbackUri: "http://frontendplay.com",
accessCode: "80acf6c5-c198-03c0-b94c-e74402"
);
}
// teardown
public void Dispose()
{
itemsToDelete.ForEach(async id =>
{
await client.Delete(id);
});
}
// async throws
public static async Task ThrowsAsync<TException>(Func<Task> func)
{
var expected = typeof(TException);
Type actual = null;
try
{
await func();
}
catch (Exception e)
{
actual = e.GetType();
}
Assert.Equal(expected, actual);
}
}
}
-14
View File
@@ -1,14 +0,0 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PocketSharp.Tests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}
}
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.18.0" newVersion="4.2.18.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="net45" />
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
</packages>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
<Application
x:Class="PocketSharp.WP7.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">
<!--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>
+151
View File
@@ -0,0 +1,151 @@
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using PocketSharp.WP7.ViewModels;
using System.Windows;
using System.Windows.Navigation;
namespace PocketSharp.WP7
{
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
if (viewModel == null)
viewModel = new MainViewModel();
return viewModel;
}
}
/// <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.
Application.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)
{
}
// 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)
{
}
// 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
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

+45
View File
@@ -0,0 +1,45 @@
<phone:PhoneApplicationPage
x:Class="PocketSharp.WP7.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: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="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
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="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
<Button Click="Button_Click">Load Data</Button>
</StackPanel>
<!--ContentPanel contains LongListSelector and LongListSelector ItemTemplate. Place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ListBox x:Name="MainLongListSelector" Margin="0,0,-12,0" ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</phone:PhoneApplicationPage>
+22
View File
@@ -0,0 +1,22 @@
using Microsoft.Phone.Controls;
using System.Windows;
namespace PocketSharp.WP7
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
// Set the data context of the LongListSelector control to the sample data
DataContext = App.ViewModel;
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
await App.ViewModel.LoadData();
}
}
}
+155
View File
@@ -0,0 +1,155 @@
<?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>{6F542037-C48B-4EC5-A326-DDBEBF5FDFA2}</ProjectGuid>
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp.WP7</RootNamespace>
<AssemblyName>PocketSharp.WP7</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>PocketSharp.WP7.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>PocketSharp.WP7.App</SilverlightAppEntry>
<ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</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.Interop" />
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4-windowsphone71\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4-windowsphone71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Phone">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4-windowsphone71\Microsoft.Threading.Tasks.Extensions.Phone.dll</HintPath>
</Reference>
<Reference Include="System.IO, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\sl4-windowsphone71\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\sl4-windowsphone71\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\sl4-windowsphone71\System.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="mscorlib.extensions" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\ItemViewModel.cs" />
<Compile Include="ViewModels\MainViewModel.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<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>
<Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PocketSharp\PocketSharp.csproj">
<Project>{817200C3-A327-4E35-9B5F-63A51C088577}</Project>
<Name>PocketSharp</Name>
</ProjectReference>
</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 />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
</Project>
@@ -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>
@@ -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("PocketSharp.WP7")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PocketSharp.WP7")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("775e1575-245f-45be-85f8-e6289b22b330")]
// 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")]
@@ -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="{6f542037-c48b-4ec5-a326-ddbebf5fdfa2}" Title="PocketSharp.WP7" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="PocketSharp.WP7 author" Description="Sample description" Publisher="PocketSharp.WP7">
<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="PocketSharp.WP7Token" TaskName="_default">
<TemplateType5>
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
<Count>0</Count>
<Title>PocketSharp.WP7</Title>
</TemplateType5>
</PrimaryToken>
</Tokens>
</App>
</Deployment>
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

+102
View File
@@ -0,0 +1,102 @@
using System;
using System.ComponentModel;
namespace PocketSharp.WP7.ViewModels
{
public class ItemViewModel : INotifyPropertyChanged
{
private string _id;
/// <summary>
/// Sample ViewModel property; this property is used to identify the object.
/// </summary>
/// <returns></returns>
public string ID
{
get
{
return _id;
}
set
{
if (value != _id)
{
_id = value;
NotifyPropertyChanged("ID");
}
}
}
private string _lineOne;
/// <summary>
/// Sample ViewModel property; this property is used in the view to display its value using a Binding.
/// </summary>
/// <returns></returns>
public string LineOne
{
get
{
return _lineOne;
}
set
{
if (value != _lineOne)
{
_lineOne = value;
NotifyPropertyChanged("LineOne");
}
}
}
private string _lineTwo;
/// <summary>
/// Sample ViewModel property; this property is used in the view to display its value using a Binding.
/// </summary>
/// <returns></returns>
public string LineTwo
{
get
{
return _lineTwo;
}
set
{
if (value != _lineTwo)
{
_lineTwo = value;
NotifyPropertyChanged("LineTwo");
}
}
}
private string _lineThree;
/// <summary>
/// Sample ViewModel property; this property is used in the view to display its value using a Binding.
/// </summary>
/// <returns></returns>
public string LineThree
{
get
{
return _lineThree;
}
set
{
if (value != _lineThree)
{
_lineThree = value;
NotifyPropertyChanged("LineThree");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (null != handler)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
+106
View File
@@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading.Tasks;
namespace PocketSharp.WP7.ViewModels
{
public class MainViewModel : INotifyPropertyChanged
{
public MainViewModel()
{
this.Items = new ObservableCollection<ItemViewModel>();
}
/// <summary>
/// A collection for ItemViewModel objects.
/// </summary>
public ObservableCollection<ItemViewModel> Items { get; private set; }
private string _sampleProperty = "Sample Runtime Property Value";
/// <summary>
/// Sample ViewModel property; this property is used in the view to display its value using a Binding
/// </summary>
/// <returns></returns>
public string SampleProperty
{
get
{
return _sampleProperty;
}
set
{
if (value != _sampleProperty)
{
_sampleProperty = value;
NotifyPropertyChanged("SampleProperty");
}
}
}
/// <summary>
/// Sample property that returns a localized string
/// </summary>
public string LocalizedSampleProperty
{
get
{
return "test";
}
}
public bool IsDataLoaded
{
get;
private set;
}
/// <summary>
/// Creates and adds a few ItemViewModel objects into the Items collection.
/// </summary>
public async Task LoadData()
{
// !! please don't misuse this account !!
PocketClient client = new PocketClient(
consumerKey: "15396-f6f92101d72c8e270a6c9bb3",
callbackUri: "http://frontendplay.com",
accessCode: "80acf6c5-c198-03c0-b94c-e74402"
);
List<PocketSharp.Models.PocketItem> items = null;
try
{
items = await client.Get();
items.ForEach(item =>
{
this.Items.Add(new ItemViewModel()
{
ID = item.ID.ToString(),
LineOne = item.Title,
LineTwo = item.Uri.ToString()
});
});
}
catch (PocketException ex)
{
Debug.WriteLine(ex.Message);
}
this.IsDataLoaded = true;
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (null != handler)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="wp71" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="wp71" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="wp71" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="wp71" />
</packages>
-16
View File
@@ -1,16 +0,0 @@
; This file is for unifying the coding style for different editors and IDEs
; editorconfig.org
root = true
; default settings for all files
[**]
end_of_line = crlf ; this is git standard, so it won't convert it anymore
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
indent_style = spaces
indent_size = 2
[*.md]
trim_trailing_whitespace = false
File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 220 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 150 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 151 KiB

Some files were not shown because too many files have changed in this diff Show More