diff --git a/.gitignore b/.gitignore index a99212c..590c91d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ xpkg/ *.xam +.vs/ + # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) [Bb]in/ [Oo]bj/ @@ -110,3 +112,5 @@ Generated_Code #added for RIA/Silverlight projects _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML +/.vs +/src/.vs/PDRating diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 716846a..0000000 --- a/Rakefile +++ /dev/null @@ -1,28 +0,0 @@ -require "rake/clean" - -CLEAN.include "*.xam" -CLEAN.include "xpkg" -CLEAN.include "samples/PDRatingSample/bin" -CLEAN.include "samples/PDRatingSample/obj" - -VERSION = "2.0.0" -COMPONENT = "pdreview-#{VERSION}.xam" -MONOXBUILD = "/Library/Frameworks/Mono.framework/Commands/xbuild" - -file "xpkg/xamarin-component.exe" do - puts "* Downloading xamarin-component..." - mkdir "xpkg" - sh "curl -L https://components.xamarin.com/submit/xpkg > xpkg.zip" - sh "unzip -o xpkg.zip -d xpkg" - sh "rm xpkg.zip" -end - -task :default => ["xpkg/xamarin-component.exe"] do - line = <<-END - mono xpkg/xamarin-component.exe package - END - puts "* Creating #{COMPONENT}..." - puts line.strip.gsub "\t\t", "\\\n " - sh line, :verbose => false - puts "* Created #{COMPONENT}" -end diff --git a/RatingView.nuspec b/RatingView.nuspec deleted file mode 100644 index eb7e917..0000000 --- a/RatingView.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - RatingView - 2.0.2 - RatingView - Adam Patridge,RatingView contributors - Adam Patridge - https://github.com/patridge/PDRating/blob/master/LICENSE - https://github.com/patridge/PDRating/ - https://github.com/patridge/PDRating/raw/master/component/icons/pdrating_64x64.png - false - Display and optionally collect user ratings for items in your Xamarin.iOS app using a custom rating image, custom scale, and an easily composible transparent background. - -v2.0.2: Corrected namespace (breaking, but nothing internal changed). -v2.0.1: Updated component and samples to support Xamarin.iOS Unified API (again, after breaking changes in the latest Unified API release). -v2.0.0: Updated component and samples to support Xamarin.iOS Unified API. - - © 2013-2018 Adam Patridge - xamarin ios rating review - - - - - \ No newline at end of file diff --git a/component.yaml b/component.yaml deleted file mode 100644 index bd834ba..0000000 --- a/component.yaml +++ /dev/null @@ -1,31 +0,0 @@ -version: 2.0.2 -name: PDReview -id: pdreview -publisher: Adam Patridge -license: component/License.md -details: component/Details.md -getting-started: component/GettingStarted.md -summary: PDRatingView lets you display an average rating and, optionally, collect a user's rating submission on items in your application. -icons: - - component/icons/pdrating_128x128.png - - component/icons/pdrating_512x512.png -publisher-url: https://github.com/patridge/PDRating -build: - - src/PDRating.sln -libraries: - ios: src/PDRating/bin/classic/Release/PDRating.dll - ios-unified: src/PDRating/bin/unified/Release/PDRating.dll -screenshots: - - component/Screenshots/five-stars-scale.png - - component/Screenshots/six-moustaches-scale.png - - component/Screenshots/ten-tomatoes-scale.png - - component/Screenshots/custom-background.png -samples: - - name: "iOS Sample" - path: samples/PDRatingSample.sln - configuration: "Release|iPhone" - nobuild: true - - name: "iOS Classic Sample" - path: samples/PDRatingSample-Classic.sln - configuration: "Release|iPhone" - nobuild: true diff --git a/component/Details.md b/component/Details.md deleted file mode 100644 index b5b8b79..0000000 --- a/component/Details.md +++ /dev/null @@ -1,55 +0,0 @@ -PDRatingView lets you display an average rating and, optionally, collect a user's rating submission on items in your Xamarin.iOS application. - -* Custom rating images. -* Custom rating scale. -* Transparent background for composing. - -##Examples - -You can use whatever images you want and whatever scale size you need. Many people use five stars. - -![Five star rating scale](http://www.patridgedev.com/cdn/pdrating/screenshots/five-stars-scale.png) - -Others have something else entirely. Perhaps you want a 10-tomato rating. - -![Ten tomato rating scale](http://www.patridgedev.com/cdn/pdrating/screenshots/ten-tomatoes-scale.png) - -Whatever you need, you give it a rectangle to it into and it will resize things accordingly. - -![Six moustaches rating scale](http://www.patridgedev.com/cdn/pdrating/screenshots/six-moustaches-scale.png) - -Ratings displays are kept minimal. If you need to compose your ratings view into something else, it will overlay it just fine. - -![Star rating on a custom background](http://www.patridgedev.com/cdn/pdrating/screenshots/custom-background.png) - -##Other Configurations Options - -###Between-item whitespace - -Need some space between your rating items? Just set the `ItemPadding` in the `RatingConfig` object used to build the `PDRatingView`. - - // Put a little space between the rating items. - ratingConfig.ItemPadding = 5f; - -###Read-only (no user rating input) - -If you are showing a rating without any intention of collecting a rating from the user, you can keep the rating view from taking any user input with the default iOS setting. As a result, this will keep it from ever triggering a `RatingChosen` event. - - // Only display the rating; don't allow user rating. - ratingView.UserInteractionEnabled = false; - -###Different rating scale size - -Say you need users to rate things on a scale to ten. That can be changed in the `RatingConfig` object used to build the `PDRatingView`. The default is a 5-item scale of ratings. - - // Allow rating on a scale of 1 to 10. - ratingConfig.ScaleSize = 10; - -###Rounding of ratings to whole or half stars - -If you want average ratings to display in half- or whole-star increments, that isn't currently built in to the `PDRatingView` system directly, but you can very easily use .NET to round appropriately before setting the view's `AverageRating` to reproduce the same result. - - decimal rating = 3.58m; - decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; - decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); - StarRating.AverageRating = wholeRoundedRating; \ No newline at end of file diff --git a/component/GettingStarted.md b/component/GettingStarted.md deleted file mode 100644 index 4c1aa38..0000000 --- a/component/GettingStarted.md +++ /dev/null @@ -1,36 +0,0 @@ -PDRatingView lets you display an average rating and, optionally, receive a user's rating submission. - -* Custom rating images. -* Custom rating scale. -* Transparent background for composing. - -##Usage - -In any `UIView` or `UIViewController`, you add a `PDRatingView` to the displayed view just like any other view. - - using PatridgeDev; - ... - - PDRatingView ratingView; - public override void ViewDidLoad() { - - // Gather up the images to be used. - RatingConfig ratingConfig = new RatingConfig() { - EmptyStarImage = UIImage.FromBundle("empty"), - FilledStarImage = UIImage.FromBundle("filled"), - ChosenStarImage = UIImage.FromBundle("chosen"), - }; - - // Create the view. - decimal averageRating = 3.25m; - ratingView = new PDRatingView(new RectangleF(0f, 0f, View.Bounds.Width, 125f), ratingConfig, averageRating); - - // [Optional] Do something when the user selects a rating. - ratingView.RatingChosen += (sender, e) => { - (new UIAlertView("Rated!", e.Rating.ToString() + " stars", null, "Ok")).Show(); - }; - - // [Required] Add the view to the - View.Add(StarRating); - } - \ No newline at end of file diff --git a/component/License.md b/component/License.md deleted file mode 100644 index a0ed75c..0000000 --- a/component/License.md +++ /dev/null @@ -1,22 +0,0 @@ -#License - -The MIT License (MIT) - -Copyright (c) 2013 Adam Patridge - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/component/Screenshots/PDRating.mov b/component/Screenshots/PDRating.mov deleted file mode 100644 index 7a567db..0000000 Binary files a/component/Screenshots/PDRating.mov and /dev/null differ diff --git a/component/Screenshots/custom-background.png b/component/Screenshots/custom-background.png deleted file mode 100644 index c5c20bd..0000000 Binary files a/component/Screenshots/custom-background.png and /dev/null differ diff --git a/component/Screenshots/five-stars-scale.png b/component/Screenshots/five-stars-scale.png deleted file mode 100644 index f5d5047..0000000 Binary files a/component/Screenshots/five-stars-scale.png and /dev/null differ diff --git a/component/Screenshots/six-moustaches-scale.png b/component/Screenshots/six-moustaches-scale.png deleted file mode 100644 index c2a95c5..0000000 Binary files a/component/Screenshots/six-moustaches-scale.png and /dev/null differ diff --git a/component/Screenshots/ten-tomatoes-scale.png b/component/Screenshots/ten-tomatoes-scale.png deleted file mode 100644 index 7c3f3ad..0000000 Binary files a/component/Screenshots/ten-tomatoes-scale.png and /dev/null differ diff --git a/component/icons/pdrating_128x128.png b/component/icons/pdrating_128x128.png deleted file mode 100644 index d298479..0000000 Binary files a/component/icons/pdrating_128x128.png and /dev/null differ diff --git a/component/icons/pdrating_512x512.png b/component/icons/pdrating_512x512.png deleted file mode 100644 index 67394ed..0000000 Binary files a/component/icons/pdrating_512x512.png and /dev/null differ diff --git a/component/icons/pdrating_64x64.png b/component/icons/pdrating_64x64.png deleted file mode 100644 index d72808c..0000000 Binary files a/component/icons/pdrating_64x64.png and /dev/null differ diff --git a/samples/PDRatingSample-Classic.sln b/samples/PDRatingSample-Classic.sln deleted file mode 100644 index f8694e2..0000000 --- a/samples/PDRatingSample-Classic.sln +++ /dev/null @@ -1,97 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDRatingSample-Classic", "PDRatingSample\PDRatingSample-Classic.csproj", "{E27FB641-24FC-40EB-BAB3-BD00321C4B83}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDRating-Classic", "..\src\PDRating\PDRating-Classic.csproj", "{AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone - Ad-Hoc|iPhone = Ad-Hoc|iPhone - AppStore|iPhone = AppStore|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.AppStore|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhone.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.AppStore|iPhone.Build.0 = AppStore|iPhone - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Debug|iPhone.ActiveCfg = Debug|iPhoneSimulator - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Debug|iPhone.Build.0 = Debug|iPhoneSimulator - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Release|iPhone.ActiveCfg = Release|iPhone - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Release|iPhone.Build.0 = Release|iPhone - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {E27FB641-24FC-40EB-BAB3-BD00321C4B83}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.AppStore|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhone.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = PDRatingSample\PDRatingSample-Classic.csproj - Policies = $0 - $0.TextStylePolicy = $1 - $1.FileWidth = 120 - $1.inheritsSet = VisualStudio - $1.inheritsScope = text/plain - $1.scope = text/plain - $0.TextStylePolicy = $2 - $2.inheritsSet = null - $2.scope = text/x-csharp - $0.StandardHeader = $3 - $3.Text = - $3.IncludeInNewFiles = True - $0.CSharpFormattingPolicy = $4 - $4.IndentSwitchBody = True - $4.NamespaceBraceStyle = EndOfLine - $4.ClassBraceStyle = EndOfLine - $4.InterfaceBraceStyle = EndOfLine - $4.StructBraceStyle = EndOfLine - $4.EnumBraceStyle = EndOfLine - $4.MethodBraceStyle = EndOfLine - $4.ConstructorBraceStyle = EndOfLine - $4.DestructorBraceStyle = EndOfLine - $4.ElseNewLinePlacement = NewLine - $4.ElseIfNewLinePlacement = DoNotCare - $4.CatchNewLinePlacement = NewLine - $4.FinallyNewLinePlacement = NewLine - $4.BeforeMethodDeclarationParentheses = False - $4.BeforeMethodCallParentheses = False - $4.BeforeConstructorDeclarationParentheses = False - $4.BeforeIndexerDeclarationBracket = False - $4.BeforeDelegateDeclarationParentheses = False - $4.AfterDelegateDeclarationParameterComma = True - $4.NewParentheses = False - $4.SpacesBeforeBrackets = False - $4.BlankLinesBetweenTypes = 0 - $4.BlankLinesBetweenMembers = 0 - $4.inheritsSet = Mono - $4.inheritsScope = text/x-csharp - $4.scope = text/x-csharp - EndGlobalSection -EndGlobal diff --git a/samples/PDRatingSample.sln b/samples/PDRatingSample.sln deleted file mode 100644 index 06cc05c..0000000 --- a/samples/PDRatingSample.sln +++ /dev/null @@ -1,97 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDRatingSample", "PDRatingSample\PDRatingSample.csproj", "{2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDRating", "..\src\PDRating\PDRating.csproj", "{62A0793B-8086-4424-84E2-9743845676C9}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone - Ad-Hoc|iPhone = Ad-Hoc|iPhone - AppStore|iPhone = AppStore|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.AppStore|iPhone.Build.0 = AppStore|iPhone - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Debug|iPhone.ActiveCfg = Debug|iPhone - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Debug|iPhone.Build.0 = Debug|iPhone - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Release|iPhone.ActiveCfg = Release|iPhone - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Release|iPhone.Build.0 = Release|iPhone - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {62A0793B-8086-4424-84E2-9743845676C9}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.AppStore|iPhone.Build.0 = Release|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Debug|iPhone.Build.0 = Debug|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Release|iPhone.ActiveCfg = Release|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Release|iPhone.Build.0 = Release|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {62A0793B-8086-4424-84E2-9743845676C9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.AppStore|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhone.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = PDRatingSample\PDRatingSample.csproj - Policies = $0 - $0.TextStylePolicy = $1 - $1.FileWidth = 120 - $1.inheritsSet = VisualStudio - $1.inheritsScope = text/plain - $1.scope = text/plain - $0.TextStylePolicy = $2 - $2.inheritsSet = null - $2.scope = text/x-csharp - $0.StandardHeader = $3 - $3.Text = - $3.IncludeInNewFiles = True - $0.CSharpFormattingPolicy = $4 - $4.IndentSwitchBody = True - $4.NamespaceBraceStyle = EndOfLine - $4.ClassBraceStyle = EndOfLine - $4.InterfaceBraceStyle = EndOfLine - $4.StructBraceStyle = EndOfLine - $4.EnumBraceStyle = EndOfLine - $4.MethodBraceStyle = EndOfLine - $4.ConstructorBraceStyle = EndOfLine - $4.DestructorBraceStyle = EndOfLine - $4.ElseNewLinePlacement = NewLine - $4.ElseIfNewLinePlacement = DoNotCare - $4.CatchNewLinePlacement = NewLine - $4.FinallyNewLinePlacement = NewLine - $4.BeforeMethodDeclarationParentheses = False - $4.BeforeMethodCallParentheses = False - $4.BeforeConstructorDeclarationParentheses = False - $4.BeforeIndexerDeclarationBracket = False - $4.BeforeDelegateDeclarationParentheses = False - $4.AfterDelegateDeclarationParameterComma = True - $4.NewParentheses = False - $4.SpacesBeforeBrackets = False - $4.BlankLinesBetweenTypes = 0 - $4.BlankLinesBetweenMembers = 0 - $4.inheritsSet = Mono - $4.inheritsScope = text/x-csharp - $4.scope = text/x-csharp - EndGlobalSection -EndGlobal diff --git a/samples/PDRatingSample/PDRatingSample-Classic.csproj b/samples/PDRatingSample/PDRatingSample-Classic.csproj deleted file mode 100644 index c87de1f..0000000 --- a/samples/PDRatingSample/PDRatingSample-Classic.csproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - Debug - iPhoneSimulator - 8.0.30703 - 2.0 - {E27FB641-24FC-40EB-BAB3-BD00321C4B83} - {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - PDRatingSample - PDRatingSampleClassic - Resources - obj\classic\$(Platform)\$(Configuration) - - - true - full - false - bin\classic\iPhoneSimulator\Debug - DEBUG; - prompt - 4 - false - None - true - - - full - true - bin\classic\iPhoneSimulator\Release - prompt - 4 - false - None - - - true - full - false - bin\classic\iPhone\Debug - DEBUG; - prompt - 4 - false - true - iPhone Developer - - - - - ARMv7 - - - full - true - bin\classic\iPhone\Release - prompt - 4 - false - iPhone Developer - - - full - true - bin\classic\iPhone\Ad-Hoc - prompt - 4 - true - false - iPhone Distribution - Automatic:AdHoc - - - full - true - bin\classic\iPhone\AppStore - prompt - 4 - iPhone Distribution - false - Automatic:AppStore - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF} - PDRating-Classic - - - diff --git a/src/PDRating.sln b/src/PDRating.sln index f3d5eab..059f42e 100644 --- a/src/PDRating.sln +++ b/src/PDRating.sln @@ -1,24 +1,38 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27705.2000 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDRating", "PDRating\PDRating.csproj", "{62A0793B-8086-4424-84E2-9743845676C9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDRating-Classic", "PDRating\PDRating-Classic.csproj", "{AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C4BDE7C3-563D-4513-A987-45C65CD5EC0B}" + ProjectSection(SolutionItems) = preProject + ..\LICENSE = ..\LICENSE + ..\README.md = ..\README.md + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDRatingSample", "PDRatingSample\PDRatingSample.csproj", "{2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone Ad-Hoc|iPhone = Ad-Hoc|iPhone + Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator AppStore|iPhone = AppStore|iPhone + AppStore|iPhoneSimulator = AppStore|iPhoneSimulator + Debug|iPhone = Debug|iPhone + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhone = Release|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {62A0793B-8086-4424-84E2-9743845676C9}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU {62A0793B-8086-4424-84E2-9743845676C9}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {62A0793B-8086-4424-84E2-9743845676C9}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {62A0793B-8086-4424-84E2-9743845676C9}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU {62A0793B-8086-4424-84E2-9743845676C9}.AppStore|iPhone.ActiveCfg = Debug|Any CPU {62A0793B-8086-4424-84E2-9743845676C9}.AppStore|iPhone.Build.0 = Debug|Any CPU + {62A0793B-8086-4424-84E2-9743845676C9}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {62A0793B-8086-4424-84E2-9743845676C9}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {62A0793B-8086-4424-84E2-9743845676C9}.Debug|iPhone.ActiveCfg = Debug|Any CPU {62A0793B-8086-4424-84E2-9743845676C9}.Debug|iPhone.Build.0 = Debug|Any CPU {62A0793B-8086-4424-84E2-9743845676C9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU @@ -27,28 +41,37 @@ Global {62A0793B-8086-4424-84E2-9743845676C9}.Release|iPhone.Build.0 = Release|Any CPU {62A0793B-8086-4424-84E2-9743845676C9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {62A0793B-8086-4424-84E2-9743845676C9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.AppStore|iPhone.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhone.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhone.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhone.Build.0 = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {AC4D8073-00A5-42EB-820A-5BE0DFB6E5BF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.AppStore|iPhone.ActiveCfg = AppStore|iPhone + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.AppStore|iPhone.Build.0 = AppStore|iPhone + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Debug|iPhone.ActiveCfg = Debug|iPhone + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Debug|iPhone.Build.0 = Debug|iPhone + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Release|iPhone.ActiveCfg = Release|iPhone + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Release|iPhone.Build.0 = Release|iPhone + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {2737BE32-ABCE-4F67-95A6-CF28DF3BE6FB}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C5A218C3-C347-4052-9C3D-A2CFCD5EAE7D} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = PDRating\PDRating.csproj Policies = $0 - $0.TextStylePolicy = $1 + $0.TextStylePolicy = $2 $1.FileWidth = 120 $1.inheritsSet = VisualStudio $1.inheritsScope = text/plain $1.scope = text/plain - $0.TextStylePolicy = $2 $2.inheritsSet = null $2.scope = text/x-csharp $0.StandardHeader = $3 diff --git a/src/PDRating/PDRating-Classic.csproj b/src/PDRating/PDRating-Classic.csproj index 918d5f7..526096c 100644 --- a/src/PDRating/PDRating-Classic.csproj +++ b/src/PDRating/PDRating-Classic.csproj @@ -43,6 +43,5 @@ - - + \ No newline at end of file diff --git a/src/PDRating/PDRating.csproj b/src/PDRating/PDRating.csproj index f85f76a..b1e848f 100644 --- a/src/PDRating/PDRating.csproj +++ b/src/PDRating/PDRating.csproj @@ -1,49 +1,56 @@ - - + + - Debug - AnyCPU - 8.0.30703 - 2.0 - {62A0793B-8086-4424-84E2-9743845676C9} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - PatridgeDev - Resources + Xamarin.iOS10 PDRating - Display and collect ratings for things in your app. - Xamarin.iOS - v1.0 - obj\unified\$(Platform)\$(Configuration) + PatridgeDev + $(AssemblyName) ($(TargetFramework)) + 1.0.0.0 + 1.0.0.0 + 1.0.0.0 + Adam Patridge,RatingView contributors + RatingView + true + https://github.com/patridge/PDRating/raw/master/component/icons/pdrating_64x64.png + https://github.com/patridge/PDRating + Adam Patridge + https://github.com/patridge/PDRating + Display and optionally collect user ratings for items in your Xamarin.iOS app using a custom rating image, custom scale, and an easily composible transparent background. + xamarin ios rating review + RatingView + + + Display and optionally collect user ratings for items in your Xamarin.iOS app using a custom rating image, custom scale, and an easily composible transparent background. + + Copyright 2018 + https://github.com/patridge/PDRating + See: https://github.com/patridge/PDRating + + en + default + false + + + $(DefineConstants); + - - true + + full - false - bin\unified\Debug - DEBUG; - prompt - 4 - false - - true - true - bin\unified\Release - prompt - 4 - false + + pdbonly + true + true + + - - - - - - - - - + + - + + + + diff --git a/src/PDRating/PDRatingView.cs b/src/PDRating/PDRatingView.cs index a286f89..d1579cd 100644 --- a/src/PDRating/PDRatingView.cs +++ b/src/PDRating/PDRatingView.cs @@ -2,23 +2,8 @@ using System.Linq; using System.Collections.Generic; -#if __UNIFIED__ using UIKit; -using Foundation; using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif namespace PatridgeDev { public class RatingConfig { diff --git a/src/PDRating/SizeFExtensions.cs b/src/PDRating/SizeFExtensions.cs index 78673ea..6352fff 100644 --- a/src/PDRating/SizeFExtensions.cs +++ b/src/PDRating/SizeFExtensions.cs @@ -1,24 +1,8 @@ using System; - -#if __UNIFIED__ -using UIKit; -using Foundation; using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif -namespace PatridgeDev { +namespace PatridgeDev +{ public static class SizeFExtensions { public static CGSize ScaleProportional(this CGSize original, nfloat maxWidth, nfloat maxHeight) { nfloat ratioX = (float)maxWidth / original.Width; diff --git a/src/PDRating/UIImageExtensions.cs b/src/PDRating/UIImageExtensions.cs index 8d966b7..3f2ce9c 100644 --- a/src/PDRating/UIImageExtensions.cs +++ b/src/PDRating/UIImageExtensions.cs @@ -1,20 +1,4 @@ -#if __UNIFIED__ using UIKit; -using Foundation; -using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif namespace PatridgeDev { public static class UIImageExtensions { @@ -26,7 +10,7 @@ public static void SetAspectFitAsNeeded(this UIImageView imageView, UIViewConten imageView.ContentMode = fallbackContentMode; if (imageView.Bounds.Width < imageView.Image.Size.Width || imageView.Bounds.Height < imageView.Image.Size.Height) { - imageView.ContentMode = UIViewContentMode.ScaleAspectFit; + imageView.ContentMode = UIViewContentMode.ScaleAspectFit; } } } diff --git a/samples/PDRatingSample/AppDelegate.cs b/src/PDRatingSample/AppDelegate.cs similarity index 97% rename from samples/PDRatingSample/AppDelegate.cs rename to src/PDRatingSample/AppDelegate.cs index 2d4a5c6..f2f6a5a 100644 --- a/samples/PDRatingSample/AppDelegate.cs +++ b/src/PDRatingSample/AppDelegate.cs @@ -1,53 +1,53 @@ -#if __UNIFIED__ -using UIKit; -using Foundation; -using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif - -namespace PDRatingSample { - public class Application { - static void Main(string[] args) { - UIApplication.Main(args, null, "AppDelegate"); - } - } - [Register("AppDelegate")] - public partial class AppDelegate : UIApplicationDelegate { - UIWindow window; - UITabBarController tabBarController; - - public override bool FinishedLaunching(UIApplication app, NSDictionary options) { - window = new UIWindow(UIScreen.MainScreen.Bounds); - window.BackgroundColor = UIColor.White; - - UIViewController viewController1 = new FiveStarViewController(); - UIViewController viewController2 = new TenTomatoesViewController(); - UIViewController viewController3 = new SixMoustachesViewController(); - UIViewController viewController4 = new CustomBackgroundViewController(); - UIViewController viewController5 = new SampleTableViewControllerController(); - tabBarController = new UITabBarController(); - tabBarController.ViewControllers = new[] { - viewController1, - viewController2, - viewController3, - viewController4, - viewController5, - }; - window.RootViewController = tabBarController; - window.MakeKeyAndVisible(); - return true; - } - } -} - +#if __UNIFIED__ +using UIKit; +using Foundation; +using CoreGraphics; +#else +using MonoTouch.UIKit; +using MonoTouch.Foundation; +using MonoTouch.CoreGraphics; + +using System.Drawing; +using CGRect = global::System.Drawing.RectangleF; +using CGPoint = global::System.Drawing.PointF; +using CGSize = global::System.Drawing.SizeF; +using nfloat = global::System.Single; +using nint = global::System.Int32; +using nuint = global::System.UInt32; +#endif + +namespace PDRatingSample { + public class Application { + static void Main(string[] args) { + UIApplication.Main(args, null, "AppDelegate"); + } + } + [Register("AppDelegate")] + public partial class AppDelegate : UIApplicationDelegate { + UIWindow window; + UITabBarController tabBarController; + + public override bool FinishedLaunching(UIApplication app, NSDictionary options) { + window = new UIWindow(UIScreen.MainScreen.Bounds); + window.BackgroundColor = UIColor.White; + + UIViewController viewController1 = new FiveStarViewController(); + UIViewController viewController2 = new TenTomatoesViewController(); + UIViewController viewController3 = new SixMoustachesViewController(); + UIViewController viewController4 = new CustomBackgroundViewController(); + UIViewController viewController5 = new SampleTableViewControllerController(); + tabBarController = new UITabBarController(); + tabBarController.ViewControllers = new[] { + viewController1, + viewController2, + viewController3, + viewController4, + viewController5, + }; + window.RootViewController = tabBarController; + window.MakeKeyAndVisible(); + return true; + } + } +} + diff --git a/samples/PDRatingSample/CustomBackgroundViewController.cs b/src/PDRatingSample/CustomBackgroundViewController.cs similarity index 97% rename from samples/PDRatingSample/CustomBackgroundViewController.cs rename to src/PDRatingSample/CustomBackgroundViewController.cs index c4c9b9d..2b56d97 100644 --- a/samples/PDRatingSample/CustomBackgroundViewController.cs +++ b/src/PDRatingSample/CustomBackgroundViewController.cs @@ -1,68 +1,68 @@ -using PatridgeDev; - -#if __UNIFIED__ -using UIKit; -using Foundation; -using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif - -namespace PDRatingSample { - public class CustomBackgroundViewController : UIViewController { - PDRatingView ratingView; - UIButton backgroundButton; - string ratingStyle = "Background"; - - public CustomBackgroundViewController() { - Title = ratingStyle; - TabBarItem.Image = UIImage.FromBundle("Stars/filled").Scale(new CGSize(30f, 30f)); - } - - public override void ViewDidLoad() { - base.ViewDidLoad(); - View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; - View.BackgroundColor = UIColor.White; - - var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty"), - filledImage: UIImage.FromBundle("Stars/filled"), - chosenImage: UIImage.FromBundle("Stars/chosen")); - // [Optional] Put a little space between the rating items. - ratingConfig.ItemPadding = 5f; - backgroundButton = UIButton.FromType(UIButtonType.RoundedRect); - backgroundButton.SetBackgroundImage(UIImage.FromBundle("Background/background").StretchableImage(0, 0), UIControlState.Normal); - backgroundButton.Frame = new CGRect(new CGPoint(24f, 24f), new CGSize(View.Bounds.Width - (2f * 24f), 125f)); - - var ratingFrame = backgroundButton.Bounds; - - ratingView = new PDRatingView(ratingFrame, ratingConfig); - - // [Optional] Set the current rating to display. - decimal rating = 3.58m; - //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; - //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); - ratingView.AverageRating = rating; - - // [Optional] Make it read-only to keep the user from setting a rating. - //StarRating.UserInteractionEnabled = false; - - // [Optional] Attach to the rating event to do something with the chosen value. - ratingView.RatingChosen += (sender, e) => { - (new UIAlertView("Rated!", e.Rating.ToString() + " stars", null, "Ok")).Show(); - }; - - backgroundButton.Add(ratingView); - View.Add(backgroundButton); - } - } +using PatridgeDev; + +#if __UNIFIED__ +using UIKit; +using Foundation; +using CoreGraphics; +#else +using MonoTouch.UIKit; +using MonoTouch.Foundation; +using MonoTouch.CoreGraphics; + +using System.Drawing; +using CGRect = global::System.Drawing.RectangleF; +using CGPoint = global::System.Drawing.PointF; +using CGSize = global::System.Drawing.SizeF; +using nfloat = global::System.Single; +using nint = global::System.Int32; +using nuint = global::System.UInt32; +#endif + +namespace PDRatingSample { + public class CustomBackgroundViewController : UIViewController { + PDRatingView ratingView; + UIButton backgroundButton; + string ratingStyle = "Background"; + + public CustomBackgroundViewController() { + Title = ratingStyle; + TabBarItem.Image = UIImage.FromBundle("Stars/filled").Scale(new CGSize(30f, 30f)); + } + + public override void ViewDidLoad() { + base.ViewDidLoad(); + View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; + View.BackgroundColor = UIColor.White; + + var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty"), + filledImage: UIImage.FromBundle("Stars/filled"), + chosenImage: UIImage.FromBundle("Stars/chosen")); + // [Optional] Put a little space between the rating items. + ratingConfig.ItemPadding = 5f; + backgroundButton = UIButton.FromType(UIButtonType.RoundedRect); + backgroundButton.SetBackgroundImage(UIImage.FromBundle("Background/background").StretchableImage(0, 0), UIControlState.Normal); + backgroundButton.Frame = new CGRect(new CGPoint(24f, 24f), new CGSize(View.Bounds.Width - (2f * 24f), 125f)); + + var ratingFrame = backgroundButton.Bounds; + + ratingView = new PDRatingView(ratingFrame, ratingConfig); + + // [Optional] Set the current rating to display. + decimal rating = 3.58m; + //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; + //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); + ratingView.AverageRating = rating; + + // [Optional] Make it read-only to keep the user from setting a rating. + //StarRating.UserInteractionEnabled = false; + + // [Optional] Attach to the rating event to do something with the chosen value. + ratingView.RatingChosen += (sender, e) => { + (new UIAlertView("Rated!", e.Rating.ToString() + " stars", null, "Ok")).Show(); + }; + + backgroundButton.Add(ratingView); + View.Add(backgroundButton); + } + } } \ No newline at end of file diff --git a/samples/PDRatingSample/Default-568h@2x.png b/src/PDRatingSample/Default-568h@2x.png similarity index 100% rename from samples/PDRatingSample/Default-568h@2x.png rename to src/PDRatingSample/Default-568h@2x.png diff --git a/samples/PDRatingSample/FiveStarViewController.cs b/src/PDRatingSample/FiveStarViewController.cs similarity index 97% rename from samples/PDRatingSample/FiveStarViewController.cs rename to src/PDRatingSample/FiveStarViewController.cs index 417f996..2fdbfd4 100644 --- a/samples/PDRatingSample/FiveStarViewController.cs +++ b/src/PDRatingSample/FiveStarViewController.cs @@ -1,62 +1,62 @@ -using PatridgeDev; - -#if __UNIFIED__ -using UIKit; -using Foundation; -using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif - -namespace PDRatingSample { - public class FiveStarViewController : UIViewController { - PDRatingView ratingView; - string ratingStyle = "Stars"; - - public FiveStarViewController() { - Title = ratingStyle; - TabBarItem.Image = UIImage.FromBundle(ratingStyle + "/filled").Scale(new CGSize(30f, 30f)); - } - - public override void ViewDidLoad() { - base.ViewDidLoad(); - View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; - View.BackgroundColor = UIColor.White; - - var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle(ratingStyle + "/empty"), - filledImage: UIImage.FromBundle(ratingStyle + "/filled"), - chosenImage: UIImage.FromBundle(ratingStyle + "/chosen")); - // [Optional] Put a little space between the rating items. - ratingConfig.ItemPadding = 5f; - var ratingFrame = new CGRect(CGPoint.Empty, new CGSize(View.Bounds.Width, 125f));; - - ratingView = new PDRatingView(ratingFrame, ratingConfig); - - // [Optional] Set the current rating to display. - decimal rating = 3.58m; - //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; - //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); - ratingView.AverageRating = rating; - - // [Optional] Make it read-only to keep the user from setting a rating. - //StarRating.UserInteractionEnabled = false; - - // [Optional] Attach to the rating event to do something with the chosen value. - ratingView.RatingChosen += (sender, e) => { - (new UIAlertView("Rated!", e.Rating.ToString() + " " + ratingStyle, null, "Ok")).Show(); - }; - - View.Add(ratingView); - } - } +using PatridgeDev; + +#if __UNIFIED__ +using UIKit; +using Foundation; +using CoreGraphics; +#else +using MonoTouch.UIKit; +using MonoTouch.Foundation; +using MonoTouch.CoreGraphics; + +using System.Drawing; +using CGRect = global::System.Drawing.RectangleF; +using CGPoint = global::System.Drawing.PointF; +using CGSize = global::System.Drawing.SizeF; +using nfloat = global::System.Single; +using nint = global::System.Int32; +using nuint = global::System.UInt32; +#endif + +namespace PDRatingSample { + public class FiveStarViewController : UIViewController { + PDRatingView ratingView; + string ratingStyle = "Stars"; + + public FiveStarViewController() { + Title = ratingStyle; + TabBarItem.Image = UIImage.FromBundle(ratingStyle + "/filled").Scale(new CGSize(30f, 30f)); + } + + public override void ViewDidLoad() { + base.ViewDidLoad(); + View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; + View.BackgroundColor = UIColor.White; + + var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle(ratingStyle + "/empty"), + filledImage: UIImage.FromBundle(ratingStyle + "/filled"), + chosenImage: UIImage.FromBundle(ratingStyle + "/chosen")); + // [Optional] Put a little space between the rating items. + ratingConfig.ItemPadding = 5f; + var ratingFrame = new CGRect(CGPoint.Empty, new CGSize(View.Bounds.Width, 125f));; + + ratingView = new PDRatingView(ratingFrame, ratingConfig); + + // [Optional] Set the current rating to display. + decimal rating = 3.58m; + //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; + //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); + ratingView.AverageRating = rating; + + // [Optional] Make it read-only to keep the user from setting a rating. + //StarRating.UserInteractionEnabled = false; + + // [Optional] Attach to the rating event to do something with the chosen value. + ratingView.RatingChosen += (sender, e) => { + (new UIAlertView("Rated!", e.Rating.ToString() + " " + ratingStyle, null, "Ok")).Show(); + }; + + View.Add(ratingView); + } + } } \ No newline at end of file diff --git a/samples/PDRatingSample/Info.plist b/src/PDRatingSample/Info.plist similarity index 100% rename from samples/PDRatingSample/Info.plist rename to src/PDRatingSample/Info.plist diff --git a/samples/PDRatingSample/PDRatingSample.csproj b/src/PDRatingSample/PDRatingSample.csproj similarity index 93% rename from samples/PDRatingSample/PDRatingSample.csproj rename to src/PDRatingSample/PDRatingSample.csproj index cf745f9..984f8fc 100644 --- a/samples/PDRatingSample/PDRatingSample.csproj +++ b/src/PDRatingSample/PDRatingSample.csproj @@ -1,4 +1,4 @@ - + Debug @@ -123,17 +123,12 @@ + - - - - - - - - - {62A0793B-8086-4424-84E2-9743845676C9} + + {62a0793b-8086-4424-84e2-9743845676c9} PDRating - + + \ No newline at end of file diff --git a/samples/PDRatingSample/Resources/Background/background.png b/src/PDRatingSample/Resources/Background/background.png similarity index 100% rename from samples/PDRatingSample/Resources/Background/background.png rename to src/PDRatingSample/Resources/Background/background.png diff --git a/samples/PDRatingSample/Resources/Icon-60@2x.png b/src/PDRatingSample/Resources/Icon-60@2x.png similarity index 100% rename from samples/PDRatingSample/Resources/Icon-60@2x.png rename to src/PDRatingSample/Resources/Icon-60@2x.png diff --git a/samples/PDRatingSample/Resources/Icon-72.png b/src/PDRatingSample/Resources/Icon-72.png similarity index 100% rename from samples/PDRatingSample/Resources/Icon-72.png rename to src/PDRatingSample/Resources/Icon-72.png diff --git a/samples/PDRatingSample/Resources/Icon-72@2x.png b/src/PDRatingSample/Resources/Icon-72@2x.png similarity index 100% rename from samples/PDRatingSample/Resources/Icon-72@2x.png rename to src/PDRatingSample/Resources/Icon-72@2x.png diff --git a/samples/PDRatingSample/Resources/Icon-76.png b/src/PDRatingSample/Resources/Icon-76.png similarity index 100% rename from samples/PDRatingSample/Resources/Icon-76.png rename to src/PDRatingSample/Resources/Icon-76.png diff --git a/samples/PDRatingSample/Resources/Icon-76@2x.png b/src/PDRatingSample/Resources/Icon-76@2x.png similarity index 100% rename from samples/PDRatingSample/Resources/Icon-76@2x.png rename to src/PDRatingSample/Resources/Icon-76@2x.png diff --git a/samples/PDRatingSample/Resources/Icon.png b/src/PDRatingSample/Resources/Icon.png similarity index 100% rename from samples/PDRatingSample/Resources/Icon.png rename to src/PDRatingSample/Resources/Icon.png diff --git a/samples/PDRatingSample/Resources/Icon@2x.png b/src/PDRatingSample/Resources/Icon@2x.png similarity index 100% rename from samples/PDRatingSample/Resources/Icon@2x.png rename to src/PDRatingSample/Resources/Icon@2x.png diff --git a/samples/PDRatingSample/Resources/Moustaches/chosen.png b/src/PDRatingSample/Resources/Moustaches/chosen.png similarity index 100% rename from samples/PDRatingSample/Resources/Moustaches/chosen.png rename to src/PDRatingSample/Resources/Moustaches/chosen.png diff --git a/samples/PDRatingSample/Resources/Moustaches/empty.png b/src/PDRatingSample/Resources/Moustaches/empty.png similarity index 100% rename from samples/PDRatingSample/Resources/Moustaches/empty.png rename to src/PDRatingSample/Resources/Moustaches/empty.png diff --git a/samples/PDRatingSample/Resources/Moustaches/filled.png b/src/PDRatingSample/Resources/Moustaches/filled.png similarity index 100% rename from samples/PDRatingSample/Resources/Moustaches/filled.png rename to src/PDRatingSample/Resources/Moustaches/filled.png diff --git a/samples/PDRatingSample/Resources/Stars/chosen.png b/src/PDRatingSample/Resources/Stars/chosen.png similarity index 100% rename from samples/PDRatingSample/Resources/Stars/chosen.png rename to src/PDRatingSample/Resources/Stars/chosen.png diff --git a/samples/PDRatingSample/Resources/Stars/empty.png b/src/PDRatingSample/Resources/Stars/empty.png similarity index 100% rename from samples/PDRatingSample/Resources/Stars/empty.png rename to src/PDRatingSample/Resources/Stars/empty.png diff --git a/samples/PDRatingSample/Resources/Stars/filled.png b/src/PDRatingSample/Resources/Stars/filled.png similarity index 100% rename from samples/PDRatingSample/Resources/Stars/filled.png rename to src/PDRatingSample/Resources/Stars/filled.png diff --git a/samples/PDRatingSample/Resources/Tomatoes/chosen.png b/src/PDRatingSample/Resources/Tomatoes/chosen.png similarity index 100% rename from samples/PDRatingSample/Resources/Tomatoes/chosen.png rename to src/PDRatingSample/Resources/Tomatoes/chosen.png diff --git a/samples/PDRatingSample/Resources/Tomatoes/empty.png b/src/PDRatingSample/Resources/Tomatoes/empty.png similarity index 100% rename from samples/PDRatingSample/Resources/Tomatoes/empty.png rename to src/PDRatingSample/Resources/Tomatoes/empty.png diff --git a/samples/PDRatingSample/Resources/Tomatoes/filled.png b/src/PDRatingSample/Resources/Tomatoes/filled.png similarity index 100% rename from samples/PDRatingSample/Resources/Tomatoes/filled.png rename to src/PDRatingSample/Resources/Tomatoes/filled.png diff --git a/samples/PDRatingSample/SampleTableViewControllerController.cs b/src/PDRatingSample/SampleTableViewControllerController.cs similarity index 97% rename from samples/PDRatingSample/SampleTableViewControllerController.cs rename to src/PDRatingSample/SampleTableViewControllerController.cs index 72e6dac..cb5c519 100644 --- a/samples/PDRatingSample/SampleTableViewControllerController.cs +++ b/src/PDRatingSample/SampleTableViewControllerController.cs @@ -1,86 +1,86 @@ -using System; -using PatridgeDev; - -#if __UNIFIED__ -using UIKit; -using Foundation; -using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif - -namespace PDRatingSample { - public class SampleTableViewControllerController : UITableViewController { - public SampleTableViewControllerController() : base (UITableViewStyle.Plain) { - Title = "Table"; - TabBarItem.Image = UIImage.FromBundle("Stars/filled").Scale(new CGSize(30f, 30f)); - } - - public override void ViewDidLoad() { - base.ViewDidLoad(); - - TableView.Source = new SampleTableViewControllerSource(50); - } - } - public class SampleTableViewControllerSource : UITableViewSource { - public int RowCount; - public SampleTableViewControllerSource(int rowCount) { - RowCount = rowCount; - } - - public override nint NumberOfSections(UITableView tableView) { - return 1; - } - - public override nint RowsInSection(UITableView tableview, nint section) { - return RowCount; - } - - public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { - tableView.CellAt(indexPath).Selected = false; - } - - public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { - var cell = tableView.DequeueReusableCell(SampleTableViewControllerCell.Key) as SampleTableViewControllerCell; - if (cell == null) { - cell = new SampleTableViewControllerCell(); - } - - cell.Update(indexPath.Row % 6); - - return cell; - } - } - public class SampleTableViewControllerCell : UITableViewCell { - public static readonly NSString Key = new NSString("RatingsCell"); - PDRatingView ratingView; - - public void Update(int rating) { - decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; - ratingView.AverageRating = halfRoundedRating; - } - - public SampleTableViewControllerCell() : base(UITableViewCellStyle.Value1, Key) { - AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; - BackgroundColor = UIColor.White; - - var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty"), - filledImage: UIImage.FromBundle("Stars/filled"), - chosenImage: UIImage.FromBundle("Stars/chosen")); - ratingView = new PDRatingView(new CGRect(CGPoint.Empty, ContentView.Bounds.Size), ratingConfig); - ratingView.UserInteractionEnabled = false; - - ContentView.Add(ratingView); - } - } +using System; +using PatridgeDev; + +#if __UNIFIED__ +using UIKit; +using Foundation; +using CoreGraphics; +#else +using MonoTouch.UIKit; +using MonoTouch.Foundation; +using MonoTouch.CoreGraphics; + +using System.Drawing; +using CGRect = global::System.Drawing.RectangleF; +using CGPoint = global::System.Drawing.PointF; +using CGSize = global::System.Drawing.SizeF; +using nfloat = global::System.Single; +using nint = global::System.Int32; +using nuint = global::System.UInt32; +#endif + +namespace PDRatingSample { + public class SampleTableViewControllerController : UITableViewController { + public SampleTableViewControllerController() : base (UITableViewStyle.Plain) { + Title = "Table"; + TabBarItem.Image = UIImage.FromBundle("Stars/filled").Scale(new CGSize(30f, 30f)); + } + + public override void ViewDidLoad() { + base.ViewDidLoad(); + + TableView.Source = new SampleTableViewControllerSource(50); + } + } + public class SampleTableViewControllerSource : UITableViewSource { + public int RowCount; + public SampleTableViewControllerSource(int rowCount) { + RowCount = rowCount; + } + + public override nint NumberOfSections(UITableView tableView) { + return 1; + } + + public override nint RowsInSection(UITableView tableview, nint section) { + return RowCount; + } + + public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { + tableView.CellAt(indexPath).Selected = false; + } + + public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { + var cell = tableView.DequeueReusableCell(SampleTableViewControllerCell.Key) as SampleTableViewControllerCell; + if (cell == null) { + cell = new SampleTableViewControllerCell(); + } + + cell.Update(indexPath.Row % 6); + + return cell; + } + } + public class SampleTableViewControllerCell : UITableViewCell { + public static readonly NSString Key = new NSString("RatingsCell"); + PDRatingView ratingView; + + public void Update(int rating) { + decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; + ratingView.AverageRating = halfRoundedRating; + } + + public SampleTableViewControllerCell() : base(UITableViewCellStyle.Value1, Key) { + AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; + BackgroundColor = UIColor.White; + + var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty"), + filledImage: UIImage.FromBundle("Stars/filled"), + chosenImage: UIImage.FromBundle("Stars/chosen")); + ratingView = new PDRatingView(new CGRect(CGPoint.Empty, ContentView.Bounds.Size), ratingConfig); + ratingView.UserInteractionEnabled = false; + + ContentView.Add(ratingView); + } + } } \ No newline at end of file diff --git a/samples/PDRatingSample/SixMoustachesViewController.cs b/src/PDRatingSample/SixMoustachesViewController.cs similarity index 97% rename from samples/PDRatingSample/SixMoustachesViewController.cs rename to src/PDRatingSample/SixMoustachesViewController.cs index 5e48557..0739fb7 100644 --- a/samples/PDRatingSample/SixMoustachesViewController.cs +++ b/src/PDRatingSample/SixMoustachesViewController.cs @@ -1,62 +1,62 @@ -using PatridgeDev; - -#if __UNIFIED__ -using UIKit; -using Foundation; -using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif - -namespace PDRatingSample { - public class SixMoustachesViewController : UIViewController { - PDRatingView ratingView; - string ratingStyle = "Moustaches"; - - public SixMoustachesViewController() { - Title = ratingStyle; - TabBarItem.Image = UIImage.FromBundle(ratingStyle + "/filled").Scale(new CGSize(30f, 30f)); - } - - public override void ViewDidLoad() { - base.ViewDidLoad(); - View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; - View.BackgroundColor = UIColor.White; - - var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle(ratingStyle + "/empty"), - filledImage: UIImage.FromBundle(ratingStyle + "/filled"), - chosenImage: UIImage.FromBundle(ratingStyle + "/chosen")); - // [Optional] Put a little space between the rating items. - ratingConfig.ItemPadding = 5f; - var ratingFrame = new CGRect(CGPoint.Empty, new CGSize(View.Bounds.Width, 125f));; - - ratingView = new PDRatingView(ratingFrame, ratingConfig); - - // [Optional] Set the current rating to display. - decimal rating = 3.58m; - //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; - //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); - ratingView.AverageRating = rating; - - // [Optional] Make it read-only to keep the user from setting a rating. - //StarRating.UserInteractionEnabled = false; - - // [Optional] Attach to the rating event to do something with the chosen value. - ratingView.RatingChosen += (sender, e) => { - (new UIAlertView("Rated!", e.Rating.ToString() + " " + ratingStyle, null, "Ok")).Show(); - }; - - View.Add(ratingView); - } - } +using PatridgeDev; + +#if __UNIFIED__ +using UIKit; +using Foundation; +using CoreGraphics; +#else +using MonoTouch.UIKit; +using MonoTouch.Foundation; +using MonoTouch.CoreGraphics; + +using System.Drawing; +using CGRect = global::System.Drawing.RectangleF; +using CGPoint = global::System.Drawing.PointF; +using CGSize = global::System.Drawing.SizeF; +using nfloat = global::System.Single; +using nint = global::System.Int32; +using nuint = global::System.UInt32; +#endif + +namespace PDRatingSample { + public class SixMoustachesViewController : UIViewController { + PDRatingView ratingView; + string ratingStyle = "Moustaches"; + + public SixMoustachesViewController() { + Title = ratingStyle; + TabBarItem.Image = UIImage.FromBundle(ratingStyle + "/filled").Scale(new CGSize(30f, 30f)); + } + + public override void ViewDidLoad() { + base.ViewDidLoad(); + View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; + View.BackgroundColor = UIColor.White; + + var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle(ratingStyle + "/empty"), + filledImage: UIImage.FromBundle(ratingStyle + "/filled"), + chosenImage: UIImage.FromBundle(ratingStyle + "/chosen")); + // [Optional] Put a little space between the rating items. + ratingConfig.ItemPadding = 5f; + var ratingFrame = new CGRect(CGPoint.Empty, new CGSize(View.Bounds.Width, 125f));; + + ratingView = new PDRatingView(ratingFrame, ratingConfig); + + // [Optional] Set the current rating to display. + decimal rating = 3.58m; + //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; + //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); + ratingView.AverageRating = rating; + + // [Optional] Make it read-only to keep the user from setting a rating. + //StarRating.UserInteractionEnabled = false; + + // [Optional] Attach to the rating event to do something with the chosen value. + ratingView.RatingChosen += (sender, e) => { + (new UIAlertView("Rated!", e.Rating.ToString() + " " + ratingStyle, null, "Ok")).Show(); + }; + + View.Add(ratingView); + } + } } \ No newline at end of file diff --git a/samples/PDRatingSample/TenMoustachesViewController.cs b/src/PDRatingSample/TenMoustachesViewController.cs similarity index 97% rename from samples/PDRatingSample/TenMoustachesViewController.cs rename to src/PDRatingSample/TenMoustachesViewController.cs index 8293fdf..3900631 100644 --- a/samples/PDRatingSample/TenMoustachesViewController.cs +++ b/src/PDRatingSample/TenMoustachesViewController.cs @@ -1,63 +1,63 @@ -using PatridgeDev; - -#if __UNIFIED__ -using UIKit; -using Foundation; -using CoreGraphics; -#else -using MonoTouch.UIKit; -using MonoTouch.Foundation; -using MonoTouch.CoreGraphics; - -using System.Drawing; -using CGRect = global::System.Drawing.RectangleF; -using CGPoint = global::System.Drawing.PointF; -using CGSize = global::System.Drawing.SizeF; -using nfloat = global::System.Single; -using nint = global::System.Int32; -using nuint = global::System.UInt32; -#endif - -namespace PDRatingSample { - public class TenTomatoesViewController : UIViewController { - PDRatingView ratingView; - string ratingStyle = "Tomatoes"; - - public TenTomatoesViewController() { - Title = ratingStyle; - TabBarItem.Image = UIImage.FromBundle(ratingStyle + "/filled").Scale(new CGSize(30f, 30f)); - } - - public override void ViewDidLoad() { - base.ViewDidLoad(); - View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; - View.BackgroundColor = UIColor.White; - - var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle(ratingStyle + "/empty"), - filledImage: UIImage.FromBundle(ratingStyle + "/filled"), - chosenImage: UIImage.FromBundle(ratingStyle + "/chosen")); - ratingConfig.ScaleSize = 10; - // [Optional] Put a little space between the rating items. - ratingConfig.ItemPadding = 5f; - var ratingFrame = new CGRect(CGPoint.Empty, new CGSize(View.Bounds.Width, 125f));; - - ratingView = new PDRatingView(ratingFrame, ratingConfig); - - // [Optional] Set the current rating to display. - decimal rating = 3.58m; - //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; - //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); - ratingView.AverageRating = rating; - - // [Optional] Make it read-only to keep the user from setting a rating. - //StarRating.UserInteractionEnabled = false; - - // [Optional] Attach to the rating event to do something with the chosen value. - ratingView.RatingChosen += (sender, e) => { - (new UIAlertView("Rated!", e.Rating.ToString() + " " + ratingStyle, null, "Ok")).Show(); - }; - - View.Add(ratingView); - } - } +using PatridgeDev; + +#if __UNIFIED__ +using UIKit; +using Foundation; +using CoreGraphics; +#else +using MonoTouch.UIKit; +using MonoTouch.Foundation; +using MonoTouch.CoreGraphics; + +using System.Drawing; +using CGRect = global::System.Drawing.RectangleF; +using CGPoint = global::System.Drawing.PointF; +using CGSize = global::System.Drawing.SizeF; +using nfloat = global::System.Single; +using nint = global::System.Int32; +using nuint = global::System.UInt32; +#endif + +namespace PDRatingSample { + public class TenTomatoesViewController : UIViewController { + PDRatingView ratingView; + string ratingStyle = "Tomatoes"; + + public TenTomatoesViewController() { + Title = ratingStyle; + TabBarItem.Image = UIImage.FromBundle(ratingStyle + "/filled").Scale(new CGSize(30f, 30f)); + } + + public override void ViewDidLoad() { + base.ViewDidLoad(); + View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; + View.BackgroundColor = UIColor.White; + + var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle(ratingStyle + "/empty"), + filledImage: UIImage.FromBundle(ratingStyle + "/filled"), + chosenImage: UIImage.FromBundle(ratingStyle + "/chosen")); + ratingConfig.ScaleSize = 10; + // [Optional] Put a little space between the rating items. + ratingConfig.ItemPadding = 5f; + var ratingFrame = new CGRect(CGPoint.Empty, new CGSize(View.Bounds.Width, 125f));; + + ratingView = new PDRatingView(ratingFrame, ratingConfig); + + // [Optional] Set the current rating to display. + decimal rating = 3.58m; + //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; + //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); + ratingView.AverageRating = rating; + + // [Optional] Make it read-only to keep the user from setting a rating. + //StarRating.UserInteractionEnabled = false; + + // [Optional] Attach to the rating event to do something with the chosen value. + ratingView.RatingChosen += (sender, e) => { + (new UIAlertView("Rated!", e.Rating.ToString() + " " + ratingStyle, null, "Ok")).Show(); + }; + + View.Add(ratingView); + } + } } \ No newline at end of file