From f05f39fac4cfc0919cbbafe51567bc61e0352361 Mon Sep 17 00:00:00 2001 From: "Jasper H. Bojsen" Date: Tue, 10 Nov 2026 12:31:42 +0000 Subject: [PATCH] Target .NET 10, fix selection and children bugs, add tests and release CI Build - Library targets netstandard2.0 and net10.0; Xamarin.Forms 5.0.0.2662. - C# 14, .editorconfig style rules enforced at build time (Directory.Build.props); library and tests treat warnings as errors; XML docs required on public API. - Solution migrated to SegCtlr.Netstandard.slnx; global.json pins the .NET 10 SDK. Shared control (covered by the new xUnit project, src/test/SegCtlr.Tests) - SelectedItem selects its segment for string ItemsSource and XAML options; items are compared with Equals. - Replacing Children no longer clears or refills the previous list. - OnSegmentSelected and SegmentSelectedCommand are raised by the control, once per SelectedSegment change, not on page load; RaiseSelectionChanged is obsolete. - ItemsSource: null clears the segments, non-string items fall back to ToString(), observable collections are followed. - Children defaults to an ObservableCollection; edits reach the renderers; segments get Parent and BindingContext. - Weak subscriptions so items and collections do not keep options or controls alive; FontSize default no longer needs Forms.Init(). Renderers (not compiled in this environment) - Detach handlers from the old element and the old segments. - Android: per-button drawable state (Mutate), middle-segment background, disabled control ignores taps, ClearCheck instead of re-inflating, DisabledColor, null checks. - iOS: font and colors for both states, border on IsEnabled/DisabledColor, renderer reuse. - UWP: per-segment WidthRequest, stale-option crash, DisabledColor border. - macOS: rebuild from empty, re-attach child handlers, range checks. Release - Replace build.ps1/publish.ps1/publishLocal.ps1 with GitHub Actions: ci.yml (hosted) and build.yml (GitVersion, releases/** branches, self-hosted Xamarin runners, NuGet.org Trusted Publishing, GitHub Packages, draft GitHub release). See docs/releasing.md. - Pack via src/build/Plugin.SegmentedControl.Package.csproj; a platform without binaries fails the pack. - Include the macOS renderer assembly, which earlier packages left out. --- .devcontainer/post-create.sh | 2 +- .editorconfig | 198 +++++ .github/workflows/build.yml | 258 +++++++ .github/workflows/ci.yml | 55 ++ AGENTS.md | 16 +- Directory.Build.props | 16 + GitVersion.yml | 7 + README.md | 22 +- docs/releasing.md | 45 ++ global.json | 6 + ...Plugin.SegmentedControl.Netstandard.nuspec | 34 +- .../Plugin.SegmentedControl.Package.csproj | 25 + src/build/build.ps1 | 22 - src/build/publish.ps1 | 12 - src/build/publishLocal.ps1 | 12 - .../SegCtrl.Droid/SegCtrl.Droid.csproj | 2 +- .../SegCtrl.Droid/SegmentedControlRenderer.cs | 90 ++- .../SegCtrl.UWP/SegCtrl.UWP.csproj | 2 +- .../SegCtrl.UWP/SegmentRadioButton.cs | 19 +- .../SegCtrl.UWP/SegmentedControlRenderer.cs | 38 +- .../SegCtrl.iOS/SegCtrl.iOS.csproj | 2 +- .../SegCtrl.iOS/SegmentedControlRenderer.cs | 121 +-- .../SegCtrl.macOS/SegCtrl.macOS.csproj | 2 +- .../SegCtrl.macOS/SegmentedControlRenderer.cs | 70 +- src/main/SegCtlr.Netstandard.sln | 726 ------------------ src/main/SegCtlr.Netstandard.slnx | 132 ++++ .../Control/SegmentedControl.cs | 665 +++++++++++----- .../Control/SegmentedControlOption.cs | 124 ++- .../Event/ElementChildrenChanging.cs | 30 +- .../Event/SegmentSelectEvent.cs | 13 +- .../SegCtlr.Netstandard/PreserveAttribute.cs | 18 +- .../SegCtlr.Netstandard.csproj | 14 +- src/main/SegCtlr.Netstandard/WeakEvents.cs | 69 ++ src/test/SegCtlr.Tests/ChildrenTests.cs | 88 +++ src/test/SegCtlr.Tests/DefaultsTests.cs | 15 + src/test/SegCtlr.Tests/ItemsSourceTests.cs | 112 +++ .../SegCtlr.Tests/ObservableChildrenTests.cs | 120 +++ src/test/SegCtlr.Tests/SegCtlr.Tests.csproj | 27 + .../SegmentedControlOptionTests.cs | 143 ++++ src/test/SegCtlr.Tests/SelectedItemTests.cs | 151 ++++ src/test/SegCtlr.Tests/SelectionEventTests.cs | 87 +++ .../Test.SegCtrl.Android.csproj | 2 +- .../Test.SegCtrl.UWP/Test.SegCtlr.UWP.csproj | 2 +- .../Test.SegCtrl.iOS/Test.SegCtlr.iOS.csproj | 2 +- .../Test.SegCtrl.macOS.csproj | 2 +- src/test/Test.SegCtrl.netstandard/App.xaml.cs | 42 +- .../Test.SegCtrl.netstandard/MainPage.xaml.cs | 226 +++--- .../Test.SegCtrl.netstandard/MainViewModel.cs | 182 ++--- .../SecondPage.xaml.cs | 30 +- .../Test.SegCtrl.netstandard.csproj | 15 +- .../ThirdPage.xaml.cs | 92 ++- 51 files changed, 2713 insertions(+), 1492 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml create mode 100644 Directory.Build.props create mode 100644 GitVersion.yml create mode 100644 docs/releasing.md create mode 100644 global.json create mode 100644 src/build/Plugin.SegmentedControl.Package.csproj delete mode 100644 src/build/build.ps1 delete mode 100644 src/build/publish.ps1 delete mode 100644 src/build/publishLocal.ps1 delete mode 100644 src/main/SegCtlr.Netstandard.sln create mode 100644 src/main/SegCtlr.Netstandard.slnx create mode 100644 src/main/SegCtlr.Netstandard/WeakEvents.cs create mode 100644 src/test/SegCtlr.Tests/ChildrenTests.cs create mode 100644 src/test/SegCtlr.Tests/DefaultsTests.cs create mode 100644 src/test/SegCtlr.Tests/ItemsSourceTests.cs create mode 100644 src/test/SegCtlr.Tests/ObservableChildrenTests.cs create mode 100644 src/test/SegCtlr.Tests/SegCtlr.Tests.csproj create mode 100644 src/test/SegCtlr.Tests/SegmentedControlOptionTests.cs create mode 100644 src/test/SegCtlr.Tests/SelectedItemTests.cs create mode 100644 src/test/SegCtlr.Tests/SelectionEventTests.cs diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index b56d828..d3ac0cc 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -# The solution (src/main/SegCtlr.Netstandard.sln) also holds the legacy Xamarin.iOS, Xamarin.Android, Xamarin.Mac +# The solution (src/main/SegCtlr.Netstandard.slnx) also holds the legacy Xamarin.iOS, Xamarin.Android, Xamarin.Mac # and UWP projects, which cannot restore on Linux. Restore the netstandard test app instead: it references the # library, so both netstandard projects restore. solution_path="src/test/Test.SegCtrl.netstandard/Test.SegCtrl.netstandard.csproj" diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8c1476f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,198 @@ +# Code style for Plugin.SegmentedControl. +# +# SDK-style projects (the library, the shared sample and the tests) enforce these rules at build time through +# EnforceCodeStyleInBuild in Directory.Build.props. Rules set to "warning" fail the library and test builds, +# which use TreatWarningsAsErrors. The legacy Xamarin platform projects only show them in the IDE. + +root = true + +[*] +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{csproj,props,targets,nuspec,xml,xaml,axml,json,yml,yaml}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[*.cs] +indent_size = 4 +max_line_length = 120 + +#### Formatting (IDE0055) #### +dotnet_diagnostic.IDE0055.severity = warning +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = false +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_space_after_cast = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_around_binary_operators = before_and_after +csharp_preserve_single_line_statements = false +csharp_preserve_single_line_blocks = true + +#### Usings and namespaces #### +csharp_using_directive_placement = outside_namespace:warning +dotnet_diagnostic.IDE0065.severity = warning +# Unnecessary usings (needs GenerateDocumentationFile to be reported at build time). +dotnet_diagnostic.IDE0005.severity = warning +csharp_style_namespace_declarations = file_scoped:warning +dotnet_diagnostic.IDE0161.severity = warning + +#### Braces and blocks #### +csharp_prefer_braces = true:warning +dotnet_diagnostic.IDE0011.severity = warning + +#### var #### +csharp_style_var_for_built_in_types = true:warning +csharp_style_var_when_type_is_apparent = true:warning +csharp_style_var_elsewhere = true:warning +dotnet_diagnostic.IDE0007.severity = warning +dotnet_diagnostic.IDE0008.severity = none + +#### Modifiers #### +dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning +dotnet_diagnostic.IDE0040.severity = warning +csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning +dotnet_diagnostic.IDE0036.severity = warning +dotnet_style_readonly_field = true:warning +dotnet_diagnostic.IDE0044.severity = warning + +#### this. and predefined types #### +dotnet_style_qualification_for_field = false:warning +dotnet_style_qualification_for_property = false:warning +dotnet_style_qualification_for_method = false:warning +dotnet_style_qualification_for_event = false:warning +dotnet_diagnostic.IDE0003.severity = warning +dotnet_style_predefined_type_for_locals_parameters_members = true:warning +dotnet_style_predefined_type_for_member_access = true:warning +dotnet_diagnostic.IDE0049.severity = warning + +#### Modern language features #### +# `is null` / `is not null` rather than `== null` or `!(x is null)`. +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning +dotnet_diagnostic.IDE0041.severity = warning +csharp_style_prefer_not_pattern = true:warning +dotnet_diagnostic.IDE0083.severity = warning +csharp_style_prefer_pattern_matching = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:warning +dotnet_diagnostic.IDE0019.severity = warning +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +dotnet_diagnostic.IDE0020.severity = warning +# Target-typed new and collection expressions. +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning +dotnet_diagnostic.IDE0090.severity = warning +dotnet_style_prefer_collection_expression = when_types_loosely_match:warning +dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0300.severity = warning +dotnet_diagnostic.IDE0301.severity = warning +dotnet_diagnostic.IDE0303.severity = warning +dotnet_diagnostic.IDE0305.severity = warning +# Null propagation, coalescing and conditional delegate calls. +dotnet_style_null_propagation = true:warning +dotnet_diagnostic.IDE0031.severity = warning +dotnet_style_coalesce_expression = true:warning +dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0030.severity = warning +csharp_style_conditional_delegate_call = true:warning +dotnet_diagnostic.IDE1005.severity = warning +dotnet_style_object_initializer = true:warning +dotnet_diagnostic.IDE0017.severity = warning +csharp_style_inlined_variable_declaration = true:warning +dotnet_diagnostic.IDE0018.severity = warning +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_prefer_primary_constructors = true:suggestion +csharp_style_prefer_switch_expression = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_expression_bodied_properties = true:suggestion +csharp_style_expression_bodied_accessors = true:suggestion +csharp_style_expression_bodied_indexers = true:suggestion +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_methods = when_on_single_line:suggestion +csharp_style_expression_bodied_constructors = false:suggestion +csharp_style_expression_bodied_operators = when_on_single_line:suggestion +csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:warning +dotnet_diagnostic.IDE0059.severity = warning +csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion +dotnet_code_quality_unused_parameters = non_public:warning +dotnet_diagnostic.IDE0060.severity = warning +dotnet_diagnostic.IDE0051.severity = warning +dotnet_diagnostic.IDE0052.severity = warning +# Redundant casts. +dotnet_diagnostic.IDE0004.severity = warning +# Simplify names. +dotnet_diagnostic.IDE0001.severity = warning +dotnet_diagnostic.IDE0002.severity = warning +# Remove unnecessary parentheses / empty lines. +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion +dotnet_style_allow_multiple_blank_lines_experimental = false:warning +dotnet_diagnostic.IDE2000.severity = warning +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning +dotnet_diagnostic.IDE2002.severity = warning + +#### Naming (IDE1006) #### +dotnet_diagnostic.IDE1006.severity = warning + +dotnet_naming_symbols.interfaces.applicable_kinds = interface +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.capitalization = pascal_case +dotnet_naming_rule.interfaces_begin_with_i.symbols = interfaces +dotnet_naming_rule.interfaces_begin_with_i.style = begins_with_i +dotnet_naming_rule.interfaces_begin_with_i.severity = warning + +dotnet_naming_symbols.types_and_members.applicable_kinds = class, struct, enum, delegate, property, method, event +dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_rule.types_and_members_pascal_case.symbols = types_and_members +dotnet_naming_rule.types_and_members_pascal_case.style = pascal_case +dotnet_naming_rule.types_and_members_pascal_case.severity = warning + +dotnet_naming_symbols.constants.applicable_kinds = field +dotnet_naming_symbols.constants.required_modifiers = const +dotnet_naming_rule.constants_pascal_case.symbols = constants +dotnet_naming_rule.constants_pascal_case.style = pascal_case +dotnet_naming_rule.constants_pascal_case.severity = warning + +dotnet_naming_symbols.public_fields.applicable_kinds = field +dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal, protected, protected_internal +dotnet_naming_rule.public_fields_pascal_case.symbols = public_fields +dotnet_naming_rule.public_fields_pascal_case.style = pascal_case +dotnet_naming_rule.public_fields_pascal_case.severity = warning + +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private, private_protected +dotnet_naming_style.underscore_camel_case.required_prefix = _ +dotnet_naming_style.underscore_camel_case.capitalization = camel_case +dotnet_naming_rule.private_fields_underscore.symbols = private_fields +dotnet_naming_rule.private_fields_underscore.style = underscore_camel_case +dotnet_naming_rule.private_fields_underscore.severity = warning + +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local, local_function +dotnet_naming_style.camel_case.capitalization = camel_case +dotnet_naming_rule.locals_camel_case.symbols = locals_and_parameters +dotnet_naming_rule.locals_camel_case.style = camel_case +dotnet_naming_rule.locals_camel_case.severity = warning + +[src/test/SegCtlr.Tests/**.cs] +# xUnit test names read as sentences: Method_does_thing_when_condition. +dotnet_naming_rule.types_and_members_pascal_case.severity = none +# Test classes are public, but their members don't need XML docs. +dotnet_diagnostic.CS1591.severity = none diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8008f2e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,258 @@ +name: Publish Package + +# Builds, packs and publishes Plugin.SegmentedControl.Netstandard. See docs/releasing.md. +# +# Runs when GitVersion.yml changes on a releases/** branch, or by hand. There is deliberately no pull_request +# trigger: the renderer jobs run on self-hosted runners, which must never run code from a pull request. +on: + push: + branches: + - "releases/**" + paths: + - "GitVersion.yml" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: publish-${{ github.ref }} + cancel-in-progress: false + +jobs: + version: + runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.gitversion.outputs.MajorMinorPatch }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.11.0 + with: + versionSpec: "5.x" + + - name: Determine version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.11.0 + with: + useConfigFile: true + + # The release text is the README's "New in Version " section for this version. It is checked before + # anything is built, so a release without that section stops here instead of after the package reaches NuGet. + - name: Release notes from README + env: + VERSION: ${{ steps.gitversion.outputs.MajorMinorPatch }} + run: | + awk -v heading="## New in Version ${VERSION}" ' + $0 == heading { found = 1; next } + found && /^## / { exit } + found { print } + ' README.md > release-notes.md + if ! grep -q '[^[:space:]]' release-notes.md; then + echo "::error file=README.md::README.md has no '## New in Version ${VERSION}' section. Add it before releasing." + exit 1 + fi + cat release-notes.md + + - uses: actions/upload-artifact@v4 + with: + name: release-notes + path: release-notes.md + if-no-files-found: error + + library: + needs: version + runs-on: ubuntu-24.04 + env: + VERSION: ${{ needs.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - name: Build + run: >- + dotnet build src/main/SegCtlr.Netstandard/SegCtlr.Netstandard.csproj -c Release + -p:Version="$VERSION" -p:ContinuousIntegrationBuild=true + + - name: Test + run: dotnet test src/test/SegCtlr.Tests/SegCtlr.Tests.csproj -c Release -p:Version="$VERSION" + + - uses: actions/upload-artifact@v4 + with: + name: library + path: src/main/SegCtlr.Netstandard/bin/Release/ + if-no-files-found: error + + # Xamarin.Android and UWP. Needs a self-hosted Windows runner labelled "xamarin" with Visual Studio 2022 + # (Xamarin and UWP workloads) and the .NET 10 SDK. See docs/releasing.md. + renderers-windows: + needs: version + runs-on: [self-hosted, Windows, xamarin] + env: + VERSION: ${{ needs.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Build Android renderer + run: msbuild src/crossplatform/SegCtrl.Droid/SegCtrl.Droid.csproj /restore /p:Configuration=Release /p:Version=${{ env.VERSION }} + + - name: Build UWP renderer + run: msbuild src/crossplatform/SegCtrl.UWP/SegCtrl.UWP.csproj /restore /p:Configuration=Release /p:Platform=AnyCPU /p:Version=${{ env.VERSION }} + + - uses: actions/upload-artifact@v4 + with: + name: renderers-windows + path: | + src/crossplatform/SegCtrl.Droid/bin/Release/ + src/crossplatform/SegCtrl.UWP/bin/Release/ + if-no-files-found: error + + # Xamarin.iOS and Xamarin.Mac. Needs a self-hosted macOS runner labelled "xamarin" with Mono MSBuild, the + # Xamarin.iOS and Xamarin.Mac SDKs, Xcode and the .NET 10 SDK. See docs/releasing.md. + renderers-macos: + needs: version + runs-on: [self-hosted, macOS, xamarin] + env: + VERSION: ${{ needs.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - name: Build iOS renderer + run: msbuild src/crossplatform/SegCtrl.iOS/SegCtrl.iOS.csproj /restore /p:Configuration=Release /p:Version="$VERSION" + + - name: Build macOS renderer + run: msbuild src/crossplatform/SegCtrl.macOS/SegCtrl.macOS.csproj /restore /p:Configuration=Release /p:Version="$VERSION" + + - uses: actions/upload-artifact@v4 + with: + name: renderers-macos + path: | + src/crossplatform/SegCtrl.iOS/bin/Release/ + src/crossplatform/SegCtrl.macOS/bin/Release/ + if-no-files-found: error + + pack: + needs: [version, library, renderers-windows, renderers-macos] + runs-on: ubuntu-24.04 + env: + VERSION: ${{ needs.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + # Put every binary back where the nuspec expects it. + - uses: actions/download-artifact@v4 + with: + name: library + path: src/main/SegCtlr.Netstandard/bin/Release + + - uses: actions/download-artifact@v4 + with: + name: renderers-windows + path: src/crossplatform + + - uses: actions/download-artifact@v4 + with: + name: renderers-macos + path: src/crossplatform + + # Fails (NU5128) if any platform folder ends up without binaries. + - name: Pack + run: >- + dotnet pack src/build/Plugin.SegmentedControl.Package.csproj -c Release + -p:Version="$VERSION" -p:SourceRevisionId="${{ github.sha }}" -o artifacts + + - uses: actions/upload-artifact@v4 + with: + name: packages + path: artifacts/*.nupkg + if-no-files-found: error + + publish: + needs: [version, pack] + runs-on: ubuntu-24.04 + permissions: + contents: write # create the GitHub release + packages: write # push to GitHub Packages + id-token: write # OIDC token for NuGet.org Trusted Publishing + env: + VERSION: ${{ needs.version.outputs.version }} + steps: + - uses: actions/download-artifact@v4 + with: + name: packages + path: artifacts + + - uses: actions/download-artifact@v4 + with: + name: release-notes + path: . + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Publish to GitHub Packages + run: >- + dotnet nuget push "artifacts/*.nupkg" + --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + --api-key "${{ secrets.GITHUB_TOKEN }}" --skip-duplicate + + # Trusted Publishing: exchanges this run's GitHub OIDC token for a short-lived NuGet.org API key. Requires a + # Trusted Publishing policy on NuGet.org (owner profile -> Trusted Publishing) for this repository and the + # workflow file name build.yml. There is no long-lived NUGET_TOKEN secret. The user is the NuGet.org profile + # that owns the policy; NuGet.org usernames are public, so it is inline rather than a secret. + - name: NuGet login (Trusted Publishing) + id: nuget-login + uses: NuGet/login@v1 + with: + user: 1iveowl + + - name: Publish to NuGet.org + run: >- + dotnet nuget push "artifacts/*.nupkg" + --source https://api.nuget.org/v3/index.json + --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" --skip-duplicate + + # A draft, so the release can be checked before it is published; publishing it creates the v tag. + - name: Create draft GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: | + tag="v${VERSION}" + if gh release view "$tag" --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then + gh release upload "$tag" artifacts/*.nupkg --repo "$GITHUB_REPOSITORY" --clobber + else + gh release create "$tag" artifacts/*.nupkg --repo "$GITHUB_REPOSITORY" \ + --target "$GITHUB_SHA" --title "$tag" --notes-file release-notes.md --draft + fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..05f525e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +# Builds and tests the shared library on GitHub-hosted runners. The Xamarin platform renderers are only built by the +# publish workflow (build.yml), on self-hosted runners; they never run for pull requests. +on: + push: + branches: + - master + pull_request: + branches: + - master + - "releases/**" + workflow_dispatch: + +permissions: + contents: read + +jobs: + build-and-test: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'Directory.Build.props') }} + restore-keys: | + ${{ runner.os }}-nuget- + + # Style rules (.editorconfig) are enforced during the build; the library and tests treat warnings as errors. + - name: Build library + run: dotnet build src/main/SegCtlr.Netstandard/SegCtlr.Netstandard.csproj -c Release + + - name: Build shared sample + run: dotnet build src/test/Test.SegCtrl.netstandard/Test.SegCtrl.netstandard.csproj -c Release + + - name: Test + run: >- + dotnet test src/test/SegCtlr.Tests/SegCtlr.Tests.csproj -c Release + --collect "XPlat Code Coverage" --results-directory artifacts/test-results + + - name: Upload test results and coverage + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: artifacts/test-results/ + if-no-files-found: ignore diff --git a/AGENTS.md b/AGENTS.md index 4a1b08c..bfe54c2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -53,10 +53,20 @@ interrupted turn or check. Verify task state before continuing. ## Project-specific guidance -- Library: `src/main/SegCtlr.Netstandard` (`netstandard2.0`, Xamarin.Forms 5). Build it with +- Library: `src/main/SegCtlr.Netstandard` (`netstandard2.0` and `net10.0`, Xamarin.Forms 5). Build it with `dotnet build src/main/SegCtlr.Netstandard/SegCtlr.Netstandard.csproj`. - `src/test/Test.SegCtrl.netstandard` is the shared sample app; it builds on Linux too. +- Unit tests: `dotnet test src/test/SegCtlr.Tests/SegCtlr.Tests.csproj` (xUnit, `net10.0`). They cover the + shared control only and run without `Forms.Init()`, so the control must not touch `Device` during + construction. Add a test with every behaviour change in `src/main`. +- Code style lives in `.editorconfig` and is enforced at build time for SDK-style projects through + `Directory.Build.props` (C# 14, `EnforceCodeStyleInBuild`). The library and tests treat warnings as errors. + Fix violations with `dotnet format style --severity warn` and `dotnet format whitespace `. + The legacy platform projects do not get C# 14; keep renderer code to the language version they compile with. +- Public API in the library needs XML docs (`GenerateDocumentationFile` makes missing ones a build error). - The platform projects under `src/crossplatform` and the platform test apps under `src/test` are legacy Xamarin.iOS, Xamarin.Android, Xamarin.Mac and UWP projects. They do not build in - the dev container; do not try to restore or build `src/main/SegCtlr.Netstandard.sln` there. -- Packaging scripts and the nuspec live in `src/build`. + the dev container; do not try to restore or build `src/main/SegCtlr.Netstandard.slnx` there. +- Packaging: the nuspec and its pack project live in `src/build`; releases are built and published by + `.github/workflows/build.yml` (GitVersion, `releases/**` branches, self-hosted Xamarin runners). See + [docs/releasing.md](docs/releasing.md). Do not reintroduce local publish scripts. diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..9c52b4d --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,16 @@ + + + + + 14 + latest + true + + true + + + diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..f1f79eb --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,7 @@ +# The version of the next release. Changing this file on a releases/** branch starts .github/workflows/build.yml, +# which builds, packs and publishes that version. README.md must contain a "## New in Version " section for it. +next-version: 5.6.0 +branches: {} +ignore: + sha: [] +merge-message-formats: {} diff --git a/README.md b/README.md index 3aa5cb9..e19b014 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,33 @@ [![NuGet](https://img.shields.io/nuget/v/Plugin.SegmentedControl.Netstandard?logo=nuget&label=Plugin.SegmentedControl.Netstandard)](https://www.nuget.org/packages/Plugin.SegmentedControl.Netstandard) [![Downloads](https://img.shields.io/nuget/dt/Plugin.SegmentedControl.Netstandard?logo=nuget&color=blue)](https://www.nuget.org/packages/Plugin.SegmentedControl.Netstandard) -[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENCE) +[![CI](https://github.com/1iveowl/Plugin.SegmentedControl/actions/workflows/ci.yml/badge.svg)](https://github.com/1iveowl/Plugin.SegmentedControl/actions/workflows/ci.yml) +[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) -[![.NET Standard](https://img.shields.io/badge/.NET%20Standard-2.0-5C2D91?logo=dotnet&logoColor=white)](https://learn.microsoft.com/dotnet/standard/net-standard) +[![.NET](https://img.shields.io/badge/.NET-10%20%7C%20Standard%202.0-512BD4?logo=dotnet&logoColor=white)](https://dotnet.microsoft.com/) +[![Xamarin.Forms](https://img.shields.io/badge/Xamarin.Forms-5.0-3498DB?logo=xamarin&logoColor=white)](https://learn.microsoft.com/xamarin/xamarin-forms/) > **Warning** > This library is no longer maintained. There are no plans to migrate it to .NET MAUI or extend it with new features. It remains available for existing Xamarin.Forms applications. -A legacy Xamarin.Forms segmented-control plugin for iOS, Android, UWP, and macOS. The shared library targets .NET Standard 2.0. +A legacy Xamarin.Forms segmented-control plugin for iOS, Android, UWP, and macOS. The shared library targets .NET Standard 2.0 and .NET 10. *Please star this project if you find it useful. Thank you!* +## New in Version 5.6.0 + +- Adds a .NET 10 (`net10.0`) build next to .NET Standard 2.0, and updates Xamarin.Forms to 5.0.0.2662. +- **Behaviour change:** `OnSegmentSelected` and `SegmentSelectedCommand` are raised by the control once for every + `SelectedSegment` change, and no longer when the page loads. `RaiseSelectionChanged` is obsolete. +- `SelectedItem` selects the matching segment for string `ItemsSource` and for options with `Item` set; items are + compared with `Equals`. +- Replacing `Children` no longer clears or refills the list assigned before. +- The control can be created before `Forms.Init()`. +- Android: several controls no longer share one set of colors. +- UWP: `WidthRequest` is applied per segment; fixed a crash when an old segment's text changed. +- macOS: the renderer assembly is now included in the package. +- All platforms: event handlers are removed from the old element when a renderer is reused. + ## Release notes ### Version 5.2+ diff --git a/docs/releasing.md b/docs/releasing.md new file mode 100644 index 0000000..6e3778a --- /dev/null +++ b/docs/releasing.md @@ -0,0 +1,45 @@ +# Releasing + +Releases follow the same model as WebsocketClientLite.PCL: GitVersion sets the version, a change to +`GitVersion.yml` on a `releases/**` branch starts the publish workflow, and the release notes come from the README. + +## Steps + +1. On a branch `releases/`, set `next-version: ` in `GitVersion.yml`. +2. Add a `## New in Version ` section to `README.md`. The workflow stops before building anything if it is + missing. Update `` in `src/build/Plugin.SegmentedControl.Netstandard.nuspec` as well. +3. Push the branch. `.github/workflows/build.yml` ("Publish Package") then: + - works out the version with GitVersion and extracts the README section; + - builds and tests the shared library on a GitHub-hosted Ubuntu runner; + - builds the Android and UWP renderers on the self-hosted Windows runner, and the iOS and macOS renderers on + the self-hosted macOS runner; + - packs `Plugin.SegmentedControl.Netstandard` from the nuspec. A missing platform fails the pack (NU5128); + - pushes the package to GitHub Packages and to NuGet.org, then creates a **draft** GitHub release `v` + with the package attached. +4. Check the draft release and publish it. Publishing creates the `v` tag. + +The workflow can also be started by hand (Actions → Publish Package → Run workflow) on a release branch. + +## One-time setup + +### NuGet.org Trusted Publishing + +The workflow has no API-key secret. On NuGet.org, signed in as the package owner (`1iveowl`), open +**Trusted Publishing** and add a GitHub Actions policy for repository `1iveowl/Plugin.SegmentedControl` and workflow +file `build.yml`. Without it the NuGet.org push fails. + +### Self-hosted runners + +GitHub-hosted runners no longer include the Xamarin SDKs, so the renderers are built on two self-hosted runners +registered to this repository (Settings → Actions → Runners): + +| Runner | Labels | Needs | +|---|---|---| +| Windows | `self-hosted`, `Windows`, `xamarin` | Visual Studio 2022 with the *Mobile development with .NET* (Xamarin) and *Universal Windows Platform* workloads, Windows SDK 10.0.19041, the .NET 10 SDK, Git | +| macOS | `self-hosted`, `macOS`, `xamarin` | Mono with MSBuild, the Xamarin.iOS and Xamarin.Mac SDKs, a matching Xcode, the .NET 10 SDK, Git | + +The renderer projects reference the shared library, so each runner also compiles it. That needs the .NET 10 SDK +and its C# 14 compiler. Check this first on a new runner; it is the part most likely to fail with older MSBuild. + +The publish workflow has no `pull_request` trigger, and CI (`ci.yml`) only uses GitHub-hosted runners. Keep it that +way: a self-hosted runner on a public repository must never run code from a pull request. diff --git a/global.json b/global.json new file mode 100644 index 0000000..512142d --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "10.0.100", + "rollForward": "latestFeature" + } +} diff --git a/src/build/Plugin.SegmentedControl.Netstandard.nuspec b/src/build/Plugin.SegmentedControl.Netstandard.nuspec index afe44ba..23cada0 100644 --- a/src/build/Plugin.SegmentedControl.Netstandard.nuspec +++ b/src/build/Plugin.SegmentedControl.Netstandard.nuspec @@ -2,7 +2,7 @@ Plugin.SegmentedControl.Netstandard - 0 + $version$ Segmented Control for Xamarin Forms (.Net Standard) 1iveowl Development Jasper H. Bojsen @@ -13,6 +13,16 @@ Segmented control for Xamarin Forms for iOS, Android, UWP. Mac OS also supported albeit currently with fewer features. +[All] Added a .NET 10 (net10.0) target alongside .NET Standard 2.0 +[All] Updated Xamarin.Forms to 5.0.0.2662 +[macOS] The macOS renderer assembly (SegCtrl.macOS) is now included in the package; earlier packages left it out. +[All] Behaviour change: OnSegmentSelected and SegmentSelectedCommand are raised by SegmentedControl on every SelectedSegment change, once, and no longer on page load. RaiseSelectionChanged is obsolete. +[All] SelectedItem now selects the matching segment for string ItemsSource and for options with Item set; items are compared with Equals. +[All] Replacing Children no longer clears or refills the list assigned before. +[All] The control can be created before Forms.Init() (FontSize default is computed lazily). +[Android] Fixed several controls sharing one set of colors. +[UWP] Segment WidthRequest is used per segment instead of the control's WidthRequest; fixed a crash when an old segment's text changed. +[iOS, Android, macOS, UWP] Event handlers are removed from the old element when the renderer's element changes. [All] Min Width bug fixes [All] New TextPropertyName object for ItemSource [All] ItemSource is not IEnumerable (was IList) @@ -36,7 +46,8 @@ Segmented control for Xamarin Forms for iOS, Android, UWP. Mac OS also supported [All] Fixes and improvements. [iOS] IsEnabled binding bug fixed. - Copyright 2022 + Copyright 1iveowl Development 2026 + xamarin xamarin.forms segmentedControl netstandard iOS UWP Android macOS @@ -63,25 +74,28 @@ Segmented control for Xamarin Forms for iOS, Android, UWP. Mac OS also supported - + - + - + - + - + + + + @@ -90,8 +104,11 @@ Segmented control for Xamarin Forms for iOS, Android, UWP. Mac OS also supported - + + + + @@ -101,6 +118,7 @@ Segmented control for Xamarin Forms for iOS, Android, UWP. Mac OS also supported + diff --git a/src/build/Plugin.SegmentedControl.Package.csproj b/src/build/Plugin.SegmentedControl.Package.csproj new file mode 100644 index 0000000..beb3ed3 --- /dev/null +++ b/src/build/Plugin.SegmentedControl.Package.csproj @@ -0,0 +1,25 @@ + + + + + netstandard2.0 + true + false + false + Plugin.SegmentedControl.Netstandard.nuspec + $(MSBuildThisFileDirectory) + version=$(Version);commit=$(SourceRevisionId) + + false + + $(WarningsAsErrors);NU5128 + + + diff --git a/src/build/build.ps1 b/src/build/build.ps1 deleted file mode 100644 index 4212e01..0000000 --- a/src/build/build.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -param([string]$version) - -if ([string]::IsNullOrEmpty($version)) {$version = "0.0.1"} - -if ($IsMacOS) { - $msbuild = "msbuild" -} else { - $vswhere = 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' - $msbuild = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath - $msbuild = join-path $msbuild 'MSBuild\Current\Bin\MSBuild.exe' -} - -&$msbuild ..\main\SegCtlr.Netstandard\SegCtlr.Netstandard.csproj /t:Build /p:Configuration="Release" -&$msbuild ..\crossplatform\SegCtrl.Droid\SegCtrl.Droid.csproj /t:Build /p:Configuration="Release" -&$msbuild ..\crossplatform\SegCtrl.UWP\SegCtrl.UWP.csproj /t:Build /p:Configuration="Release" -&$msbuild ..\crossplatform\SegCtrl.iOS\SegCtrl.iOS.csproj /t:Build /p:Configuration="Release" -&$msbuild ..\crossplatform\SegCtrl.macOS\SegCtrl.macOS.csproj /t:Build /p:Configuration="Release" - -Remove-Item .\NuGet -Force -Recurse -New-Item -ItemType Directory -Force -Path .\NuGet -NuGet.exe pack Plugin.SegmentedControl.Netstandard.nuspec -Verbosity detailed -Symbols -OutputDir "NuGet" -Version $version -#NuGet.exe pack Plugin.SegmentedControl.Netstandard.nuspec -Verbosity detailed -Symbols -SymbolPackageFormat snupkg -OutputDir "NuGet" -Version $version \ No newline at end of file diff --git a/src/build/publish.ps1 b/src/build/publish.ps1 deleted file mode 100644 index bb042e4..0000000 --- a/src/build/publish.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -param([string]$betaver) - -if ([string]::IsNullOrEmpty($betaver)) { - $version = [Reflection.AssemblyName]::GetAssemblyName((resolve-path '..\main\SegCtlr.Netstandard\bin\Release\netstandard2.0\Plugin.Segmented.dll')).Version.ToString(3) - } -else { - $version = [Reflection.AssemblyName]::GetAssemblyName((resolve-path '..\main\SegCtlr.Netstandard\bin\Release\netstandard2.0\Plugin.Segmented.dll')).Version.ToString(3) + "-" + $betaver -} - -.\build.ps1 $version - -Nuget.exe push ".\NuGet\Plugin.SegmentedControl.Netstandard.$version.symbols.nupkg" -Source https://api.nuget.org/v3/index.json \ No newline at end of file diff --git a/src/build/publishLocal.ps1 b/src/build/publishLocal.ps1 deleted file mode 100644 index 9c9ab1c..0000000 --- a/src/build/publishLocal.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -param([string]$betaver) - -if ([string]::IsNullOrEmpty($betaver)) { - $version = [Reflection.AssemblyName]::GetAssemblyName((resolve-path '..\main\SegCtlr.Netstandard\bin\Release\netstandard2.0\Plugin.Segmented.dll')).Version.ToString(3) - } -else { - $version = [Reflection.AssemblyName]::GetAssemblyName((resolve-path '..\main\SegCtlr.Netstandard\bin\Release\netstandard2.0\Plugin.Segmented.dll')).Version.ToString(3) + "-" + $betaver -} - -.\build.ps1 $version - -nuget.exe push -Source "1iveowlNuGetRepo" -ApiKey key ".\NuGet\Plugin.SegmentedControl.Netstandard.$version.symbols.snupkg" diff --git a/src/crossplatform/SegCtrl.Droid/SegCtrl.Droid.csproj b/src/crossplatform/SegCtrl.Droid/SegCtrl.Droid.csproj index cec4b8f..f042de5 100644 --- a/src/crossplatform/SegCtrl.Droid/SegCtrl.Droid.csproj +++ b/src/crossplatform/SegCtrl.Droid/SegCtrl.Droid.csproj @@ -170,7 +170,7 @@ 1.1.0.10 - 5.0.0.2291 + 5.0.0.2662 diff --git a/src/crossplatform/SegCtrl.Droid/SegmentedControlRenderer.cs b/src/crossplatform/SegCtrl.Droid/SegmentedControlRenderer.cs index 6919da4..05789df 100644 --- a/src/crossplatform/SegCtrl.Droid/SegmentedControlRenderer.cs +++ b/src/crossplatform/SegCtrl.Droid/SegmentedControlRenderer.cs @@ -7,6 +7,7 @@ using Android.Widget; using Plugin.Segmented.Control; using Plugin.Segmented.Control.Droid; +using Plugin.Segmented.Event; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using RadioButton = Android.Widget.RadioButton; @@ -48,7 +49,8 @@ protected override void OnElementChanged(ElementChangedEventArgs6.2.13 - 5.0.0.2291 + 5.0.0.2662 diff --git a/src/crossplatform/SegCtrl.UWP/SegmentRadioButton.cs b/src/crossplatform/SegCtrl.UWP/SegmentRadioButton.cs index e2664c0..df08ba2 100644 --- a/src/crossplatform/SegCtrl.UWP/SegmentRadioButton.cs +++ b/src/crossplatform/SegCtrl.UWP/SegmentRadioButton.cs @@ -60,6 +60,7 @@ private void SegmentRadioButton_IsEnabledChanged(object sender, DependencyProper { if (sender is SegmentRadioButton segment) { + UpdateBorderBrush(segment); Refresh(segment); } } @@ -68,26 +69,35 @@ private static void OnTintChanged(DependencyObject d, DependencyPropertyChangedE { if (d is SegmentRadioButton segment) { - segment.BorderBrush = (SolidColorBrush) e.NewValue; + UpdateBorderBrush(segment); Refresh(segment); } } - private static void OnDisabledColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is SegmentRadioButton segment) { - segment.BorderBrush = (SolidColorBrush)e.NewValue; + UpdateBorderBrush(segment); Refresh(segment); } } + // The divider uses the tint color, and the disabled color only while the segment is disabled. Setting + // DisabledColor used to paint the border of enabled segments too. + private static void UpdateBorderBrush(SegmentRadioButton segment) + { + var brush = segment.IsEnabled ? segment.TintColor : segment.DisabledColor; + if (brush != null) + { + segment.BorderBrush = brush; + } + } + private static void OnSelectedTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is SegmentRadioButton segment) { - segment.SelectedTextColor = (SolidColorBrush)e.NewValue; Refresh(segment); } } @@ -97,7 +107,6 @@ private static void OnTextColorChanged(DependencyObject d, DependencyPropertyCha if (d is SegmentRadioButton segment) { - segment.TextColor = (SolidColorBrush)e.NewValue; Refresh(segment); } } diff --git a/src/crossplatform/SegCtrl.UWP/SegmentedControlRenderer.cs b/src/crossplatform/SegCtrl.UWP/SegmentedControlRenderer.cs index 9ec31c9..70785ca 100644 --- a/src/crossplatform/SegCtrl.UWP/SegmentedControlRenderer.cs +++ b/src/crossplatform/SegCtrl.UWP/SegmentedControlRenderer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Windows.UI.Xaml; @@ -18,6 +19,10 @@ public class SegmentedControlRenderer : ViewRenderer _subscribedOptions = new List(); + public SegmentedControlRenderer() {} protected override void OnElementChanged(ElementChangedEventArgs e) @@ -39,12 +44,6 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE { base.OnElementPropertyChanged(sender, e); - if (e.PropertyName == "Renderer") - { - Element?.RaiseSelectionChanged(); - return; - } - if (_segmentedUserControl is null || Element is null) return; switch (e.PropertyName) @@ -251,8 +250,8 @@ private void CreateSegmentedRadioButtonControl() Width = new GridLength(1, GridUnitType.Star), }; - if (Element.WidthRequest > 0) - columnDefinition.Width = new GridLength(Element.WidthRequest); + if (child.WidthRequest > 0) + columnDefinition.Width = new GridLength(child.WidthRequest); grid.ColumnDefinitions.Add(columnDefinition); @@ -261,6 +260,7 @@ private void CreateSegmentedRadioButtonControl() grid.Children.Add(segmentButton); child.PropertyChanged += Segment_PropertyChanged; + _subscribedOptions.Add(child); } SetNativeControl(_segmentedUserControl); @@ -271,6 +271,11 @@ private void Segment_PropertyChanged(object sender, PropertyChangedEventArgs e) if (!(_segmentedUserControl is null) && !(Element is null) && sender is SegmentedControlOption option) { var index = Element.Children.IndexOf(option); + if (index < 0 || index >= _segmentedUserControl.SegmentedControlGrid.Children.Count) + { + return; + } + switch (e.PropertyName) { case nameof(SegmentedControlOption.Text): @@ -285,12 +290,10 @@ private void Segment_PropertyChanged(object sender, PropertyChangedEventArgs e) private void SegmentRadioButtonOnChecked(object sender, RoutedEventArgs e) { - var button = (SegmentRadioButton) sender; - - if (!(button is null)) + // SegmentedControl raises OnSegmentSelected and the command itself when SelectedSegment changes. + if (sender is SegmentRadioButton button && !(Element is null)) { - Element.SelectedSegment = int.Parse(button.Tag.ToString()); - Element?.RaiseSelectionChanged(); + Element.SelectedSegment = (int)button.Tag; } } @@ -314,13 +317,12 @@ private void DisposeEventHandlers() } } - if (!(Element is null)) + foreach (var option in _subscribedOptions) { - foreach (var child in Element.Children) - { - child.PropertyChanged -= Segment_PropertyChanged; - } + option.PropertyChanged -= Segment_PropertyChanged; } + + _subscribedOptions.Clear(); } } diff --git a/src/crossplatform/SegCtrl.iOS/SegCtrl.iOS.csproj b/src/crossplatform/SegCtrl.iOS/SegCtrl.iOS.csproj index 589cc93..06c3af9 100644 --- a/src/crossplatform/SegCtrl.iOS/SegCtrl.iOS.csproj +++ b/src/crossplatform/SegCtrl.iOS/SegCtrl.iOS.csproj @@ -67,7 +67,7 @@ - 5.0.0.2291 + 5.0.0.2662 diff --git a/src/crossplatform/SegCtrl.iOS/SegmentedControlRenderer.cs b/src/crossplatform/SegCtrl.iOS/SegmentedControlRenderer.cs index 5136a80..8dab010 100644 --- a/src/crossplatform/SegCtrl.iOS/SegmentedControlRenderer.cs +++ b/src/crossplatform/SegCtrl.iOS/SegmentedControlRenderer.cs @@ -4,6 +4,7 @@ using System.Linq; using Plugin.Segmented.Control; using Plugin.Segmented.Control.iOS; +using Plugin.Segmented.Event; using UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; @@ -29,11 +30,14 @@ protected override void OnElementChanged(ElementChangedEventArgs2.0.3 - 5.0.0.2291 + 5.0.0.2662 diff --git a/src/crossplatform/SegCtrl.macOS/SegmentedControlRenderer.cs b/src/crossplatform/SegCtrl.macOS/SegmentedControlRenderer.cs index 4960458..35fc1f8 100644 --- a/src/crossplatform/SegCtrl.macOS/SegmentedControlRenderer.cs +++ b/src/crossplatform/SegCtrl.macOS/SegmentedControlRenderer.cs @@ -6,6 +6,7 @@ using Plugin.Segmented.Control; using System.ComponentModel; using Plugin.Segmented; +using Plugin.Segmented.Event; [assembly: ExportRenderer(typeof(SegmentedControl), typeof(SegCtrl.macOS.SegmentedControlRenderer))] namespace SegCtrl.macOS @@ -26,7 +27,8 @@ protected override void OnElementChanged(ElementChangedEventArgs s.Text); _nativeControl = NSSegmentedControl.FromLabels(titles.ToArray(), NSSegmentSwitchTracking.SelectOne, OnNativeSegmentChanged); _nativeControl.Enabled = Element.IsEnabled; - _nativeControl.SetSelected(true, Element.SelectedSegment); + + if (Element.SelectedSegment >= 0 && Element.SelectedSegment < _nativeControl.SegmentCount) + { + _nativeControl.SetSelected(true, Element.SelectedSegment); + } _nativeControl.FocusRingType = NSFocusRingType.None; foreach (var (segmentedCtrlOption, i) in Element.Children.Select((segmentCtrlOption, i) => (segmentCtrlOption, i))) { - if(segmentedCtrlOption.WidthRequest >= 0) + if (segmentedCtrlOption.WidthRequest > 0) _nativeControl.SetWidth((nfloat)segmentedCtrlOption.WidthRequest, i); } @@ -52,7 +58,7 @@ private void CreateNativeSegmentedControl() private void OnNativeSegmentChanged() { - if (!(_nativeControl is null)) + if (!(_nativeControl is null) && !(Element is null)) { Element.SelectedSegment = (int)_nativeControl.SelectedSegment; } @@ -60,15 +66,13 @@ private void OnNativeSegmentChanged() private void ResetNativeControl() { + // Rebuild whenever the segments change, including from an empty control. if (!(_nativeControl is null) && !(Element is null)) { - if (_nativeControl.SegmentCount > 0) - { - _nativeControl.RemoveFromSuperview(); - _nativeControl.Dispose(); - _nativeControl = null; - CreateNativeSegmentedControl(); - } + _nativeControl.RemoveFromSuperview(); + _nativeControl.Dispose(); + _nativeControl = null; + CreateNativeSegmentedControl(); } } @@ -90,18 +94,18 @@ private void AddElementHandlers(SegmentedControl element, bool addChildHandlersO } } - private void RemoveElementHandlers(bool removeChildrenHandlersOnly = false) + private void RemoveElementHandlers(SegmentedControl element, bool removeChildrenHandlersOnly = false) { - if (!(Element is null)) + if (!(element is null)) { if (!removeChildrenHandlersOnly) { - Element.OnElementChildrenChanging -= OnElementChildrenChanging; + element.OnElementChildrenChanging -= OnElementChildrenChanging; } - if (!(Element.Children is null)) + if (!(element.Children is null)) { - foreach (var child in Element.Children) + foreach (var child in element.Children) { child.PropertyChanged -= SegmentPropertyChanged; } @@ -109,9 +113,19 @@ private void RemoveElementHandlers(bool removeChildrenHandlersOnly = false) } } - private void OnElementChildrenChanging(object sender, EventArgs e) + private void OnElementChildrenChanging(object sender, ElementChildrenChanging e) { - RemoveElementHandlers(true); + // Raised before Children is replaced or after an observable Children list was edited, so detach from + // the segments the event reports as old, not from Element.Children. + if (e?.OldValues is null) + { + return; + } + + foreach (var child in e.OldValues) + { + child.PropertyChanged -= SegmentPropertyChanged; + } } private void SegmentPropertyChanged(object sender, PropertyChangedEventArgs e) @@ -119,6 +133,10 @@ private void SegmentPropertyChanged(object sender, PropertyChangedEventArgs e) if (!(_nativeControl is null) && !(Element is null) && sender is SegmentedControlOption option) { var index = Element.Children.IndexOf(option); + if (index < 0) + { + return; + } switch (e.PropertyName) { @@ -137,12 +155,6 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE { base.OnElementPropertyChanged(sender, e); - if (e.PropertyName == "Renderer") - { - Element?.RaiseSelectionChanged(); - return; - } - if (_nativeControl is null || Element is null) { return; @@ -150,17 +162,19 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE switch (e.PropertyName) { - case nameof(NSSegmentedControl.SelectedSegment): + case nameof(SegmentedControl.SelectedSegment): + // SegmentedControl raises OnSegmentSelected and the command itself. _nativeControl.SelectedSegment = Element.SelectedSegment; - Element.RaiseSelectionChanged(); break; - case nameof(NSSegmentedControl.IsEnabled): + case nameof(SegmentedControl.IsEnabled): _nativeControl.Enabled = Element.IsEnabled; break; case nameof(SegmentedControl.Children): ResetNativeControl(); + // The old segments were detached in OnElementChildrenChanging; attach to the new ones. + AddElementHandlers(Element, true); break; case nameof(SegmentedControl.FontSize): @@ -180,7 +194,7 @@ private void SetFont() protected override void Dispose(bool disposing) { - RemoveElementHandlers(); + RemoveElementHandlers(Element); base.Dispose(disposing); _nativeControl = null; diff --git a/src/main/SegCtlr.Netstandard.sln b/src/main/SegCtlr.Netstandard.sln deleted file mode 100644 index edb0c26..0000000 --- a/src/main/SegCtlr.Netstandard.sln +++ /dev/null @@ -1,726 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29806.167 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SegCtlr.Netstandard", "SegCtlr.Netstandard\SegCtlr.Netstandard.csproj", "{ABA23BAB-084A-443E-B9CC-37B0A826377E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Abstraction", "Abstraction", "{D54B9249-B233-42AD-8346-2E59628B9B34}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CrossPlatform", "CrossPlatform", "{C5A73308-8FF9-4767-91CF-1B97B38B0403}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SegCtrl.Droid", "..\crossplatform\SegCtrl.Droid\SegCtrl.Droid.csproj", "{615565C8-84DE-4B6B-80DD-106695429AD8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SegCtrl.iOS", "..\crossplatform\SegCtrl.iOS\SegCtrl.iOS.csproj", "{39CD5D35-D98E-49A2-868B-89E7B64D25DE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SegCtrl.UWP", "..\crossplatform\SegCtrl.UWP\SegCtrl.UWP.csproj", "{2848D7D8-3C18-4DF0-8638-CBCCC36A325B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{F6468D98-0EC8-412A-865C-6AC3F010C044}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.SegCtrl.Android", "..\test\Test.SegCtrl.Android\Test.SegCtrl.Android.csproj", "{D41A679F-F6FD-45B5-B63C-304C720090CC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.SegCtlr.UWP", "..\test\Test.SegCtrl.UWP\Test.SegCtlr.UWP.csproj", "{D133A400-6A9B-4414-A989-6165FF3A3BAC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.SegCtlr.iOS", "..\test\Test.SegCtrl.iOS\Test.SegCtlr.iOS.csproj", "{2C3B781D-170C-44FA-BB73-E454A4AE73BD}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.SegCtrl.netstandard", "..\test\Test.SegCtrl.netstandard\Test.SegCtrl.netstandard.csproj", "{085D550D-9E27-474F-A79E-4578224F8664}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{33251B03-DF66-4CA2-B24F-BD267184F4C4}" - ProjectSection(SolutionItems) = preProject - ..\build\build.ps1 = ..\build\build.ps1 - ..\build\Plugin.SegmentedControl.Netstandard.nuspec = ..\build\Plugin.SegmentedControl.Netstandard.nuspec - ..\build\publish.ps1 = ..\build\publish.ps1 - ..\build\publishLocal.ps1 = ..\build\publishLocal.ps1 - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub", "GitHub", "{788B4700-4995-4AD9-A3C9-0E637AD760DC}" - ProjectSection(SolutionItems) = preProject - ..\..\.gitignore = ..\..\.gitignore - ..\..\README.md = ..\..\README.md - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{A61994BD-A497-4FA5-B00C-EAC91FDFD0C5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SegCtrl.macOS", "..\crossplatform\SegCtrl.macOS\SegCtrl.macOS.csproj", "{BF907E43-0F07-4502-9AF3-96B063281234}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.SegCtrl.macOS", "..\test\Test.SegCtrl.macOS\Test.SegCtrl.macOS.csproj", "{F496EC17-11A7-43DD-ABD2-0EACB53BF553}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Ad-Hoc|Any CPU = Ad-Hoc|Any CPU - Ad-Hoc|ARM = Ad-Hoc|ARM - Ad-Hoc|iPhone = Ad-Hoc|iPhone - Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator - Ad-Hoc|x64 = Ad-Hoc|x64 - Ad-Hoc|x86 = Ad-Hoc|x86 - AppStore|Any CPU = AppStore|Any CPU - AppStore|ARM = AppStore|ARM - AppStore|iPhone = AppStore|iPhone - AppStore|iPhoneSimulator = AppStore|iPhoneSimulator - AppStore|x64 = AppStore|x64 - AppStore|x86 = AppStore|x86 - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|iPhone = Debug|iPhone - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - DebugNAtive|Any CPU = DebugNAtive|Any CPU - DebugNAtive|ARM = DebugNAtive|ARM - DebugNAtive|iPhone = DebugNAtive|iPhone - DebugNAtive|iPhoneSimulator = DebugNAtive|iPhoneSimulator - DebugNAtive|x64 = DebugNAtive|x64 - DebugNAtive|x86 = DebugNAtive|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|iPhone = Release|iPhone - Release|iPhoneSimulator = Release|iPhoneSimulator - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|Any CPU.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|ARM.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|ARM.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|iPhone.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|x64.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|x64.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|x86.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.AppStore|x86.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|ARM.ActiveCfg = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|ARM.Build.0 = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|iPhone.Build.0 = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|x64.ActiveCfg = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|x64.Build.0 = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|x86.ActiveCfg = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Debug|x86.Build.0 = Debug|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|Any CPU.ActiveCfg = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|Any CPU.Build.0 = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|ARM.ActiveCfg = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|ARM.Build.0 = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|iPhone.ActiveCfg = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|iPhone.Build.0 = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|iPhoneSimulator.ActiveCfg = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|iPhoneSimulator.Build.0 = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|x64.ActiveCfg = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|x64.Build.0 = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|x86.ActiveCfg = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.DebugNAtive|x86.Build.0 = DebugNAtive|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|Any CPU.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|ARM.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|ARM.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|iPhone.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|iPhone.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|x64.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|x64.Build.0 = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|x86.ActiveCfg = Release|Any CPU - {ABA23BAB-084A-443E-B9CC-37B0A826377E}.Release|x86.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|Any CPU.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|ARM.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|ARM.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|iPhone.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|x64.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|x64.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|x86.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.AppStore|x86.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|ARM.ActiveCfg = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|ARM.Build.0 = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|iPhone.Build.0 = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|x64.ActiveCfg = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|x64.Build.0 = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|x86.ActiveCfg = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Debug|x86.Build.0 = Debug|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|Any CPU.ActiveCfg = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|Any CPU.Build.0 = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|ARM.ActiveCfg = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|ARM.Build.0 = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|iPhone.ActiveCfg = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|iPhone.Build.0 = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|iPhoneSimulator.ActiveCfg = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|iPhoneSimulator.Build.0 = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|x64.ActiveCfg = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|x64.Build.0 = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|x86.ActiveCfg = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.DebugNAtive|x86.Build.0 = DebugNAtive|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|Any CPU.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|ARM.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|ARM.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|iPhone.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|iPhone.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|x64.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|x64.Build.0 = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|x86.ActiveCfg = Release|Any CPU - {615565C8-84DE-4B6B-80DD-106695429AD8}.Release|x86.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|Any CPU.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|ARM.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|ARM.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|iPhone.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|x64.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|x64.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|x86.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.AppStore|x86.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|ARM.ActiveCfg = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|ARM.Build.0 = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|iPhone.Build.0 = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|x64.ActiveCfg = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|x64.Build.0 = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|x86.ActiveCfg = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Debug|x86.Build.0 = Debug|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|Any CPU.ActiveCfg = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|Any CPU.Build.0 = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|ARM.ActiveCfg = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|ARM.Build.0 = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|iPhone.ActiveCfg = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|iPhone.Build.0 = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|iPhoneSimulator.ActiveCfg = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|iPhoneSimulator.Build.0 = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|x64.ActiveCfg = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|x64.Build.0 = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|x86.ActiveCfg = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.DebugNAtive|x86.Build.0 = DebugNAtive|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|Any CPU.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|ARM.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|ARM.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|iPhone.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|iPhone.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|x64.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|x64.Build.0 = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|x86.ActiveCfg = Release|Any CPU - {39CD5D35-D98E-49A2-868B-89E7B64D25DE}.Release|x86.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|ARM.Build.0 = Release|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|x64.ActiveCfg = Release|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|x64.Build.0 = Release|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Ad-Hoc|x86.Build.0 = Release|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|Any CPU.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|ARM.ActiveCfg = Release|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|ARM.Build.0 = Release|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|iPhone.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|x64.ActiveCfg = Release|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|x64.Build.0 = Release|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|x86.ActiveCfg = Release|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.AppStore|x86.Build.0 = Release|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|ARM.ActiveCfg = Debug|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|ARM.Build.0 = Debug|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|iPhone.Build.0 = Debug|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|x64.ActiveCfg = Debug|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|x64.Build.0 = Debug|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|x86.ActiveCfg = Debug|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Debug|x86.Build.0 = Debug|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|Any CPU.ActiveCfg = DebugNAtive|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|Any CPU.Build.0 = DebugNAtive|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|ARM.ActiveCfg = DebugNAtive|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|ARM.Build.0 = DebugNAtive|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|iPhone.ActiveCfg = DebugNAtive|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|iPhone.Build.0 = DebugNAtive|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|iPhoneSimulator.ActiveCfg = DebugNAtive|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|iPhoneSimulator.Build.0 = DebugNAtive|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|x64.ActiveCfg = DebugNAtive|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|x64.Build.0 = DebugNAtive|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|x86.ActiveCfg = DebugNAtive|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.DebugNAtive|x86.Build.0 = DebugNAtive|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|Any CPU.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|ARM.ActiveCfg = Release|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|ARM.Build.0 = Release|ARM - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|iPhone.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|iPhone.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|x64.ActiveCfg = Release|x64 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|x86.ActiveCfg = Release|x86 - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B}.Release|x86.Build.0 = Release|x86 - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|ARM.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|x64.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Ad-Hoc|x86.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|Any CPU.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|Any CPU.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|ARM.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|ARM.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|ARM.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|iPhone.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|iPhone.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|x64.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|x64.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|x64.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|x86.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|x86.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.AppStore|x86.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|ARM.ActiveCfg = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|ARM.Build.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|ARM.Deploy.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|iPhone.Build.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|iPhone.Deploy.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|x64.ActiveCfg = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|x64.Build.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|x64.Deploy.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|x86.ActiveCfg = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|x86.Build.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Debug|x86.Deploy.0 = Debug|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|Any CPU.ActiveCfg = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|Any CPU.Build.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|Any CPU.Deploy.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|ARM.ActiveCfg = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|ARM.Build.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|ARM.Deploy.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|iPhone.ActiveCfg = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|iPhone.Build.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|iPhone.Deploy.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|iPhoneSimulator.ActiveCfg = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|iPhoneSimulator.Build.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|iPhoneSimulator.Deploy.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|x64.ActiveCfg = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|x64.Build.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|x64.Deploy.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|x86.ActiveCfg = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|x86.Build.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.DebugNAtive|x86.Deploy.0 = DebugNAtive|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|Any CPU.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|Any CPU.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|ARM.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|ARM.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|ARM.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|iPhone.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|iPhone.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|iPhone.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|x64.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|x64.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|x64.Deploy.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|x86.ActiveCfg = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|x86.Build.0 = Release|Any CPU - {D41A679F-F6FD-45B5-B63C-304C720090CC}.Release|x86.Deploy.0 = Release|Any CPU - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|Any CPU.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|Any CPU.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|Any CPU.Deploy.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|ARM.Build.0 = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|ARM.Deploy.0 = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|iPhone.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|iPhone.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|iPhone.Deploy.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|x64.ActiveCfg = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|x64.Build.0 = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|x64.Deploy.0 = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|x86.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Ad-Hoc|x86.Deploy.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|Any CPU.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|Any CPU.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|Any CPU.Deploy.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|ARM.ActiveCfg = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|ARM.Build.0 = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|ARM.Deploy.0 = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|iPhone.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|iPhone.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|iPhone.Deploy.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|iPhoneSimulator.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|iPhoneSimulator.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|iPhoneSimulator.Deploy.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|x64.ActiveCfg = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|x64.Build.0 = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|x64.Deploy.0 = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|x86.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|x86.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.AppStore|x86.Deploy.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|Any CPU.ActiveCfg = Debug|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|Any CPU.Build.0 = Debug|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|Any CPU.Deploy.0 = Debug|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|ARM.ActiveCfg = Debug|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|ARM.Build.0 = Debug|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|ARM.Deploy.0 = Debug|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|iPhone.ActiveCfg = Debug|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|x64.ActiveCfg = Debug|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|x64.Build.0 = Debug|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|x64.Deploy.0 = Debug|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|x86.ActiveCfg = Debug|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|x86.Build.0 = Debug|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Debug|x86.Deploy.0 = Debug|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|Any CPU.ActiveCfg = DebugNAtive|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|Any CPU.Build.0 = DebugNAtive|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|Any CPU.Deploy.0 = DebugNAtive|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|ARM.ActiveCfg = DebugNAtive|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|ARM.Deploy.0 = DebugNAtive|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|iPhone.ActiveCfg = DebugNAtive|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|iPhoneSimulator.ActiveCfg = DebugNAtive|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|x64.ActiveCfg = DebugNAtive|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|x64.Build.0 = DebugNAtive|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|x64.Deploy.0 = DebugNAtive|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|x86.ActiveCfg = DebugNAtive|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|x86.Build.0 = DebugNAtive|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.DebugNAtive|x86.Deploy.0 = DebugNAtive|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|Any CPU.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|ARM.ActiveCfg = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|ARM.Build.0 = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|ARM.Deploy.0 = Release|ARM - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|iPhone.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|iPhoneSimulator.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|x64.ActiveCfg = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|x64.Build.0 = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|x64.Deploy.0 = Release|x64 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|x86.ActiveCfg = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|x86.Build.0 = Release|x86 - {D133A400-6A9B-4414-A989-6165FF3A3BAC}.Release|x86.Deploy.0 = Release|x86 - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Ad-Hoc|x64.ActiveCfg = Ad-Hoc|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.AppStore|ARM.ActiveCfg = AppStore|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.AppStore|iPhone.Build.0 = AppStore|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.AppStore|x64.ActiveCfg = AppStore|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.AppStore|x86.ActiveCfg = AppStore|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Debug|Any CPU.ActiveCfg = Debug|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Debug|ARM.ActiveCfg = Debug|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Debug|iPhone.ActiveCfg = Debug|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Debug|iPhone.Build.0 = Debug|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Debug|x64.ActiveCfg = Debug|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Debug|x86.ActiveCfg = Debug|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.DebugNAtive|Any CPU.ActiveCfg = DebugNAtive|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.DebugNAtive|ARM.ActiveCfg = DebugNAtive|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.DebugNAtive|iPhone.ActiveCfg = DebugNAtive|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.DebugNAtive|iPhoneSimulator.ActiveCfg = DebugNAtive|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.DebugNAtive|x64.ActiveCfg = DebugNAtive|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.DebugNAtive|x86.ActiveCfg = DebugNAtive|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|Any CPU.ActiveCfg = Release|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|ARM.ActiveCfg = Release|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|iPhone.ActiveCfg = Release|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|iPhone.Build.0 = Release|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|x64.ActiveCfg = Release|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|x64.Build.0 = Release|iPhone - {2C3B781D-170C-44FA-BB73-E454A4AE73BD}.Release|x86.ActiveCfg = Release|iPhone - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|ARM.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|iPhone.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|x64.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|x64.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|x86.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.AppStore|x86.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|Any CPU.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|ARM.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|ARM.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|iPhone.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|x64.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|x64.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|x86.ActiveCfg = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Debug|x86.Build.0 = Debug|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|Any CPU.ActiveCfg = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|Any CPU.Build.0 = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|ARM.ActiveCfg = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|ARM.Build.0 = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|iPhone.ActiveCfg = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|iPhone.Build.0 = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|iPhoneSimulator.ActiveCfg = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|iPhoneSimulator.Build.0 = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|x64.ActiveCfg = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|x64.Build.0 = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|x86.ActiveCfg = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.DebugNAtive|x86.Build.0 = DebugNAtive|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|Any CPU.ActiveCfg = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|Any CPU.Build.0 = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|ARM.ActiveCfg = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|ARM.Build.0 = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|iPhone.ActiveCfg = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|iPhone.Build.0 = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|x64.ActiveCfg = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|x64.Build.0 = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|x86.ActiveCfg = Release|Any CPU - {085D550D-9E27-474F-A79E-4578224F8664}.Release|x86.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|Any CPU.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|ARM.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|ARM.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|iPhone.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|x64.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|x64.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|x86.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.AppStore|x86.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|ARM.ActiveCfg = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|ARM.Build.0 = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|iPhone.Build.0 = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|x64.ActiveCfg = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|x64.Build.0 = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|x86.ActiveCfg = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Debug|x86.Build.0 = Debug|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|Any CPU.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|Any CPU.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|ARM.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|ARM.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|iPhone.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|iPhone.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|iPhoneSimulator.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|iPhoneSimulator.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|x64.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|x64.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|x86.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.DebugNAtive|x86.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|Any CPU.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|ARM.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|ARM.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|iPhone.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|iPhone.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|x64.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|x64.Build.0 = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|x86.ActiveCfg = Release|Any CPU - {BF907E43-0F07-4502-9AF3-96B063281234}.Release|x86.Build.0 = Release|Any CPU - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|Any CPU.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|ARM.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|ARM.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|iPhone.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|iPhone.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|x64.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|x64.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|x86.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Ad-Hoc|x86.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|Any CPU.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|ARM.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|ARM.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|iPhone.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|iPhone.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|x64.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|x64.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|x86.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.AppStore|x86.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|ARM.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|ARM.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|iPhone.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|iPhone.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|x64.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|x64.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Debug|x86.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|Any CPU.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|ARM.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|ARM.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|iPhone.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|iPhone.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|x64.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|x64.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|x86.ActiveCfg = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.DebugNAtive|x86.Build.0 = Debug|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|Any CPU.Build.0 = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|ARM.ActiveCfg = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|ARM.Build.0 = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|iPhone.ActiveCfg = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|iPhone.Build.0 = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|x64.ActiveCfg = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|x64.Build.0 = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|x86.ActiveCfg = Release|iPhoneSimulator - {F496EC17-11A7-43DD-ABD2-0EACB53BF553}.Release|x86.Build.0 = Release|iPhoneSimulator - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {ABA23BAB-084A-443E-B9CC-37B0A826377E} = {D54B9249-B233-42AD-8346-2E59628B9B34} - {D54B9249-B233-42AD-8346-2E59628B9B34} = {A61994BD-A497-4FA5-B00C-EAC91FDFD0C5} - {C5A73308-8FF9-4767-91CF-1B97B38B0403} = {A61994BD-A497-4FA5-B00C-EAC91FDFD0C5} - {615565C8-84DE-4B6B-80DD-106695429AD8} = {C5A73308-8FF9-4767-91CF-1B97B38B0403} - {39CD5D35-D98E-49A2-868B-89E7B64D25DE} = {C5A73308-8FF9-4767-91CF-1B97B38B0403} - {2848D7D8-3C18-4DF0-8638-CBCCC36A325B} = {C5A73308-8FF9-4767-91CF-1B97B38B0403} - {D41A679F-F6FD-45B5-B63C-304C720090CC} = {F6468D98-0EC8-412A-865C-6AC3F010C044} - {D133A400-6A9B-4414-A989-6165FF3A3BAC} = {F6468D98-0EC8-412A-865C-6AC3F010C044} - {2C3B781D-170C-44FA-BB73-E454A4AE73BD} = {F6468D98-0EC8-412A-865C-6AC3F010C044} - {085D550D-9E27-474F-A79E-4578224F8664} = {F6468D98-0EC8-412A-865C-6AC3F010C044} - {BF907E43-0F07-4502-9AF3-96B063281234} = {C5A73308-8FF9-4767-91CF-1B97B38B0403} - {F496EC17-11A7-43DD-ABD2-0EACB53BF553} = {F6468D98-0EC8-412A-865C-6AC3F010C044} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1C34EA6A-1B6B-4B5A-B3D8-165B651A6744} - EndGlobalSection -EndGlobal diff --git a/src/main/SegCtlr.Netstandard.slnx b/src/main/SegCtlr.Netstandard.slnx new file mode 100644 index 0000000..ac5916e --- /dev/null +++ b/src/main/SegCtlr.Netstandard.slnx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/SegCtlr.Netstandard/Control/SegmentedControl.cs b/src/main/SegCtlr.Netstandard/Control/SegmentedControl.cs index c855af6..3d4f0b2 100644 --- a/src/main/SegCtlr.Netstandard/Control/SegmentedControl.cs +++ b/src/main/SegCtlr.Netstandard/Control/SegmentedControl.cs @@ -1,266 +1,553 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; using System.ComponentModel; using System.Linq; using System.Windows.Input; using Plugin.Segmented.Event; using Xamarin.Forms; -using Xamarin.Forms.Internals; -namespace Plugin.Segmented.Control +namespace Plugin.Segmented.Control; + +/// +/// A row of mutually exclusive segments, rendered with the platform's native segmented control +/// (UISegmentedControl on iOS, a RadioGroup on Android, radio buttons on UWP and +/// NSSegmentedControl on macOS). +/// +/// +/// +/// Segments come either from (for example declared in XAML) or are generated from +/// . The selection is exposed both as an index, , and +/// as the selected segment's , . The two +/// are kept in sync in both directions; items are compared with . +/// +/// +/// Every change of , whether made by the user or in code, raises +/// and executes . Building the control +/// does not. +/// +/// +[DesignTimeVisible(true)] +[Preserve(AllMembers = true)] +[ContentProperty(nameof(Children))] +public class SegmentedControl : View, IViewContainer { - [DesignTimeVisible(true)] - [Preserve(AllMembers = true)] - [ContentProperty(nameof(Children))] - public class SegmentedControl : View, IViewContainer + private IDisposable _childrenSubscription; + private IDisposable _itemsSourceSubscription; + + // The segments as the renderers last saw them, so OnElementChildrenChanging can report the old segments + // after an edit to an observable Children list. + private List _childrenSnapshot = []; + + /// Creates a segmented control with an empty, observable list. + public SegmentedControl() + { + Children = new ObservableCollection(); + } + + /// + /// Raised just before the segments change: before is replaced with a different list, and + /// before the renderers are told about an edit to an observable list. + /// holds the segments as they were; renderers use it to detach + /// from them. + /// + public event EventHandler OnElementChildrenChanging; + + /// + /// Raised after changes, by user interaction or in code. Not raised when the + /// value is set to what it already is. + /// + public event EventHandler OnSegmentSelected; + + #region Children + + /// Identifies the bindable property. + public static readonly BindableProperty ChildrenProperty = BindableProperty.Create( + nameof(Children), + typeof(IList), + typeof(SegmentedControl), + default(IList), + propertyChanging: OnChildrenChanging, + propertyChanged: OnChildrenChanged); + + /// + /// The segments, in display order. This is the XAML content property. + /// + /// + /// + /// The default list is an , so adding or removing segments at runtime + /// updates the control. Any list that implements behaves the same; with + /// a plain list, assign a new list to change the segments. Setting replaces this list. + /// + /// + /// Each segment gets this control as its and its + /// . The list you assign is never modified by the control. + /// + /// + public IList Children + { + get => (IList)GetValue(ChildrenProperty); + set => SetValue(ChildrenProperty, value); + } + + private static void OnChildrenChanging(BindableObject bindable, object oldValue, object newValue) { - public SegmentedControl() + var control = (SegmentedControl)bindable; + + if (oldValue is IList oldList) { - Children = new List(); + control.OnElementChildrenChanging?.Invoke( + control, + new ElementChildrenChanging(oldList, newValue as IList)); } + } + + private static void OnChildrenChanged(BindableObject bindable, object oldValue, object newValue) + { + var control = (SegmentedControl)bindable; + var newList = newValue as IList; - public event EventHandler OnElementChildrenChanging; + control._childrenSubscription?.Dispose(); + control._childrenSubscription = newList is INotifyCollectionChanged observable + ? WeakEvents.SubscribeCollectionChanged(observable, control, static (c, _) => c.OnChildrenCollectionChanged()) + : null; + + control.UpdateLogicalChildren(newList); + control.SyncSelection(SelectionSync.SegmentsReplaced); + } + + private void OnChildrenCollectionChanged() + { + var children = Children; + var selectedItemWasPresent = IndexOfItem(_childrenSnapshot, SelectedItem) >= 0; + + // Renderers rebuild their segments when Children is reported as changed, and detach from the old segments + // in OnElementChildrenChanging. Give them the same sequence as for a replaced list. + OnElementChildrenChanging?.Invoke(this, new ElementChildrenChanging(_childrenSnapshot, children)); + UpdateLogicalChildren(children); + OnPropertyChanged(nameof(Children)); + SyncSelection(SelectionSync.SegmentsEdited, selectedItemWasPresent); + } - public event EventHandler OnSegmentSelected; + private void UpdateLogicalChildren(IList children) + { + var current = children is null ? [] : new List(children); - #region Children - public static readonly BindableProperty ChildrenProperty = BindableProperty.Create(nameof(Children), typeof(IList), typeof(SegmentedControl), default(IList), propertyChanging: OnChildrenChanging); - private static void OnChildrenChanging(BindableObject bindable, object oldValue, object newValue) + foreach (var removed in _childrenSnapshot) { - if (bindable is SegmentedControl segmentedControl - && newValue is IList newItemsList - && segmentedControl.Children != null) + if (!current.Contains(removed) && ReferenceEquals(removed.Parent, this)) { - segmentedControl.OnElementChildrenChanging?.Invoke(segmentedControl, new ElementChildrenChanging((IList)oldValue, newItemsList)); - segmentedControl.Children.Clear(); - - foreach (var newSegment in newItemsList) - { - newSegment.BindingContext = segmentedControl.BindingContext; - segmentedControl.Children.Add(newSegment); - } + removed.Parent = null; } } - public IList Children + + foreach (var segment in current) { - get => (IList)GetValue(ChildrenProperty); - set => SetValue(ChildrenProperty, value); + segment.Parent = this; + segment.BindingContext = BindingContext; } - #endregion - #region ItemsSource - public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create(nameof(ItemsSource), typeof(IEnumerable), typeof(SegmentedControl)); - public static readonly BindableProperty TextPropertyNameProperty = BindableProperty.Create(nameof(TextPropertyName), typeof(string), typeof(SegmentedControl)); - - private void OnItemsSourceChanged() - { - var itemsSource = ItemsSource; - var items = itemsSource as IList; - if (items == null && itemsSource is IEnumerable list) - items = list.Cast().ToList(); + _childrenSnapshot = current; + } - if (items != null) - { - var textValues = items as IEnumerable; - if (textValues == null && items.Count > 0 && items[0] is string) - textValues = items.Cast(); - - if (textValues != null) - { - Children = new List(textValues.Select(child => new SegmentedControlOption { Text = child, Item = child })); - OnSelectedItemChanged(true); - } - else - { - var textPropertyName = TextPropertyName; - if (textPropertyName != null) - { - var newChildren = new List(); - foreach (var item in items) - newChildren.Add(new SegmentedControlOption { Item = item, TextPropertyName = textPropertyName }); - Children = newChildren; - OnSelectedItemChanged(true); - } - } - } - } + #endregion + + #region ItemsSource + + /// Identifies the bindable property. + public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create( + nameof(ItemsSource), + typeof(IEnumerable), + typeof(SegmentedControl), + propertyChanged: (bindable, _, newValue) => ((SegmentedControl)bindable).OnItemsSourceChanged((IEnumerable)newValue)); + + /// Identifies the bindable property. + public static readonly BindableProperty TextPropertyNameProperty = BindableProperty.Create( + nameof(TextPropertyName), + typeof(string), + typeof(SegmentedControl), + propertyChanged: (bindable, _, _) => ((SegmentedControl)bindable).RebuildChildrenFromItemsSource()); + + /// + /// The items to generate segments from. Each item becomes one whose + /// is the item. + /// + /// + /// + /// A string item is displayed as is. For other items the segment shows the property named by + /// , or the item's when no name is set. + /// + /// + /// If the sequence implements (for example an + /// ), the segments follow its changes. Setting + /// to null removes the generated segments. + /// + /// + public IEnumerable ItemsSource + { + get => (IEnumerable)GetValue(ItemsSourceProperty); + set => SetValue(ItemsSourceProperty, value); + } + + /// + /// The name of the property on each item whose value is shown as the segment + /// text. If the item implements , the text follows changes to it. + /// + public string TextPropertyName + { + get => (string)GetValue(TextPropertyNameProperty); + set => SetValue(TextPropertyNameProperty, value); + } + + private void OnItemsSourceChanged(IEnumerable newValue) + { + _itemsSourceSubscription?.Dispose(); + _itemsSourceSubscription = newValue is INotifyCollectionChanged observable + ? WeakEvents.SubscribeCollectionChanged(observable, this, static (c, _) => c.RebuildChildrenFromItemsSource()) + : null; - protected override void OnPropertyChanged(string propertyName = null) + if (newValue is null) { - base.OnPropertyChanged(propertyName); - - if (propertyName == nameof(ItemsSource) || propertyName == nameof(TextPropertyName)) - OnItemsSourceChanged(); - else if(propertyName == nameof(SelectedItem)) - OnSelectedItemChanged(); - else if(propertyName == nameof(SelectedSegment)) - OnSelectedSegmentChanged(); + // ItemsSource was cleared: remove the segments it generated. + Children = new ObservableCollection(); + return; } - private void OnSelectedSegmentChanged() + RebuildChildrenFromItemsSource(); + } + + private void RebuildChildrenFromItemsSource() + { + // Without an ItemsSource the segments come from Children (e.g. XAML); a TextPropertyName change must not + // touch them. + var itemsSource = ItemsSource; + if (itemsSource is null) { - var segmentIndex = SelectedSegment; - if (segmentIndex >= 0 && segmentIndex < Children.Count && SelectedItem != Children[segmentIndex].Item) - SelectedItem = Children[segmentIndex].Item; + return; } - private void OnSelectedItemChanged(bool forceUpdateSelectedSegment = false) + var textPropertyName = TextPropertyName; + Children = [.. itemsSource.Cast().Select(item => CreateOption(item, textPropertyName))]; + } + + private static SegmentedControlOption CreateOption(object item, string textPropertyName) => item switch + { + string text => new SegmentedControlOption { Text = text, Item = text }, + _ when textPropertyName is not null => new SegmentedControlOption { Item = item, TextPropertyName = textPropertyName }, + _ => new SegmentedControlOption { Text = item?.ToString(), Item = item }, + }; + + #endregion + + #region Selection + + /// Identifies the bindable property. + public static readonly BindableProperty SelectedSegmentProperty = BindableProperty.Create( + nameof(SelectedSegment), + typeof(int), + typeof(SegmentedControl), + 0, + propertyChanged: (bindable, _, _) => ((SegmentedControl)bindable).OnSelectedSegmentChanged()); + + /// Identifies the bindable property. Binds two-way by default. + public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create( + nameof(SelectedItem), + typeof(object), + typeof(SegmentedControl), + defaultBindingMode: BindingMode.TwoWay, + propertyChanged: (bindable, _, _) => ((SegmentedControl)bindable).SyncSelection(SelectionSync.SelectedItemChanged)); + + /// + /// The zero-based index of the selected segment. Defaults to 0. Changing it updates + /// , raises and executes + /// . + /// + public int SelectedSegment + { + get => (int)GetValue(SelectedSegmentProperty); + set => SetValue(SelectedSegmentProperty, value); + } + + /// + /// The of the selected segment. Setting it to an item in + /// (compared with ) selects that segment; + /// setting it to an item that is not present leaves the selection unchanged. + /// + /// + /// When the segments are replaced, the selection follows if it is still present; + /// otherwise is taken from the segment at , which is + /// reset to 0 if it is out of range. + /// + public object SelectedItem + { + get => GetValue(SelectedItemProperty); + set => SetValue(SelectedItemProperty, value); + } + + private void OnSelectedSegmentChanged() + { + var children = Children; + var segmentIndex = SelectedSegment; + + if (children is not null && segmentIndex >= 0 && segmentIndex < children.Count) { - if (TextPropertyName != null) + var item = children[segmentIndex].Item; + if (!Equals(SelectedItem, item)) { - var selectedItem = SelectedItem; - var selectedIndex = Children.IndexOf(item => item.Item == selectedItem); - if (selectedIndex == -1) - { - selectedIndex = SelectedSegment; - if (selectedIndex < 0 || selectedIndex >= Children.Count) - SelectedSegment = 0; - else if(SelectedSegment != selectedIndex) - SelectedSegment = selectedIndex; - else if(forceUpdateSelectedSegment) - OnSelectedSegmentChanged(); - } - else if (selectedIndex != SelectedSegment) - SelectedSegment = selectedIndex; + SelectedItem = item; } } - public IEnumerable ItemsSource + RaiseSegmentSelected(); + } + + private enum SelectionSync + { + /// was set. + SelectedItemChanged, + + /// was replaced with a new list. + SegmentsReplaced, + + /// Segments were added to or removed from an observable list. + SegmentsEdited, + } + + /// + /// Keeps and in step. A found + /// among the segments always wins. Otherwise, after the segments changed, is taken + /// from the selected segment; a replaced list also resets an out-of-range to 0. + /// An edited list does not, because XAML adds segments one at a time and the selected one may come later; for + /// the same reason an edit keeps a that has not been added yet, unless it was present + /// before the edit (it was removed). + /// + private void SyncSelection(SelectionSync reason, bool selectedItemWasPresent = false) + { + var children = Children; + if (children is null || children.Count == 0) { - get => (IEnumerable)GetValue(ItemsSourceProperty); - set => SetValue(ItemsSourceProperty, value); + return; } - public string TextPropertyName + var index = IndexOfItem(children, SelectedItem); + if (index >= 0) { - get => (string)GetValue(TextPropertyNameProperty); - set => SetValue(TextPropertyNameProperty, value); - } - #endregion + if (index != SelectedSegment) + { + SelectedSegment = index; + } - public static readonly BindableProperty TextColorProperty = BindableProperty.Create( - propertyName: "TextColor", - returnType: typeof(Color), - declaringType: typeof(SegmentedControl), - defaultValue: default(Color)); + return; + } - public Color TextColor + if (reason == SelectionSync.SelectedItemChanged + || (reason == SelectionSync.SegmentsEdited && SelectedItem is not null && !selectedItemWasPresent)) { - get => (Color) GetValue(TextColorProperty); - set => SetValue(TextColorProperty, value); + return; } - public static readonly BindableProperty TintColorProperty = BindableProperty.Create(nameof(TintColor), typeof(Color), typeof(SegmentedControl), Color.Blue); - - public Color TintColor + if (SelectedSegment >= 0 && SelectedSegment < children.Count) { - get => (Color)GetValue(TintColorProperty); - set => SetValue(TintColorProperty, value); + var item = children[SelectedSegment].Item; + if (!Equals(SelectedItem, item)) + { + SelectedItem = item; + } } - - public static readonly BindableProperty SelectedTextColorProperty = BindableProperty.Create(nameof(SelectedTextColor), typeof(Color), typeof(SegmentedControl), Color.White); - - public Color SelectedTextColor + else if (reason == SelectionSync.SegmentsReplaced) { - get => (Color)GetValue(SelectedTextColorProperty); - set => SetValue(SelectedTextColorProperty, value); + // The property-changed callback updates SelectedItem from the new segment. + SelectedSegment = 0; } + } - public static readonly BindableProperty DisabledColorProperty = BindableProperty.Create(nameof(DisabledColor), typeof(Color), typeof(SegmentedControl), Color.Gray); - - public Color DisabledColor + private static int IndexOfItem(IList children, object item) + { + // A null item would match every option without an Item (e.g. declared in XAML); treat it as "no item". + if (item is null) { - get => (Color)GetValue(DisabledColorProperty); - set => SetValue(DisabledColorProperty, value); + return -1; } - public static readonly BindableProperty BorderColorProperty = BindableProperty.Create(nameof(BorderColor), typeof(Color), typeof(SegmentedControl), defaultValueCreator: bindable => ((SegmentedControl)bindable).TintColor); - - public Color BorderColor + for (var i = 0; i < children.Count; i++) { - get => (Color)GetValue(BorderColorProperty); - set => SetValue(BorderColorProperty, value); + if (Equals(children[i].Item, item)) + { + return i; + } } - public static readonly BindableProperty BorderWidthProperty = BindableProperty.Create(nameof(BorderWidth), typeof(double), typeof(SegmentedControl), defaultValueCreator: _ => Device.RuntimePlatform == Device.Android ? 1.0 : 0.0); + return -1; + } - public double BorderWidth - { - get => (double)GetValue(BorderWidthProperty); - set => SetValue(BorderWidthProperty, value); - } + #endregion - public static readonly BindableProperty SelectedSegmentProperty = BindableProperty.Create(nameof(SelectedSegment), typeof(int), typeof(SegmentedControl), 0); - public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create(nameof(SelectedItem), typeof(object), typeof(SegmentedControl), defaultBindingMode: BindingMode.TwoWay); + #region Appearance - public int SelectedSegment - { - get => (int)GetValue(SelectedSegmentProperty); - set => SetValue(SelectedSegmentProperty, value); - } + /// Identifies the bindable property. + public static readonly BindableProperty TextColorProperty = BindableProperty.Create( + nameof(TextColor), + typeof(Color), + typeof(SegmentedControl), + default(Color)); - public object SelectedItem - { - get => (object)GetValue(SelectedItemProperty); - set => SetValue(SelectedItemProperty, value); - } - + /// The text color of the segments that are not selected. + public Color TextColor + { + get => (Color)GetValue(TextColorProperty); + set => SetValue(TextColorProperty, value); + } - public static readonly BindableProperty SegmentSelectedCommandProperty = BindableProperty.Create(nameof(SegmentSelectedCommand), typeof(ICommand), typeof(SegmentedControl)); - public ICommand SegmentSelectedCommand - { - get => (ICommand)GetValue(SegmentSelectedCommandProperty); - set => SetValue(SegmentSelectedCommandProperty, value); - } + /// Identifies the bindable property. + public static readonly BindableProperty TintColorProperty = BindableProperty.Create(nameof(TintColor), typeof(Color), typeof(SegmentedControl), Color.Blue); - public static readonly BindableProperty SegmentSelectedCommandParameterProperty = BindableProperty.Create(nameof(SegmentSelectedCommandParameter), typeof(object), typeof(SegmentedControl)); + /// The background color of the selected segment. Defaults to . + public Color TintColor + { + get => (Color)GetValue(TintColorProperty); + set => SetValue(TintColorProperty, value); + } + /// Identifies the bindable property. + public static readonly BindableProperty SelectedTextColorProperty = BindableProperty.Create(nameof(SelectedTextColor), typeof(Color), typeof(SegmentedControl), Color.White); - public object SegmentSelectedCommandParameter - { - get => GetValue(SegmentSelectedCommandParameterProperty); - set => SetValue(SegmentSelectedCommandParameterProperty, value); - } + /// The text color of the selected segment. Defaults to . + public Color SelectedTextColor + { + get => (Color)GetValue(SelectedTextColorProperty); + set => SetValue(SelectedTextColorProperty, value); + } - public static readonly BindableProperty FontSizeProperty = BindableProperty.Create(nameof(FontSize), typeof(double), typeof(SegmentedControl), Device.GetNamedSize(NamedSize.Medium, typeof(Label))); - [Xamarin.Forms.TypeConverter(typeof(FontSizeConverter))] - public double FontSize - { - get => (double)GetValue(FontSizeProperty); - set => SetValue(FontSizeProperty, value); - } + /// Identifies the bindable property. + public static readonly BindableProperty DisabledColorProperty = BindableProperty.Create(nameof(DisabledColor), typeof(Color), typeof(SegmentedControl), Color.Gray); + + /// + /// The color used in place of , and + /// while the control is disabled. Defaults to . + /// + public Color DisabledColor + { + get => (Color)GetValue(DisabledColorProperty); + set => SetValue(DisabledColorProperty, value); + } + + /// Identifies the bindable property. + public static readonly BindableProperty BorderColorProperty = BindableProperty.Create(nameof(BorderColor), typeof(Color), typeof(SegmentedControl), defaultValueCreator: bindable => ((SegmentedControl)bindable).TintColor); + + /// + /// The border color (iOS and Android only). If not set, it takes the value of the + /// first time it is read. + /// + public Color BorderColor + { + get => (Color)GetValue(BorderColorProperty); + set => SetValue(BorderColorProperty, value); + } + + /// Identifies the bindable property. + public static readonly BindableProperty BorderWidthProperty = BindableProperty.Create(nameof(BorderWidth), typeof(double), typeof(SegmentedControl), defaultValueCreator: _ => Device.RuntimePlatform == Device.Android ? 1.0 : 0.0); - public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(SegmentedControl)); - public string FontFamily + /// + /// The border width in device-independent units (iOS and Android only). Defaults to 1 on Android + /// and 0 elsewhere. + /// + public double BorderWidth + { + get => (double)GetValue(BorderWidthProperty); + set => SetValue(BorderWidthProperty, value); + } + + /// Identifies the bindable property. + // A defaultValueCreator rather than a static default: Device.GetNamedSize needs Forms.Init(), which may not + // have run when this type is first loaded. + public static readonly BindableProperty FontSizeProperty = BindableProperty.Create(nameof(FontSize), typeof(double), typeof(SegmentedControl), defaultValueCreator: _ => Device.GetNamedSize(NamedSize.Medium, typeof(Label))); + + /// The segment font size. Defaults to the platform's medium size. + [Xamarin.Forms.TypeConverter(typeof(FontSizeConverter))] + public double FontSize + { + get => (double)GetValue(FontSizeProperty); + set => SetValue(FontSizeProperty, value); + } + + /// Identifies the bindable property. + public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(SegmentedControl)); + + /// The segment font family. null or empty uses the platform default font. + public string FontFamily + { + get => (string)GetValue(FontFamilyProperty); + set => SetValue(FontFamilyProperty, value); + } + + #endregion + + #region Command + + /// Identifies the bindable property. + public static readonly BindableProperty SegmentSelectedCommandProperty = BindableProperty.Create(nameof(SegmentSelectedCommand), typeof(ICommand), typeof(SegmentedControl)); + + /// + /// Executed with each time + /// changes, if returns true. + /// + public ICommand SegmentSelectedCommand + { + get => (ICommand)GetValue(SegmentSelectedCommandProperty); + set => SetValue(SegmentSelectedCommandProperty, value); + } + + /// Identifies the bindable property. + public static readonly BindableProperty SegmentSelectedCommandParameterProperty = BindableProperty.Create(nameof(SegmentSelectedCommandParameter), typeof(object), typeof(SegmentedControl)); + + /// The parameter passed to . + public object SegmentSelectedCommandParameter + { + get => GetValue(SegmentSelectedCommandParameterProperty); + set => SetValue(SegmentSelectedCommandParameterProperty, value); + } + + #endregion + + /// + /// Raises and executes for the current + /// . + /// + /// + /// The control now does this itself whenever changes. Calling it as well + /// raises the event twice. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("SegmentedControl raises OnSegmentSelected and executes SegmentSelectedCommand itself when SelectedSegment changes. Calling this raises them a second time.")] + public void RaiseSelectionChanged() => RaiseSegmentSelected(); + + private void RaiseSegmentSelected() + { + OnSegmentSelected?.Invoke(this, new SegmentSelectEventArgs { NewValue = SelectedSegment }); + + var command = SegmentSelectedCommand; + var parameter = SegmentSelectedCommandParameter; + if (command is not null && command.CanExecute(parameter)) { - get => (string)GetValue(FontFamilyProperty); - set => SetValue(FontFamilyProperty, value); + command.Execute(parameter); } + } + /// Passes the new on to every segment. + protected override void OnBindingContextChanged() + { + base.OnBindingContextChanged(); - [EditorBrowsable(EditorBrowsableState.Never)] - public void RaiseSelectionChanged() + if (Children is null) { - OnSegmentSelected?.Invoke(this, new SegmentSelectEventArgs { NewValue = this.SelectedSegment }); - - if (!(SegmentSelectedCommand is null) && SegmentSelectedCommand.CanExecute(SegmentSelectedCommandParameter)) - { - SegmentSelectedCommand.Execute(SegmentSelectedCommandParameter); - } + return; } - protected override void OnBindingContextChanged() + foreach (var segment in Children) { - base.OnBindingContextChanged(); - - if (!(Children is null)) - { - foreach (var segment in Children) - { - segment.BindingContext = BindingContext; - } - } + segment.BindingContext = BindingContext; } } } diff --git a/src/main/SegCtlr.Netstandard/Control/SegmentedControlOption.cs b/src/main/SegCtlr.Netstandard/Control/SegmentedControlOption.cs index f49151e..04c2356 100644 --- a/src/main/SegCtlr.Netstandard/Control/SegmentedControlOption.cs +++ b/src/main/SegCtlr.Netstandard/Control/SegmentedControlOption.cs @@ -1,60 +1,110 @@ using System; using System.ComponentModel; +using System.Reflection; using Xamarin.Forms; -namespace Plugin.Segmented.Control +namespace Plugin.Segmented.Control; + +/// +/// One segment of a . Declare it in XAML inside the control, or let the control +/// generate it from . +/// +/// +/// The renderers use , and +/// (a value above 0 fixes the segment width). +/// +[Preserve(AllMembers = true)] +public class SegmentedControlOption : View { - [Preserve(AllMembers = true)] - public class SegmentedControlOption : View + /// Identifies the bindable property. + public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(SegmentedControlOption), string.Empty); + + /// Identifies the bindable property. + public static readonly BindableProperty ItemProperty = BindableProperty.Create(nameof(Item), typeof(object), typeof(SegmentedControlOption), propertyChanged: (bindable, _, newValue) => ((SegmentedControlOption)bindable).OnItemChanged(newValue)); + + /// Identifies the bindable property. + public static readonly BindableProperty TextPropertyNameProperty = BindableProperty.Create(nameof(TextPropertyName), typeof(string), typeof(SegmentedControlOption)); + + private IDisposable _itemSubscription; + private PropertyInfo _textProperty; + + /// + /// The text shown in the segment. When is set, it is read from + /// and overwritten whenever that property changes. + /// + public string Text { - public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(SegmentedControlOption), string.Empty); - public static readonly BindableProperty ItemProperty = BindableProperty.Create(nameof(Item), typeof(object), typeof(SegmentedControlOption), propertyChanged: (bindable, value, newValue) => ((SegmentedControlOption)bindable).OnItemChanged(value, newValue)); - public static readonly BindableProperty TextPropertyNameProperty = BindableProperty.Create(nameof(TextPropertyName), typeof(string), typeof(SegmentedControlOption)); + get => (string)GetValue(TextProperty); + set => SetValue(TextProperty, value); + } - public string Text - { - get => (string)GetValue(TextProperty); - set => SetValue(TextProperty, value); - } + /// + /// The value this segment stands for. It is what returns + /// while the segment is selected. + /// + public object Item + { + get => GetValue(ItemProperty); + set => SetValue(ItemProperty, value); + } - public object Item - { - get => GetValue(ItemProperty); - set => SetValue(ItemProperty, value); - } + /// + /// The name of a public property on to show as . If + /// implements , the text follows that property. + /// + /// + /// The item holds only a weak reference to this option, so an option that is no longer displayed can be + /// collected even while the item lives on. + /// + public string TextPropertyName + { + get => (string)GetValue(TextPropertyNameProperty); + set => SetValue(TextPropertyNameProperty, value); + } + + private void OnItemChanged(object newValue) + { + _itemSubscription?.Dispose(); + _itemSubscription = newValue is INotifyPropertyChanged observable + ? WeakEvents.SubscribePropertyChanged(observable, this, static (option, e) => option.OnItemPropertyChanged(e)) + : null; + } + + /// + protected override void OnPropertyChanged(string propertyName = null) + { + base.OnPropertyChanged(propertyName); - public string TextPropertyName + if (propertyName is nameof(Item) or nameof(TextPropertyName)) { - get => (string)GetValue(TextPropertyNameProperty); - set => SetValue(TextPropertyNameProperty, value); + SetTextFromItemProperty(); } + } - private void OnItemChanged(object value, object newValue) + private void OnItemPropertyChanged(PropertyChangedEventArgs e) + { + // An empty or null name means "all properties changed". + if (string.IsNullOrEmpty(e.PropertyName) || e.PropertyName == TextPropertyName) { - if (value is INotifyPropertyChanged mutableItem) - mutableItem.PropertyChanged -= OnItemPropertyChanged; - if (newValue is INotifyPropertyChanged newMutableItem) - newMutableItem.PropertyChanged += OnItemPropertyChanged; + SetTextFromItemProperty(); } + } - protected override void OnPropertyChanged(string propertyName = null) + private void SetTextFromItemProperty() + { + var item = Item; + var name = TextPropertyName; + if (item is null || name is null) { - base.OnPropertyChanged(propertyName); - - if (propertyName == nameof(Item) || propertyName == nameof(TextPropertyName)) - SetTextFromItemProperty(); + return; } - private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e) + var type = item.GetType(); + if (_textProperty is null || _textProperty.Name != name || _textProperty.DeclaringType?.IsAssignableFrom(type) != true) { - if(e.PropertyName == TextPropertyName) - SetTextFromItemProperty(); + _textProperty = type.GetProperty(name); } - private void SetTextFromItemProperty() - { - if (Item != null && TextPropertyName != null) - Text = Item.GetType().GetProperty(TextPropertyName)?.GetValue(Item)?.ToString(); - } + Text = _textProperty?.GetValue(item)?.ToString(); } } diff --git a/src/main/SegCtlr.Netstandard/Event/ElementChildrenChanging.cs b/src/main/SegCtlr.Netstandard/Event/ElementChildrenChanging.cs index bc41284..d295588 100644 --- a/src/main/SegCtlr.Netstandard/Event/ElementChildrenChanging.cs +++ b/src/main/SegCtlr.Netstandard/Event/ElementChildrenChanging.cs @@ -2,18 +2,26 @@ using System.Collections.Generic; using Plugin.Segmented.Control; -namespace Plugin.Segmented.Event -{ +namespace Plugin.Segmented.Event; - [Preserve(AllMembers = true)] - public class ElementChildrenChanging : EventArgs +/// +/// Data for , raised just before +/// is replaced. +/// +[Preserve(AllMembers = true)] +public class ElementChildrenChanging : EventArgs +{ + /// Creates the event data. + /// The segments being replaced. + /// The segments replacing them; may be null. + public ElementChildrenChanging(IList oldValues, IList newValues) { - public ElementChildrenChanging(IList oldValues, IList newValues) - { - OldValues = oldValues; - NewValues = newValues; - } - public IList OldValues { get; } - public IList NewValues { get; } + OldValues = oldValues; + NewValues = newValues; } + /// The segments being replaced. The control does not modify this list. + public IList OldValues { get; } + + /// The segments replacing them; may be null. + public IList NewValues { get; } } diff --git a/src/main/SegCtlr.Netstandard/Event/SegmentSelectEvent.cs b/src/main/SegCtlr.Netstandard/Event/SegmentSelectEvent.cs index 7c81583..2d0d904 100644 --- a/src/main/SegCtlr.Netstandard/Event/SegmentSelectEvent.cs +++ b/src/main/SegCtlr.Netstandard/Event/SegmentSelectEvent.cs @@ -1,10 +1,11 @@ using System; -namespace Plugin.Segmented.Event +namespace Plugin.Segmented.Event; + +/// Data for . +[Preserve(AllMembers = true)] +public class SegmentSelectEventArgs : EventArgs { - [Preserve(AllMembers = true)] - public class SegmentSelectEventArgs : EventArgs - { - public int NewValue { get; set; } - } + /// The newly selected . + public int NewValue { get; set; } } diff --git a/src/main/SegCtlr.Netstandard/PreserveAttribute.cs b/src/main/SegCtlr.Netstandard/PreserveAttribute.cs index 9b21d10..827310e 100644 --- a/src/main/SegCtlr.Netstandard/PreserveAttribute.cs +++ b/src/main/SegCtlr.Netstandard/PreserveAttribute.cs @@ -1,10 +1,16 @@ using System; -namespace Plugin.Segmented +namespace Plugin.Segmented; + +/// +/// Tells the Xamarin linker not to remove the marked type or member. The linker recognises any attribute +/// with this name, so this copy avoids a dependency on a platform assembly. +/// +public sealed class PreserveAttribute : Attribute { - public sealed class PreserveAttribute : Attribute - { - public bool AllMembers; - public bool Conditional; - } + /// Also keep every member of the marked type. + public bool AllMembers; + + /// Keep the marked member only if its declaring type is kept. + public bool Conditional; } diff --git a/src/main/SegCtlr.Netstandard/SegCtlr.Netstandard.csproj b/src/main/SegCtlr.Netstandard/SegCtlr.Netstandard.csproj index 49fe517..f82b8a1 100644 --- a/src/main/SegCtlr.Netstandard/SegCtlr.Netstandard.csproj +++ b/src/main/SegCtlr.Netstandard/SegCtlr.Netstandard.csproj @@ -1,17 +1,18 @@  - netstandard2.0 + netstandard2.0;net10.0 Plugin.Segmented Plugin.Segmented - 5.5.0.0 - 5.5.0.0 + + 5.6.0 Debug;Release;DebugNative true true true snupkg portable + true @@ -19,11 +20,6 @@ - - - - - - + diff --git a/src/main/SegCtlr.Netstandard/WeakEvents.cs b/src/main/SegCtlr.Netstandard/WeakEvents.cs new file mode 100644 index 0000000..2835c26 --- /dev/null +++ b/src/main/SegCtlr.Netstandard/WeakEvents.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Specialized; +using System.ComponentModel; + +namespace Plugin.Segmented; + +/// +/// Subscribes to and without the source +/// keeping the subscriber alive. View-model items and collections usually outlive the controls bound to them; a +/// normal subscription would keep every control (and its renderer) that ever displayed them in memory. +/// +/// +/// Pass a static lambda as the handler: it receives the target, so it must not capture it. +/// +internal static class WeakEvents +{ + public static IDisposable SubscribePropertyChanged( + INotifyPropertyChanged source, + TTarget target, + Action handler) + where TTarget : class + { + var listener = new Listener(target, handler); + PropertyChangedEventHandler forward = listener.OnEvent; + source.PropertyChanged += forward; + listener.Unsubscribe = () => source.PropertyChanged -= forward; + return listener; + } + + public static IDisposable SubscribeCollectionChanged( + INotifyCollectionChanged source, + TTarget target, + Action handler) + where TTarget : class + { + var listener = new Listener(target, handler); + NotifyCollectionChangedEventHandler forward = listener.OnEvent; + source.CollectionChanged += forward; + listener.Unsubscribe = () => source.CollectionChanged -= forward; + return listener; + } + + private sealed class Listener(TTarget target, Action handler) : IDisposable + where TTarget : class + { + private readonly WeakReference _target = new(target); + + public Action Unsubscribe { get; set; } + + public void OnEvent(object _, TArgs e) + { + if (_target.TryGetTarget(out var target)) + { + handler(target, e); + } + else + { + // The subscriber has been collected; drop the subscription the next time the source raises. + Dispose(); + } + } + + public void Dispose() + { + Unsubscribe?.Invoke(); + Unsubscribe = null; + } + } +} diff --git a/src/test/SegCtlr.Tests/ChildrenTests.cs b/src/test/SegCtlr.Tests/ChildrenTests.cs new file mode 100644 index 0000000..dbc602d --- /dev/null +++ b/src/test/SegCtlr.Tests/ChildrenTests.cs @@ -0,0 +1,88 @@ +using Plugin.Segmented.Control; +using Plugin.Segmented.Event; + +namespace SegCtlr.Tests; + +// Review finding 1.2: replacing Children must not modify the lists the caller passed in. +public class ChildrenTests +{ + [Fact] + public void Replacing_children_does_not_modify_the_previous_list() + { + var a = new SegmentedControlOption { Text = "A" }; + var b = new SegmentedControlOption { Text = "B" }; + var first = new List { a, b }; + var second = new List { new() { Text = "X" } }; + var control = new SegmentedControl { Children = first }; + + control.Children = second; + + Assert.Equal(new[] { a, b }, first); + Assert.Same(second, control.Children); + Assert.Single(second); + } + + [Fact] + public void Children_changing_event_reports_the_old_and_new_lists_unchanged() + { + var old = new List { new() { Text = "A" } }; + var replacement = new List { new() { Text = "X" }, new() { Text = "Y" } }; + var control = new SegmentedControl { Children = old }; + ElementChildrenChanging? args = null; + control.OnElementChildrenChanging += (_, e) => args = e; + + control.Children = replacement; + + Assert.NotNull(args); + Assert.Same(old, args!.OldValues); + Assert.Same(replacement, args.NewValues); + Assert.Equal("A", Assert.Single(args.OldValues).Text); + } + + [Fact] + public void New_children_get_the_control_binding_context() + { + var context = new object(); + var control = new SegmentedControl { BindingContext = context }; + var option = new SegmentedControlOption { Text = "A" }; + + control.Children = [option]; + + Assert.Same(context, option.BindingContext); + } + + [Fact] + public void Binding_context_change_flows_to_children() + { + var option = new SegmentedControlOption { Text = "A" }; + var control = new SegmentedControl { Children = [option] }; + var context = new object(); + + control.BindingContext = context; + + Assert.Same(context, option.BindingContext); + } + + [Fact] + public void Setting_children_to_null_does_not_throw() + { + var control = new SegmentedControl { ItemsSource = new[] { "A" } }; + + var exception = Record.Exception(() => control.Children = null); + + Assert.Null(exception); + } + + [Fact] + public void Items_source_produces_a_fresh_children_list_each_time() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B" } }; + var firstChildren = control.Children; + + control.ItemsSource = new[] { "X" }; + + Assert.NotSame(firstChildren, control.Children); + Assert.Equal(["A", "B"], firstChildren.Select(c => c.Text)); + Assert.Equal("X", Assert.Single(control.Children).Text); + } +} diff --git a/src/test/SegCtlr.Tests/DefaultsTests.cs b/src/test/SegCtlr.Tests/DefaultsTests.cs new file mode 100644 index 0000000..8a83a65 --- /dev/null +++ b/src/test/SegCtlr.Tests/DefaultsTests.cs @@ -0,0 +1,15 @@ +using Plugin.Segmented.Control; + +namespace SegCtlr.Tests; + +// Review finding 1.7: the type must load without Xamarin.Forms.Forms.Init(); this test host has no platform services. +public class DefaultsTests +{ + [Fact] + public void Control_can_be_created_and_used_without_forms_init() + { + var exception = Record.Exception(() => new SegmentedControl { ItemsSource = new[] { "A" }, SelectedSegment = 0 }); + + Assert.Null(exception); + } +} diff --git a/src/test/SegCtlr.Tests/ItemsSourceTests.cs b/src/test/SegCtlr.Tests/ItemsSourceTests.cs new file mode 100644 index 0000000..df910af --- /dev/null +++ b/src/test/SegCtlr.Tests/ItemsSourceTests.cs @@ -0,0 +1,112 @@ +using System.Collections.ObjectModel; +using Plugin.Segmented.Control; + +namespace SegCtlr.Tests; + +// Review findings 1.4 (null / non-string ItemsSource) and 1.5 (collection changes). +public class ItemsSourceTests +{ + [Fact] + public void Setting_items_source_to_null_removes_the_segments() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B" } }; + + control.ItemsSource = null; + + Assert.Empty(control.Children); + } + + [Fact] + public void Text_property_name_change_without_items_source_keeps_xaml_children() + { + var control = new SegmentedControl(); + control.Children.Add(new SegmentedControlOption { Text = "A" }); + + control.TextPropertyName = "Name"; + + Assert.Equal("A", Assert.Single(control.Children).Text); + } + + [Fact] + public void Non_string_items_without_text_property_name_use_to_string() + { + var control = new SegmentedControl { ItemsSource = new object[] { 1, 2.5m } }; + + Assert.Equal(["1", "2.5"], control.Children.Select(c => c.Text)); + Assert.Equal(1, control.Children[0].Item); + } + + [Fact] + public void Empty_items_source_produces_no_segments() + { + var control = new SegmentedControl { ItemsSource = Array.Empty() }; + + Assert.Empty(control.Children); + } + + [Fact] + public void Lazy_sequence_is_enumerated() + { + var control = new SegmentedControl { ItemsSource = Enumerable.Range(1, 3).Select(i => $"#{i}") }; + + Assert.Equal(["#1", "#2", "#3"], control.Children.Select(c => c.Text)); + } + + [Fact] + public void Observable_items_source_additions_and_removals_update_the_segments() + { + var items = new ObservableCollection { "A", "B" }; + var control = new SegmentedControl { ItemsSource = items }; + + items.Add("C"); + items.Remove("A"); + + Assert.Equal(["B", "C"], control.Children.Select(c => c.Text)); + } + + [Fact] + public void Observable_items_source_change_keeps_the_selected_item() + { + var items = new ObservableCollection { "A", "B" }; + var control = new SegmentedControl { ItemsSource = items, SelectedItem = "B" }; + + items.Insert(0, "Z"); + + Assert.Equal(2, control.SelectedSegment); + Assert.Equal("B", control.SelectedItem); + } + + [Fact] + public void Replaced_observable_items_source_is_no_longer_followed() + { + var first = new ObservableCollection { "A" }; + var control = new SegmentedControl { ItemsSource = first }; + control.ItemsSource = new[] { "X" }; + + first.Add("B"); + + Assert.Equal("X", Assert.Single(control.Children).Text); + } + + [Fact] + public void Control_can_be_collected_while_its_observable_items_source_lives_on() + { + var items = new ObservableCollection { "A" }; + + var control = CreateControlBoundTo(items); + GcCollect(); + + Assert.False(control.TryGetTarget(out _)); + items.Add("B"); // Raising after collection drops the dead subscription without throwing. + } + + private static WeakReference CreateControlBoundTo(ObservableCollection items) => + new(new SegmentedControl { ItemsSource = items }); + + internal static void GcCollect() + { + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + } +} diff --git a/src/test/SegCtlr.Tests/ObservableChildrenTests.cs b/src/test/SegCtlr.Tests/ObservableChildrenTests.cs new file mode 100644 index 0000000..e336944 --- /dev/null +++ b/src/test/SegCtlr.Tests/ObservableChildrenTests.cs @@ -0,0 +1,120 @@ +using System.Collections.ObjectModel; +using System.ComponentModel; +using Plugin.Segmented.Control; +using Plugin.Segmented.Event; + +namespace SegCtlr.Tests; + +// Review findings 1.5 (Children edits reach the renderers) and 1.6 (segments are logical children). +public class ObservableChildrenTests +{ + [Fact] + public void Default_children_list_is_observable() + { + Assert.IsType>(new SegmentedControl().Children); + } + + [Fact] + public void Added_segment_gets_the_control_as_parent_and_its_binding_context() + { + var context = new object(); + var control = new SegmentedControl { BindingContext = context }; + var option = new SegmentedControlOption { Text = "A" }; + + control.Children.Add(option); + + Assert.Same(control, option.Parent); + Assert.Same(context, option.BindingContext); + } + + [Fact] + public void Removed_segment_loses_its_parent() + { + var option = new SegmentedControlOption { Text = "A" }; + var control = new SegmentedControl(); + control.Children.Add(option); + + control.Children.Remove(option); + + Assert.Null(option.Parent); + } + + [Fact] + public void Segments_of_a_replaced_list_lose_their_parent() + { + var old = new SegmentedControlOption { Text = "A" }; + var control = new SegmentedControl { Children = [old] }; + + control.Children = [new SegmentedControlOption { Text = "X" }]; + + Assert.Null(old.Parent); + Assert.Same(control, control.Children[0].Parent); + } + + [Fact] + public void Editing_children_notifies_renderers_like_a_replaced_list() + { + var a = new SegmentedControlOption { Text = "A" }; + var control = new SegmentedControl(); + control.Children.Add(a); + var events = new List(); + ElementChildrenChanging? changing = null; + control.OnElementChildrenChanging += (_, e) => + { + changing = e; + events.Add("changing"); + }; + ((INotifyPropertyChanged)control).PropertyChanged += (_, e) => + { + if (e.PropertyName == nameof(SegmentedControl.Children)) + { + events.Add("changed"); + } + }; + + control.Children.Add(new SegmentedControlOption { Text = "B" }); + + Assert.Equal(["changing", "changed"], events); + Assert.Equal([a], changing!.OldValues); + Assert.Equal(2, changing.NewValues.Count); + } + + [Fact] + public void Segments_added_one_at_a_time_keep_the_selected_segment() + { + // XAML sets SelectedSegment before it adds the segments. + var control = new SegmentedControl { SelectedSegment = 2 }; + + control.Children.Add(new SegmentedControlOption { Text = "A", Item = "a" }); + control.Children.Add(new SegmentedControlOption { Text = "B", Item = "b" }); + control.Children.Add(new SegmentedControlOption { Text = "C", Item = "c" }); + + Assert.Equal(2, control.SelectedSegment); + Assert.Equal("c", control.SelectedItem); + } + + [Fact] + public void Selected_item_set_before_segments_are_added_selects_its_segment() + { + var control = new SegmentedControl { SelectedItem = "b" }; + + control.Children.Add(new SegmentedControlOption { Text = "A", Item = "a" }); + control.Children.Add(new SegmentedControlOption { Text = "B", Item = "b" }); + + Assert.Equal(1, control.SelectedSegment); + } + + [Fact] + public void Removing_the_selected_segment_takes_the_selected_item_from_the_new_selection() + { + var control = new SegmentedControl(); + control.Children.Add(new SegmentedControlOption { Text = "A", Item = "a" }); + control.Children.Add(new SegmentedControlOption { Text = "B", Item = "b" }); + control.SelectedItem = "a"; + + control.Children.RemoveAt(0); + + Assert.Equal(0, control.SelectedSegment); + Assert.Equal("b", control.SelectedItem); + } +} diff --git a/src/test/SegCtlr.Tests/SegCtlr.Tests.csproj b/src/test/SegCtlr.Tests/SegCtlr.Tests.csproj new file mode 100644 index 0000000..11a6e32 --- /dev/null +++ b/src/test/SegCtlr.Tests/SegCtlr.Tests.csproj @@ -0,0 +1,27 @@ + + + + net10.0 + enable + enable + SegCtlr.Tests + false + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/SegCtlr.Tests/SegmentedControlOptionTests.cs b/src/test/SegCtlr.Tests/SegmentedControlOptionTests.cs new file mode 100644 index 0000000..6344dc6 --- /dev/null +++ b/src/test/SegCtlr.Tests/SegmentedControlOptionTests.cs @@ -0,0 +1,143 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Plugin.Segmented.Control; + +namespace SegCtlr.Tests; + +public class SegmentedControlOptionTests +{ + [Fact] + public void Text_is_read_from_the_item_property() + { + var option = new SegmentedControlOption { TextPropertyName = nameof(Person.Name), Item = new Person { Name = "Ada" } }; + + Assert.Equal("Ada", option.Text); + } + + [Fact] + public void Text_follows_changes_to_the_item_property() + { + var person = new Person { Name = "Ada" }; + var option = new SegmentedControlOption { TextPropertyName = nameof(Person.Name), Item = person }; + + person.Name = "Grace"; + + Assert.Equal("Grace", option.Text); + } + + [Fact] + public void Changes_to_other_item_properties_are_ignored() + { + var person = new Person { Name = "Ada" }; + // Initializers run in order, so Text overrides the value just read from the item. + var option = new SegmentedControlOption { TextPropertyName = nameof(Person.Name), Item = person, Text = "Custom" }; + + person.Age = 36; + + Assert.Equal("Custom", option.Text); + } + + [Fact] + public void Replaced_item_is_no_longer_followed() + { + var first = new Person { Name = "Ada" }; + var option = new SegmentedControlOption { TextPropertyName = nameof(Person.Name), Item = first }; + option.Item = new Person { Name = "Grace" }; + + first.Name = "Changed"; + + Assert.Equal("Grace", option.Text); + } + + [Fact] + public void Text_is_left_alone_without_a_text_property_name() + { + var option = new SegmentedControlOption { Text = "Fixed", Item = new Person { Name = "Ada" } }; + + Assert.Equal("Fixed", option.Text); + } + + [Fact] + public void Items_source_with_text_property_name_uses_the_item_text() + { + var control = new SegmentedControl + { + TextPropertyName = nameof(Person.Name), + ItemsSource = new List { new() { Name = "Ada" }, new() { Name = "Grace" } }, + }; + + Assert.Equal(["Ada", "Grace"], control.Children.Select(c => c.Text)); + } + + [Fact] + public void Option_can_be_collected_while_its_item_lives_on() + { + // Review finding 2.1: the item's PropertyChanged must not keep discarded options alive. + var person = new Person { Name = "Ada" }; + + var option = CreateOptionFor(person); + ItemsSourceTests.GcCollect(); + + Assert.False(option.TryGetTarget(out _)); + person.Name = "Grace"; // Raising after collection drops the dead subscription without throwing. + } + + [Fact] + public void Text_refreshes_when_the_item_reports_all_properties_changed() + { + var person = new Person { Name = "Ada" }; + var option = new SegmentedControlOption { TextPropertyName = nameof(Person.Name), Item = person }; + + person.SetNameSilently("Grace"); + person.RaiseAllChanged(); + + Assert.Equal("Grace", option.Text); + } + + private static WeakReference CreateOptionFor(Person person) => + new(new SegmentedControlOption { TextPropertyName = nameof(Person.Name), Item = person }); + + private sealed class Person : INotifyPropertyChanged + { + public event PropertyChangedEventHandler? PropertyChanged; + + public string? Name + { + get; + set + { + field = value; + OnPropertyChanged(); + } + } + + public int Age + { + get; + set + { + field = value; + OnPropertyChanged(); + } + } + + private bool _muted; + + public void SetNameSilently(string name) + { + _muted = true; + Name = name; + _muted = false; + } + + public void RaiseAllChanged() => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(string.Empty)); + + private void OnPropertyChanged([CallerMemberName] string? name = null) + { + if (!_muted) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + } + } +} diff --git a/src/test/SegCtlr.Tests/SelectedItemTests.cs b/src/test/SegCtlr.Tests/SelectedItemTests.cs new file mode 100644 index 0000000..a2ec1dc --- /dev/null +++ b/src/test/SegCtlr.Tests/SelectedItemTests.cs @@ -0,0 +1,151 @@ +using Plugin.Segmented.Control; + +namespace SegCtlr.Tests; + +// Review finding 1.1 (SelectedItem ignored without TextPropertyName) and 1.3 (reference equality). +public class SelectedItemTests +{ + [Fact] + public void String_items_source_sets_selected_item_from_selected_segment() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B", "C" } }; + + Assert.Equal(0, control.SelectedSegment); + Assert.Equal("A", control.SelectedItem); + } + + [Fact] + public void String_items_source_selected_item_moves_selected_segment() + { + var control = new SegmentedControl + { + ItemsSource = new[] { "A", "B", "C" }, + SelectedItem = "C" + }; + + Assert.Equal(2, control.SelectedSegment); + } + + [Fact] + public void Selected_item_set_before_items_source_is_applied_when_items_arrive() + { + var control = new SegmentedControl + { + SelectedItem = "B", + ItemsSource = new[] { "A", "B", "C" } + }; + + Assert.Equal(1, control.SelectedSegment); + Assert.Equal("B", control.SelectedItem); + } + + [Fact] + public void Selected_segment_change_updates_selected_item() + { + var control = new SegmentedControl + { + ItemsSource = new[] { "A", "B", "C" }, + SelectedSegment = 1 + }; + + Assert.Equal("B", control.SelectedItem); + } + + [Fact] + public void Equal_string_that_is_a_different_instance_is_found() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B", "C" } }; + var differentInstance = new string(['B']); + Assert.False(ReferenceEquals("B", differentInstance)); + + control.SelectedItem = differentInstance; + + Assert.Equal(1, control.SelectedSegment); + } + + [Fact] + public void Boxed_value_items_are_matched_by_value() + { + var control = new SegmentedControl + { + Children = + [ + new() { Text = "One", Item = 1 }, + new() { Text = "Two", Item = 2 }, + new() { Text = "Three", Item = 3 }, + ], + SelectedItem = 3 + }; + + Assert.Equal(2, control.SelectedSegment); + } + + [Fact] + public void Object_items_with_text_property_name_are_matched_with_equals() + { + var control = new SegmentedControl + { + TextPropertyName = nameof(Fruit.Name), + ItemsSource = new[] { new Fruit("Apple"), new Fruit("Pear") }, + SelectedItem = new Fruit("Pear") + }; + + Assert.Equal(1, control.SelectedSegment); + Assert.Equal("Pear", control.Children[1].Text); + } + + [Fact] + public void Selected_item_not_in_the_list_leaves_selected_segment_alone() + { + var control = new SegmentedControl + { + ItemsSource = new[] { "A", "B", "C" }, + SelectedSegment = 2, + SelectedItem = "Z" + }; + + Assert.Equal(2, control.SelectedSegment); + } + + [Fact] + public void Children_without_items_keep_the_selected_segment() + { + // XAML-style options have no Item; a null SelectedItem must not match them and reset the segment to 0. + var control = new SegmentedControl + { + SelectedSegment = 2, + Children = + [ + new() { Text = "A" }, + new() { Text = "B" }, + new() { Text = "C" }, + ] + }; + + Assert.Equal(2, control.SelectedSegment); + } + + [Fact] + public void Out_of_range_selected_segment_resets_to_first_item_when_items_shrink() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B", "C", "D" }, SelectedSegment = 3 }; + + control.ItemsSource = new[] { "X", "Y" }; + + Assert.Equal(0, control.SelectedSegment); + Assert.Equal("X", control.SelectedItem); + } + + [Fact] + public void Replacing_items_source_keeps_selected_item_when_it_still_exists() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B", "C" }, SelectedSegment = 1 }; + + control.ItemsSource = new[] { "Z", "A", "B" }; + + Assert.Equal("B", control.SelectedItem); + Assert.Equal(2, control.SelectedSegment); + } + + private sealed record Fruit(string Name); +} diff --git a/src/test/SegCtlr.Tests/SelectionEventTests.cs b/src/test/SegCtlr.Tests/SelectionEventTests.cs new file mode 100644 index 0000000..6e877a5 --- /dev/null +++ b/src/test/SegCtlr.Tests/SelectionEventTests.cs @@ -0,0 +1,87 @@ +using Plugin.Segmented.Control; +using Xamarin.Forms; + +namespace SegCtlr.Tests; + +// Review finding 1.8: SegmentedControl raises its own selection event and command, once per change. +public class SelectionEventTests +{ + [Fact] + public void Changing_selected_segment_raises_event_once_with_the_new_value() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B", "C" } }; + var raised = new List(); + control.OnSegmentSelected += (_, e) => raised.Add(e.NewValue); + + control.SelectedSegment = 2; + + Assert.Equal(new[] { 2 }, raised); + } + + [Fact] + public void Changing_selected_segment_executes_the_command_with_its_parameter() + { + var parameters = new List(); + var control = new SegmentedControl + { + ItemsSource = new[] { "A", "B" }, + SegmentSelectedCommand = new Command(p => parameters.Add(p)), + SegmentSelectedCommandParameter = "param", + SelectedSegment = 1 + }; + + Assert.Equal(new object[] { "param" }, parameters); + } + + [Fact] + public void Command_that_cannot_execute_is_not_executed() + { + var executed = false; + var control = new SegmentedControl + { + ItemsSource = new[] { "A", "B" }, + SegmentSelectedCommand = new Command(() => executed = true, () => false), + SelectedSegment = 1 + }; + + Assert.False(executed); + } + + [Fact] + public void Setting_the_same_segment_again_does_not_raise() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B" }, SelectedSegment = 1 }; + var count = 0; + control.OnSegmentSelected += (_, _) => count++; + + control.SelectedSegment = 1; + + Assert.Equal(0, count); + } + + [Fact] + public void Setting_selected_item_raises_once() + { + var control = new SegmentedControl { ItemsSource = new[] { "A", "B", "C" } }; + var raised = new List(); + control.OnSegmentSelected += (_, e) => raised.Add(e.NewValue); + + control.SelectedItem = "B"; + + Assert.Equal(new[] { 1 }, raised); + } + + [Fact] + public void Building_the_control_does_not_raise() + { + var count = 0; + var control = new SegmentedControl(); + control.OnSegmentSelected += (_, _) => count++; + control.SegmentSelectedCommand = new Command(() => count++); + + control.ItemsSource = new[] { "A", "B" }; + control.TextColor = Color.Red; + + Assert.Equal(0, count); + } +} diff --git a/src/test/Test.SegCtrl.Android/Test.SegCtrl.Android.csproj b/src/test/Test.SegCtrl.Android/Test.SegCtrl.Android.csproj index 7fb84bb..2564b5c 100644 --- a/src/test/Test.SegCtrl.Android/Test.SegCtrl.Android.csproj +++ b/src/test/Test.SegCtrl.Android/Test.SegCtrl.Android.csproj @@ -168,7 +168,7 @@ 1.1.0.10 - 5.0.0.2291 + 5.0.0.2662 diff --git a/src/test/Test.SegCtrl.UWP/Test.SegCtlr.UWP.csproj b/src/test/Test.SegCtrl.UWP/Test.SegCtlr.UWP.csproj index ab8e76b..6760bf0 100644 --- a/src/test/Test.SegCtrl.UWP/Test.SegCtlr.UWP.csproj +++ b/src/test/Test.SegCtrl.UWP/Test.SegCtlr.UWP.csproj @@ -167,7 +167,7 @@ 6.2.13 - 5.0.0.2291 + 5.0.0.2662 diff --git a/src/test/Test.SegCtrl.iOS/Test.SegCtlr.iOS.csproj b/src/test/Test.SegCtrl.iOS/Test.SegCtlr.iOS.csproj index 39c0a1d..9d6719e 100644 --- a/src/test/Test.SegCtrl.iOS/Test.SegCtlr.iOS.csproj +++ b/src/test/Test.SegCtrl.iOS/Test.SegCtlr.iOS.csproj @@ -159,7 +159,7 @@ - 5.0.0.2291 + 5.0.0.2662 diff --git a/src/test/Test.SegCtrl.macOS/Test.SegCtrl.macOS.csproj b/src/test/Test.SegCtrl.macOS/Test.SegCtrl.macOS.csproj index 35dd4ab..4fa670c 100644 --- a/src/test/Test.SegCtrl.macOS/Test.SegCtrl.macOS.csproj +++ b/src/test/Test.SegCtrl.macOS/Test.SegCtrl.macOS.csproj @@ -99,7 +99,7 @@ - 5.0.0.2291 + 5.0.0.2662 diff --git a/src/test/Test.SegCtrl.netstandard/App.xaml.cs b/src/test/Test.SegCtrl.netstandard/App.xaml.cs index 07d0a15..70fc02f 100644 --- a/src/test/Test.SegCtrl.netstandard/App.xaml.cs +++ b/src/test/Test.SegCtrl.netstandard/App.xaml.cs @@ -1,34 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using Xamarin.Forms; -using Xamarin.Forms; +namespace Test.SegmentedControl; -namespace Test.SegmentedControl +public partial class App : Application { - public partial class App : Application + public App() { - public App() - { - InitializeComponent(); + InitializeComponent(); - MainPage = new Test.SegmentedControl.MainPage(); - } + MainPage = new MainPage(); + } - protected override void OnStart() - { - // Handle when your app starts - } + protected override void OnStart() + { + // Handle when your app starts + } - protected override void OnSleep() - { - // Handle when your app sleeps - } + protected override void OnSleep() + { + // Handle when your app sleeps + } - protected override void OnResume() - { - // Handle when your app resumes - } + protected override void OnResume() + { + // Handle when your app resumes } } diff --git a/src/test/Test.SegCtrl.netstandard/MainPage.xaml.cs b/src/test/Test.SegCtrl.netstandard/MainPage.xaml.cs index f5c463e..e02a698 100644 --- a/src/test/Test.SegCtrl.netstandard/MainPage.xaml.cs +++ b/src/test/Test.SegCtrl.netstandard/MainPage.xaml.cs @@ -4,151 +4,149 @@ using Test.SegCtrl; using Xamarin.Forms; -namespace Test.SegmentedControl +namespace Test.SegmentedControl; + +public partial class MainPage : ContentPage { - public partial class MainPage : ContentPage + private readonly MainViewModel _viewModel; + + public MainPage() { - private readonly MainViewModel _viewModel; + InitializeComponent(); - public MainPage() - { - InitializeComponent(); + BindingContext = _viewModel = new MainViewModel(); + } - BindingContext = _viewModel = new MainViewModel(); - } + private void Button_OnClicked(object sender, EventArgs e) + { + SegmentWithStack.Children.Remove(SegmentedControl); + } - private void Button_OnClicked(object sender, EventArgs e) - { - SegmentWithStack.Children.Remove(SegmentedControl); - } + private void ButtonTintColor_OnClicked(object sender, EventArgs e) + { + SegmentedControl.TintColor = Color.Aqua; + } - private void ButtonTintColor_OnClicked(object sender, EventArgs e) - { - SegmentedControl.TintColor = Color.Aqua; - } + private void ButtonSelectedTextColor_OnClicked(object sender, EventArgs e) + { + SegmentedControl.SelectedTextColor = Color.Red; + } - private void ButtonSelectedTextColor_OnClicked(object sender, EventArgs e) - { - SegmentedControl.SelectedTextColor = Color.Red; - } + private void ButtonBorderColor_OnClicked(object sender, EventArgs e) + { + SegmentedControl.BorderColor = Color.Crimson; + } - private void ButtonBorderColor_OnClicked(object sender, EventArgs e) - { - SegmentedControl.BorderColor = Color.Crimson; - } + private void ButtonBorderWidth_OnClicked(object sender, EventArgs e) + { + SegmentedControl.BorderWidth = (SegmentedControl.BorderWidth + 1) % 3; + } - private void ButtonBorderWidth_OnClicked(object sender, EventArgs e) - { - SegmentedControl.BorderWidth = (SegmentedControl.BorderWidth + 1) % 3; - } + private void ButtonBackgroundColor_OnClicked(object sender, EventArgs e) + { + SegmentedControl.BackgroundColor = Color.HotPink; + } - private void ButtonBackgroundColor_OnClicked(object sender, EventArgs e) - { - SegmentedControl.BackgroundColor = Color.HotPink; - } + private void Disable_OnClicked(object sender, EventArgs e) + { + SegmentedControl.IsEnabled = false; + } - private void Disable_OnClicked(object sender, EventArgs e) - { - SegmentedControl.IsEnabled = false; - } + private void Enable_OnClicked(object sender, EventArgs e) + { + SegmentedControl.IsEnabled = true; + } - private void Enable_OnClicked(object sender, EventArgs e) - { - SegmentedControl.IsEnabled = true; - } + private void ChangeDisabledColor_OnClicked(object sender, EventArgs e) + { + SegmentedControl.DisabledColor = Color.Brown; + } - private void ChangeDisabledColor_OnClicked(object sender, EventArgs e) - { - SegmentedControl.DisabledColor = Color.Brown; - } + private void SelectSegment3(object sender, EventArgs e) + { + _viewModel.SelectedSegment = 2; + } - private void SelectSegment3(object sender, EventArgs e) - { - _viewModel.SelectedSegment = 2; - } + private void ChangeFirstText(object sender, EventArgs e) + { + const string boundText = "Item 1B"; + _viewModel.ChangeText = _viewModel.ChangeText == boundText ? "Item1" : boundText; + } - private void ChangeFirstText(object sender, EventArgs e) - { - const string boundText = "Item 1B"; - _viewModel.ChangeText = _viewModel.ChangeText == boundText ? "Item1" : boundText; - } + public void DisableFirstSegment_OnClicked(object sender, EventArgs e) + { + SegmentedControl.Children[0].IsEnabled = false; + } - public void DisableFirstSegment_OnClicked(object sender, EventArgs e) - { - SegmentedControl.Children[0].IsEnabled = false; - } + public void EnableFirstSegment_OnClicked(object sender, EventArgs e) + { + SegmentedControl.Children[0].IsEnabled = true; + } - public void EnableFirstSegment_OnClicked(object sender, EventArgs e) + public void OnElementChildrenChanging(object sender, ElementChildrenChanging e) + { + if (e.OldValues != null && e.OldValues.Count > 0) { - SegmentedControl.Children[0].IsEnabled = true; + e.OldValues[0].RemoveBinding(SegmentedControlOption.TextProperty); } - - public void OnElementChildrenChanging(object sender, ElementChildrenChanging e) + if (e.NewValues != null && e.NewValues.Count > 0) { - if (e.OldValues != null && e.OldValues.Count > 0) - { - e.OldValues[0].RemoveBinding(SegmentedControlOption.TextProperty); - } - if (e.NewValues != null && e.NewValues.Count > 0) - { - e.NewValues[0].SetBinding(SegmentedControlOption.TextProperty, nameof(_viewModel.ChangeText)); - } + e.NewValues[0].SetBinding(SegmentedControlOption.TextProperty, nameof(_viewModel.ChangeText)); } + } - public void ChangeTextSize_OnClicked(object sender, EventArgs e) - { - SegmentedControl.FontSize = SegmentedControl.FontSize < 20 ? 20 : 12; - } + public void ChangeTextSize_OnClicked(object sender, EventArgs e) + { + SegmentedControl.FontSize = SegmentedControl.FontSize < 20 ? 20 : 12; + } - public void ChangeFontFamily_OnClicked(object sender, EventArgs e) + public void ChangeFontFamily_OnClicked(object sender, EventArgs e) + { + switch (Device.RuntimePlatform) { - switch (Device.RuntimePlatform) - { - case Device.Android: - SegmentedControl.FontFamily = SegmentedControl.FontFamily == "monospace" ? "serif" : "monospace"; - break; - - case Device.iOS: - case Device.macOS: - SegmentedControl.FontFamily = SegmentedControl.FontFamily == "Baskerville" ? "HelveticaNeue" : "Baskerville"; - break; - - case Device.UWP: - SegmentedControl.FontFamily = SegmentedControl.FontFamily == "Courier New" ? "Microsoft Sans Serif" : "Courier New"; - break; - - } - } + case Device.Android: + SegmentedControl.FontFamily = SegmentedControl.FontFamily == "monospace" ? "serif" : "monospace"; + break; - public void SecondPage_OnClicked(object sender, EventArgs e) - { - var newPage = new NavigationPage(new SegCtrl.netstandard.SecondPage()); - Application.Current.MainPage = newPage; - } + case Device.iOS: + case Device.macOS: + SegmentedControl.FontFamily = SegmentedControl.FontFamily == "Baskerville" ? "HelveticaNeue" : "Baskerville"; + break; + + case Device.UWP: + SegmentedControl.FontFamily = SegmentedControl.FontFamily == "Courier New" ? "Microsoft Sans Serif" : "Courier New"; + break; - private void ThirdPage_OnClicked(object sender, EventArgs e) - { - var newPage = new NavigationPage(new SegCtrl.netstandard.ThirdPage()); - Application.Current.MainPage = newPage; } + } + public void SecondPage_OnClicked(object sender, EventArgs e) + { + var newPage = new NavigationPage(new SegCtrl.netstandard.SecondPage()); + Application.Current.MainPage = newPage; + } - private bool _isTextColorChanged; - private Color _defaultTextColor; + private void ThirdPage_OnClicked(object sender, EventArgs e) + { + var newPage = new NavigationPage(new SegCtrl.netstandard.ThirdPage()); + Application.Current.MainPage = newPage; + } - private void Button_TextColor(object sender, EventArgs e) + private bool _isTextColorChanged; + private Color _defaultTextColor; + + private void Button_TextColor(object sender, EventArgs e) + { + if (!_isTextColorChanged) + { + _defaultTextColor = SegmentedControl.TextColor; + SegmentedControl.TextColor = Color.Chocolate; + _isTextColorChanged = true; + } + else { - if (!_isTextColorChanged) - { - _defaultTextColor = SegmentedControl.TextColor; - SegmentedControl.TextColor = Color.Chocolate; - _isTextColorChanged = true; - } - else - { - _isTextColorChanged = false; - SegmentedControl.TextColor = _defaultTextColor; - } + _isTextColorChanged = false; + SegmentedControl.TextColor = _defaultTextColor; } } } diff --git a/src/test/Test.SegCtrl.netstandard/MainViewModel.cs b/src/test/Test.SegCtrl.netstandard/MainViewModel.cs index 2b909b4..e384194 100644 --- a/src/test/Test.SegCtrl.netstandard/MainViewModel.cs +++ b/src/test/Test.SegCtrl.netstandard/MainViewModel.cs @@ -1,110 +1,112 @@ -using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Input; using Plugin.Segmented.Control; using Xamarin.Forms; -namespace Test.SegCtrl +namespace Test.SegCtrl; + +public class MainViewModel : INotifyPropertyChanged { - public class MainViewModel : INotifyPropertyChanged + private readonly SegmentedControlOption[] _list1 = [ + new() {Text="Test0"}, + new() {Text="Test1"}, + new() {Text="Test2"} + ]; + + internal SegmentedControlOption[] List2 = [ + new() {Text="Item1"}, + new() {Text="Item2"}, + new() {Text="Item3"}, + new() {Text="Item4"}, + new() {Text="Item5"} + ]; + + private readonly string[] _stringSet1 = ["TestZ", "TestY"]; + private readonly string[] _stringSet2 = ["TestA", "TestB", "TestC", "TestD"]; + + public MainViewModel() { - private readonly SegmentedControlOption[] _list1 = { - new SegmentedControlOption{Text="Test0"}, - new SegmentedControlOption{Text="Test1"}, - new SegmentedControlOption{Text="Test2"} - }; - - internal SegmentedControlOption[] List2 = { - new SegmentedControlOption{Text="Item1"}, - new SegmentedControlOption{Text="Item2"}, - new SegmentedControlOption{Text="Item3"}, - new SegmentedControlOption{Text="Item4"}, - new SegmentedControlOption{Text="Item5"} - }; - - readonly string[] _stringSet1 = { "TestZ", "TestY" }; - readonly string[] _stringSet2 = { "TestA", "TestB", "TestC", "TestD" }; - - public MainViewModel() - { - ChoiceText = "Start"; - ChangeText = "Item 1B"; - SegmentItemsSource = new List(_list1); - ChangeItemsSourceCommand = new Command(OnChangeItemsSource); - SegmentStringSource = new List(_stringSet1); - SegmentChangedCommand = new Command(OnSegmentChanged); - } + ChoiceText = "Start"; + ChangeText = "Item 1B"; + SegmentItemsSource = [.. _list1]; + ChangeItemsSourceCommand = new Command(OnChangeItemsSource); + SegmentStringSource = [.. _stringSet1]; + SegmentChangedCommand = new Command(OnSegmentChanged); + } - int changedCount; - private void OnSegmentChanged(object obj) - { - changedCount++; - } + private int _changedCount; + + /// How many times SegmentChangedCommand has run; handy to watch in the debugger. + public int SegmentChangedCount => _changedCount; - private void OnChangeItemsSource(object obj) - { - //SegmentItemsSource[0].RemoveBinding(SegmentedControlOption.TextProperty); - //SegmentItemsSource = SegmentItemsSource.Count == list1.Length ? new List(list2) : new List(list1); - //SegmentItemsSource[0].SetBinding(SegmentedControlOption.TextProperty, nameof(ChangeText)); - SegmentStringSource = SegmentStringSource.Count == _stringSet1.Length ? new List(_stringSet2) : new List(_stringSet1); - } + private void OnSegmentChanged(object obj) + { + _changedCount++; + } - //private double _changeFontsize; + private void OnChangeItemsSource(object obj) + { + //SegmentItemsSource[0].RemoveBinding(SegmentedControlOption.TextProperty); + //SegmentItemsSource = SegmentItemsSource.Count == list1.Length ? new List(list2) : new List(list1); + //SegmentItemsSource[0].SetBinding(SegmentedControlOption.TextProperty, nameof(ChangeText)); + SegmentStringSource = SegmentStringSource.Count == _stringSet1.Length ? [.. _stringSet2] : [.. _stringSet1]; + } - //public double ChangeFontSize - //{ - // get => _changeFontsize; - // set { _changeFontsize = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ChangeFontSize))); } - //} + //private double _changeFontsize; - private string _changeText; - public string ChangeText - { - get => _changeText; - set { _changeText = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ChangeText))); } - } - - private int _selectedSegment; - public int SelectedSegment - { - get => _selectedSegment; - set - { - _selectedSegment = value; - OnPropertyChanged(new PropertyChangedEventArgs(nameof(SelectedSegment))); - ChoiceText = value.ToString(); - } - } - private IList _segmentItemsSource; - public IList SegmentItemsSource - { - get => _segmentItemsSource; - set { _segmentItemsSource = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(SegmentItemsSource))); } - } + //public double ChangeFontSize + //{ + // get => _changeFontsize; + // set { _changeFontsize = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ChangeFontSize))); } + //} - private IList _segmentStringSource; - public IList SegmentStringSource - { - get => _segmentStringSource; - set { _segmentStringSource = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(SegmentStringSource))); } + private string _changeText; + public string ChangeText + { + get => _changeText; + set { _changeText = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ChangeText))); } + } + + private int _selectedSegment; + public int SelectedSegment + { + get => _selectedSegment; + set + { + _selectedSegment = value; + OnPropertyChanged(new PropertyChangedEventArgs(nameof(SelectedSegment))); + ChoiceText = value.ToString(); } + } + private IList _segmentItemsSource; + public IList SegmentItemsSource + { + get => _segmentItemsSource; + set { _segmentItemsSource = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(SegmentItemsSource))); } + } - private string _choiceText; - public string ChoiceText - { - get => _choiceText; - set { _choiceText = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ChoiceText))); } - } + private IList _segmentStringSource; + public IList SegmentStringSource + { + get => _segmentStringSource; + set { _segmentStringSource = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(SegmentStringSource))); } + } - public ICommand ChangeItemsSourceCommand { get; } + private string _choiceText; + public string ChoiceText + { + get => _choiceText; + set { _choiceText = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ChoiceText))); } + } - public ICommand SegmentChangedCommand { get; } + public ICommand ChangeItemsSourceCommand { get; } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) - { - PropertyChanged?.Invoke(this, e); - } + public ICommand SegmentChangedCommand { get; } + + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) + { + PropertyChanged?.Invoke(this, e); } -} \ No newline at end of file +} diff --git a/src/test/Test.SegCtrl.netstandard/SecondPage.xaml.cs b/src/test/Test.SegCtrl.netstandard/SecondPage.xaml.cs index ddfd805..4269929 100644 --- a/src/test/Test.SegCtrl.netstandard/SecondPage.xaml.cs +++ b/src/test/Test.SegCtrl.netstandard/SecondPage.xaml.cs @@ -1,26 +1,24 @@ using System; -using System.Collections.Generic; using Xamarin.Forms; -namespace Test.SegCtrl.netstandard +namespace Test.SegCtrl.netstandard; + +public partial class SecondPage : ContentPage { - public partial class SecondPage : ContentPage + public SecondPage() { - public SecondPage() - { - InitializeComponent(); - } + InitializeComponent(); + } - private void Button_Clicked(object sender, EventArgs e) - { - var newPage = new NavigationPage(new SegmentedControl.MainPage()); - Application.Current.MainPage = newPage; - } + private void Button_Clicked(object sender, EventArgs e) + { + var newPage = new NavigationPage(new SegmentedControl.MainPage()); + Application.Current.MainPage = newPage; + } - private void Seg_OnSegmentSelected(object sender, Plugin.Segmented.Event.SegmentSelectEventArgs e) - { - selectedItem.Text = seg.Children[e.NewValue].Text; - } + private void Seg_OnSegmentSelected(object sender, Plugin.Segmented.Event.SegmentSelectEventArgs e) + { + selectedItem.Text = seg.Children[e.NewValue].Text; } } diff --git a/src/test/Test.SegCtrl.netstandard/Test.SegCtrl.netstandard.csproj b/src/test/Test.SegCtrl.netstandard/Test.SegCtrl.netstandard.csproj index 2debde7..a77f567 100644 --- a/src/test/Test.SegCtrl.netstandard/Test.SegCtrl.netstandard.csproj +++ b/src/test/Test.SegCtrl.netstandard/Test.SegCtrl.netstandard.csproj @@ -2,23 +2,24 @@ netstandard2.0 - $(PackageTargetFallback);dotnet5.6;portable-net45+win8;net45 - Debug;Release;DebugNAtive + Debug;Release;DebugNAtive + + $(NoWarn);CS1591 - + - - - ThirdPage.xaml - + + + ThirdPage.xaml + diff --git a/src/test/Test.SegCtrl.netstandard/ThirdPage.xaml.cs b/src/test/Test.SegCtrl.netstandard/ThirdPage.xaml.cs index d5d1fb5..9cd2298 100644 --- a/src/test/Test.SegCtrl.netstandard/ThirdPage.xaml.cs +++ b/src/test/Test.SegCtrl.netstandard/ThirdPage.xaml.cs @@ -1,66 +1,64 @@ -using System.Threading.Tasks; -using System.ComponentModel; -using System; +using System; using System.Collections.Generic; +using System.ComponentModel; +using System.Threading.Tasks; using Xamarin.Forms; -namespace Test.SegCtrl.netstandard +namespace Test.SegCtrl.netstandard; + +public partial class ThirdPage : ContentPage { - public partial class ThirdPage : ContentPage + public ThirdPage() { - public ThirdPage() - { - InitializeComponent(); - BindingContext = new ThirdPageViewModel(); - } - - private void Button_Clicked(object sender, EventArgs e) - { - var newPage = new NavigationPage(new SegmentedControl.MainPage()); - Application.Current.MainPage = newPage; - } + InitializeComponent(); + BindingContext = new ThirdPageViewModel(); } - public class ThirdPageViewModel + private void Button_Clicked(object sender, EventArgs e) { - public List Items { get; } - public Item TheSelectedItem {get; set;} + var newPage = new NavigationPage(new SegmentedControl.MainPage()); + Application.Current.MainPage = newPage; + } +} - public ThirdPageViewModel() - { - //Test TextPropertyName - Items = new List - { - new Item {TheValue = "Item 1"}, - new Item {TheValue = "Item 2"}, - new Item {TheValue = "Item 3"}, - }; +public class ThirdPageViewModel +{ + public List Items { get; } + public Item TheSelectedItem { get; set; } - TheSelectedItem = Items[1]; - - //Test property changed - Task.Delay(2000).ContinueWith(t => - { - Items[0].TheValue = "New Item 1!!"; - }, TaskScheduler.FromCurrentSynchronizationContext()); - } + public ThirdPageViewModel() + { + //Test TextPropertyName + Items = + [ + new Item {TheValue = "Item 1"}, + new Item {TheValue = "Item 2"}, + new Item {TheValue = "Item 3"}, + ]; + TheSelectedItem = Items[1]; - public class Item : INotifyPropertyChanged + //Test property changed + Task.Delay(2000).ContinueWith(t => { - private string theValue; + Items[0].TheValue = "New Item 1!!"; + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + public class Item : INotifyPropertyChanged + { + private string _theValue; - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public string TheValue + public string TheValue + { + get => _theValue; + set { - get => theValue; - set - { - theValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TheValue))); - } + _theValue = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TheValue))); } } } -} \ No newline at end of file +}