summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OpenId.RelyingParty.UI
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.OpenId.RelyingParty.UI')
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/ComponentModel/IdentifierConverter.cs69
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj5
2 files changed, 74 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/ComponentModel/IdentifierConverter.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/ComponentModel/IdentifierConverter.cs
new file mode 100644
index 0000000..61c0fd8
--- /dev/null
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/ComponentModel/IdentifierConverter.cs
@@ -0,0 +1,69 @@
+//-----------------------------------------------------------------------
+// <copyright file="IdentifierConverter.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.ComponentModel {
+ using System;
+ using System.Collections;
+ using System.ComponentModel.Design.Serialization;
+ using System.Reflection;
+ using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.RelyingParty;
+
+ /// <summary>
+ /// A design-time helper to give an OpenID Identifier property an auto-complete functionality
+ /// listing the OP Identifiers in the <see cref="WellKnownProviders"/> class.
+ /// </summary>
+ public class IdentifierConverter : ConverterBase<Identifier> {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="IdentifierConverter"/> class.
+ /// </summary>
+ [Obsolete("This class is meant for design-time use within an IDE, and not meant to be used directly by runtime code.")]
+ public IdentifierConverter() {
+ }
+
+ /// <summary>
+ /// Converts a value from its string representation to its strongly-typed object.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns>The strongly-typed object.</returns>
+ protected override Identifier ConvertFrom(string value) {
+ return value;
+ }
+
+ /// <summary>
+ /// Creates the reflection instructions for recreating an instance later.
+ /// </summary>
+ /// <param name="value">The value to recreate later.</param>
+ /// <returns>
+ /// The description of how to recreate an instance.
+ /// </returns>
+ protected override InstanceDescriptor CreateFrom(Identifier value) {
+ if (value == null) {
+ return null;
+ }
+
+ MemberInfo identifierParse = typeof(Identifier).GetMethod("Parse", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(string) }, null);
+ return CreateInstanceDescriptor(identifierParse, new object[] { value.ToString() });
+ }
+
+ /// <summary>
+ /// Converts the strongly-typed value to a string.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>The string representation of the object.</returns>
+ protected override string ConvertToString(Identifier value) {
+ return value;
+ }
+
+ /// <summary>
+ /// Gets the standard values to suggest with Intellisense in the designer.
+ /// </summary>
+ /// <returns>A collection of the standard values.</returns>
+ protected override ICollection GetStandardValuesForCache() {
+ return SuggestedStringsConverter.GetStandardValuesForCacheShared(typeof(WellKnownProviders));
+ }
+ }
+}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj
index 76c68c0..46c8b95 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj
@@ -20,6 +20,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
<ItemGroup>
+ <Compile Include="ComponentModel\IdentifierConverter.cs" />
<Compile Include="OpenId\Mvc\OpenIdAjaxOptions.cs" />
<Compile Include="OpenId\Mvc\OpenIdHelper.cs" />
<Compile Include="OpenId\RelyingParty\OpenIdAjaxRelyingParty.cs" />
@@ -40,6 +41,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\DotNetOpenAuth.Messaging.UI\DotNetOpenAuth.Messaging.UI.csproj">
+ <Project>{173E7B8D-E751-46E2-A133-F72297C0D2F4}</Project>
+ <Name>DotNetOpenAuth.Messaging.UI</Name>
+ </ProjectReference>
<ProjectReference Include="..\DotNetOpenAuth.Messaging\DotNetOpenAuth.Messaging.csproj">
<Project>{60426312-6AE5-4835-8667-37EDEA670222}</Project>
<Name>DotNetOpenAuth.Messaging</Name>