December 2008


 

UGI Alt.net conf

Hi, I will share and give my support to the next UGIALT.net event, I hope I could be there, but however you find in my Events page details about events I support or I will partecipate to.

This kind of event is one the best suitable for developers who shares the “ALT philosophy”, I invite you to go the the site (go to link above) and to see the detailed agenda. unfortunately the link, the material and the event all is in Italian..

Ciao!

Tags:

Advertisements

Recently I’m doing some study on some WPF code, I fall in an interesting example from Microsoft called Outlook HOL WPF, which basically shows how to do an Outlook UI WPF replica, I found many posts about that but each with the same problem, where is the source code?? The missing..

So, after some Googlin’ I found it!! Here I whish to share with you the Outlook HOL WPF link I hope someone will find interesting as I do!

I found starting from an  MSDN Forum post, as the post describes, the last in the thead, you can download a zip file WPF.zip and insied you will the things: Code, Presentations and more!

Enjoy, Ciao!

Tags:

Hi,

recently I was doing some code about enum parsing, I think  an operation everyone’s involved in one time. After some Googlin’ I found some well or not well done examples. Doing a generic parse method is too simple as you can see on Windows.NET Blog post but you don’t have no type check code or constraints, or something about a default check value, so I done my implementation, which assumes that the target enum type has some well defined constraints like: inheriting from the struct base type,  having an Undefined or a None element.. if not the first enum member is assumed as the default one. Here is my little code

/// <summary> /// Translates from a string name enum member /// to the given gene ric enumeration Type /// </summary> /// <param name="name">the name string to translate</param> /// <returns></returns> private T TranslateFrom<T>(string name) where T : struct { const string DEFAULT = "Undefined"; const string NONE = "None"; Type enumType = typeof(T); T result; if (Enum.IsDefined(enumType, command)) { result = (T)Enum.Parse(enumType, command, true); } else { string defaultName = null; if (Enum.IsDefined(enumType, DEFAULT)) defaultName = DEFAULT; else if (Enum.IsDefined(enumType, NONE)) defaultName = NONE; if (!string.IsNullOrEmpty(defaultName)) { result = (T)Enum.Parse(enumType, command, true); } else { string[] values = Enum.GetNames(enumType); result = (T)Enum.Parse(enumType, values[0], true); } } return result; }

This is just a little helper method I wish to share, enjoy!

Ciao

Tags: