The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Extensibility?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Avery

Posts: 1206
Nickname: james615
Registered: Sep, 2003

James Avery is a .NET pimp
Extensibility? Posted: Aug 25, 2004 8:04 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by James Avery.
Original Post: Extensibility?
Feed Title: .Avery Blog
Feed URL: /blog/Install/BlogNotConfiguredError.aspx
Feed Description: .NET and everything nice
Latest .NET Buzz Posts
Latest .NET Buzz Posts by James Avery
Latest Posts From .Avery Blog

Advertisement

Let's say you want to change the list of regular expressions normally displayed in the RegexTypeEditor, is this code a good sign? (Reflector is good)

private object[] get_CannedExpressions(){
object[] objArray1;
if (RegexEditorDialog.cannedExpressions == null)
{
objArray1 = new object[15];
objArray1[0] = SR.GetString("RegexCanned_Custom");
objArray1[1] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_SocialSecurity"), @"\d{3}-\d{2}-\d{4}");
objArray1[2] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_USPhone"), @"((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}");
objArray1[3] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_Zip"), @"\d{5}(-\d{4})?");
objArray1[4] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_Email"), @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
objArray1[5] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_URL"), @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?");
objArray1[6] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_FrZip"), @"\d{5}");
objArray1[7] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_FrPhone"), @"(0( \d|\d ))?\d\d \d\d(\d \d| \d\d )\d\d");
objArray1[8] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_DeZip"), @"(D-)?\d{5}");
objArray1[9] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_DePhone"), @"((\(0\d\d\) |(\(0\d{3}\) )?\d )?\d\d \d\d \d\d|\(0\d{4}\) \d \d\d-\d\d?)");
objArray1[10] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_JpnZip"), @"\d{3}(-(\d{4}|\d{2}))?");
objArray1[11] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_JpnPhone"), @"(0\d{1,4}-|\(0\d{1,4}\) ?)?\d{1,4}-\d{4}");
objArray1[12] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_PrcZip"), @"\d{6}");
objArray1[13] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_PrcPhone"), @"(\(\d{3}\)|\d{3}-)?\d{8}");
objArray1[14] = new RegexEditorDialog.CannedExpression(SR.GetString("RegexCanned_PrcSocialSecurity"), @"\d{18}|\d{15}");
RegexEditorDialog.cannedExpressions = objArray1;
}      
return RegexEditorDialog.cannedExpressions;}

Basically you would have to create a new Type Editor which inherits from this one, then create a new control which inherits from the RegexValidator and then add an attribute targeting your new type editor. Obviously not built with extension in mind, unless I am missing something.

-James

Read: Extensibility?

Topic: Wes Haggard discusses the new iterators in C# 2.0 Previous Topic   Next Topic Topic: Tomorrow is DBA day, and .Net rocks is back on my mind

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use