We've moved our blog!

by Administrator 15. March 2012 10:40

 

Please visit our new blog at http://www.Global-webnet.com/Blog

Tags:

Creating .CHM help files within a few minutes using Sand Castle Help File Builder (from HTML pages)

by Administrator 14. January 2012 20:06

Source code used to capture screenshots is available at http://SolrContrib.Codeplex.com Change Set 95363

  1. Download Sandcastle.msi from http://sandcastle.codeplex.com/releases/view/47665
  2. Download Sandcastle Help File Builder http://shfb.codeplex.com/
  3. Launch SHFB and add a Site Map (menu)
    • Right click Documentation
    • Click Add
    • Click New Item

4. Right click on "Documentation Sources" and add your assembly, i.e., I selected MetroIoc.Desktop.dll

What took me a surprisingly long time to figure out (because it is so simple when you know and the documentation can be overwhelming) is how to add an image to my html pages!!

In the end it is quite simple, set the BuildAction to Content (I set ExcludeFromToc to True) and your done!!

You can click the build button and you'll have a documentation.chm in the Help folder when it is completed. 

 

 

Unity Support for Metro Style Applications

by Administrator 12. January 2012 03:54

Unity Support is not currently available - I added a feature request on the Microsoft site so if you would like to see a Microsoft supported IOC package for Metro please vote => http://unity.codeplex.com/discussions/285894 

In the meantime if like me you require an IOC package, now I'm going to use http://metroioc.codeplex.com/ for my http://SolrContrib.CodePlex.com project - looks promising.

 

METRO / Portable Class Library => Could not load file or assembly 'System.Core, Version=2.0.5.0

by Administrator 8. January 2012 10:52

I was pleasantly surprised to find the Portable Class Library project in Visual Studio 2011, this meant I could at least keep my ported Unity Container in my Metro application.  All looked good until I went to compile...
My first reaction was to believe that the Portable Class Library was not supported by the WinRt, but research showed that it was. In fact I could create a blank project, create a simple class, and reference it - so this had me scratching my head as to why I was getting this error.

In researching the "Could not load file or assembly...." error, I found that others that have received this error contributed the cause to other issues/errors, it was more or less a catch-all error message. Armed with that I created a Metro project (Gwn.Library.Unity.Metro) and copied all of the files from the Gwn.Library.Unity.Portable project into it.

The following is the result of the compile - I must admit I was surprised; it appears that the Portable Class Library is no longer the least common denominator in multi-targeted applications - the WinRt is.

The System.Type has been trimmed down quite a bit, the missing components moved into TypeInfo.   My Unity port is no longer usable under Metro even though it compiles under the Portable Class Library so its use, at this stage, is a risk - we'll see what happens with the next release of Metro 

SolrContrib - new beginnings as a Metro Style application

by Administrator 7. January 2012 17:31

Why I am starting over (again)? Click here to find out!

I scraped all of my "classic desktop" libraries and am starting over by building a new infrastructure for Metro style applications.  Where BDUF (Big Design Up Front) is discouraged in the agile environment there are times and places where UML can really save you a lot of time.  One of them is in the initial creation of your solution's projects and namespaces, the following is the end result of many iterations of renames, changes and updates - fortunately they were only done in the UML explorer so it was no major task; when the smoke settled I created the projects as applicable.

Legend 

Green ... Metro application and projects
Gray ..... ASP.NET MVC4 (Desktop) application and projects
Blue ..... Portable Class Library
Yellow .. Data

Patterns

The projects to the left of the red vertical line are platform specific.  The SolrContrib, Metro style application, UI projects will utilize the MVP-VM pattern and the GwnWeb, ASP.NET MVC4, application will use MVC.

Multi Targeted Application

SolrContrib is a Multi Targeted application, the actual source files will reside in the desktop projects and the metro style projects will link to them.  The challenge was to maximize reuse, provide a clear separation of concerns, and reduce dependencies while trying to keep the number of projects as small as possible.

Platform Considerations

I found that Unit Test projects cannot add references to Metro projects, since we are a Multi Targeted application this is of little concern because all of our source will reside in the Desktop projects (the Metro projects will link to them).   This was a factor in the initial design because I needed to ensure that TDD could be performed against all business logic (which will reside in the .bll projects).

Since the Windows Phone is not yet supported in the Visual Studio 2011 developer preview this is unknown territory however I will keep it in mind by putting as much code as possible within the Portable Class Library project (Gwn.Library.Portable).  

Click on image to view full-size UC0000.png file

The Classic Windows Desktop is dead, long live the Windows Desktop!

by Administrator 18. December 2011 15:24

I remember years ago going to a Visual FoxPro conference and throughout the entire conference they spoke only of this new thing called .NET.   I saw the warning signs and even though VB.NET would have been the natural path from Visual FoxPro I saw additional warning signs, i.e., most of the new projects coming from the P&P teams were in C# - not VB.NET, that clearly told me that "it is time to move on using C#".  Two years later I was a MCAD in C#.NET and within a few more years was shocked to witness Visual Basic get pushed off the cliff; I never saw this coming and it sent a clear message "OBSERVE THE WARNING SIGNS".   A few years later there were more warnings signs about a new UI they called WPF so I abandoned WinForms and continued on my path following the "Microsoft Yellow Brick Road".

So I have to ask the question - how have I read the warning signs so far?

Today I checked in code and UML (Use Case and Sequence Diagrams) for my http://SolrContrib.Codeplex.com project which was so very, very close to finally being "the platform" that would be used for all applications that I would use for development from this point forward - it would support Desktop, Silverlight, ASP.NET MVC and Phone.  This is a feat I have been trying to accomplish since July of 2007 when I started the http://SDMS.CodePlex.com open source project and came real close on my http://PasswordMgr.CodePlex.com project (I actually got to release this) before its future started unraveling like all of the projects before it because the framework(s) became obsolete before they even had a chance to mature.  

Periodically I start doing my rounds for software updates (seemed appropriate as I was so close to being done with the framework) and I saw that Unity had a release for 3.0 and it was geared for Windows 8 - so I did a little research which eventually had me end up at the following link.

Future directions for C# and Visual Basic

So that you don't have to imagine the look on my face as I watched the video clip, I'll give you a picture:

I saw the warning signs once again - more pronounced then ever before, my http://SolrContrib.Codeplex.com infrastructure in all of its glory was now obsolete.  I saw as much attention applied to the "Classic Windows Desktop" of Windows 8 as I did WinForms after WPF came out - absolutely none; everything was about Metro and Roslyn CTP.

Not that I wasn't impressed!  I'm just as impressed as I was when I saw .NET and WPF for the first time - coolest thing since Apple Pie and as always I'm jumping on that band-wagon as soon as the holidays are over (January 2012), I'll be rolling up my sleeves and preparing my brain to be wiped (like all of my code) so that I can start all over (again).  

The question I have to ask myself is "will the new framework that I will create using Metro be obsolete before it is finished", I think we all know the answer...  But on the brighter side - it never gets boring and you can't lose by staying on the "Microsoft Yellow Brick Road"!!!

 

Tags:

Handling button clicks using MVPVM and Event Aggregation

by Administrator 17. December 2011 10:57

There are many ways button clicks can be handled with WPF.  My preference is to minimize the amount of time spent having to wire up my buttons so that I can focus on the required business logic.   By allowing the framework to handle button clicks I can also provide a consistent means for handling them, i.e., for the http://SolrContrib.CodePlex.com project you merely have to look to the Presenter's OnCommandExecute() method for any button click within the application.

All I am required to do is create the button as shown in the following SecurityView.xaml code and place my code in the corresponding Presenter, in this case the SecurityPresenter:

I can get away with this because my solutions Resource\Gwn.Resource.xxxx (where xxxx is Desktop or Silverlight) has the following declaration for TargetType Button:


Note: both the Desktop and Silverlight applications are sharing the same file (not linked) [read more]:

Note above on line 4 that we bind our command to the ViewModel's EventAggregatorCommand - this command is in the ViewModelBase (available to all view models) and is wired up as shown below in lines 69 thru 104:

With the above noted wire-up in the ViewModelBase all applicable buttons will publish an event for both CanExecute and Execute - the ViewModelBase packages up the applicable payload information and raises a system ProcessEvent.

In the image above we see where the PresenterBase subscribes to the ProcessEvent (lines 85/86) - when a ProcessEvent is raised it will be handled by EventAggregatorSet (which really should be called ProcessEventHandler so I'll be refactoring this...).   Based on the type of event, ModulesLoaded or EventAggregatorCommand it will call the applicable process.   In the case of our EventAggregatorCommand it will call OnCommandEvent() shown below:

The above process handles more than just button Execute and CanExecute - note that on lines 152-155 that we are determining if a particular view should be visible (each presenter listens for button events and will set itself visible/collapse as applicable).

Since the base will only allow Presenters to handle their own ViewModel events, and XAML will not permit us to have two controls with the same name, we can safely use the button name within a switch statement to handle the button click as shown below: 

Examining the image above we can see that within a few minutes work all I am required to do is create my view, go to the presenter and apply the business logic without any additional work for the wire up of button click events; I can focus on business requirements.

Notes on software architecture - there are no experts

by Administrator 17. December 2011 07:04

"There have been many different ways to organize the code for a rich client system. Here I discuss a selection of those that I feel have been the most influential and introduce how they relate to the patterns" - Martin Fowler, GUI Architectures 18 Jul 06

The thing I respect most about Martin Fowler is that he never suggests that there is only one way to do things right (which implies that all other ways are wrong).   My position through my development career as architect, manager, lead, and grunt coder is that "if it gets the job done - then it is right".   Developers have varying levels of experience and sometimes the most inexperienced developer may have the best idea on how a particular task can be done better.

There can be no single right way because unlike any other industry in the world, ours is truly an agile one where six months from now everything we know can become obsolete.   New operating systems, languages and tools are constantly emerging and to complicate matters they are so extensible we have so many different parts that we can integrate/choose from, i.e., dependency injection tools, data storage, frameworks, etc.  

There was a time when the constant change overwhelmed me, I'd always be telling my wife "I am falling behind" even though she would watch me spend hours/days/years trying to keep up; it was like walking up an escalator that was going down faster than I was walking up.   It didn't get better until I read the article "keeping sane in wake of technology's pace" - it was exactly how I was feeling!!  Like Rocky I decided to embrace the change.  I accepted the fact that it will never stand still long enough for me to become an expert and that this was okay...

Patterns such as MVPVM and MVVM along with tools such as Prism, Unity, etc. are available tools within software architecture.  We should not attempt to put any particular process into a box, i.e., we should not say MVPVM or MVVM should be used for WPF development or Prism event aggregation and navigation should be done a particular way.   Once we start doing this then every other way will be wrong and prevent the emergence of new ideas.  For a team to be truly successful it needs to be tolerant of new ideas, even if from the greenest/newest developers.  Ideas should be evaluated by the team for its ability to get the job done and not whether or not it fits neatly within defined boxes.

For the reasons noted I don't turn on blog comments (for debates, criticism or praise), I'm merely offering available architectural tools and patterns that can be used to meet enterprise application development.   I strive to solve problems encountered and provide fully-functional solutions for "a way" to solve them.  I must admit this has been the most challenging task because, since the very beginning, my solutions have become obsolete before the framework I was using had a chance to mature - forcing me to constantly start over (reference http://SDMS.CodePlex.com, http://PasswordMgr.CodePlex.com and now http://SolrContrib.CodePlex.com).   So many times I enrolled as a front-runner only to abandon it because when new technology comes out I have to start over again, otherwise I risk my project being obsolete by the time it is released.   

Today I question whether C# .NET will have a place in the future and seriously doubt the future of Silverlight and Silverlight for Windows Phone (which are the basis of the referenced password manager project).   I continue forward with SolrContrib project with caution, investing only enough time in the framework to get it done, as I can see the warning signs and really need to commit 2012 to mastering the Metro development environment for Windows 8.

I will continue to share my efforts, not as an expert or authoritative source, but as a fellow developer that has found "a way" to solve problems encountered.  If you have a more efficient way to achieve something I have done, that others may learn from me inefficiently, by all means please let me know!

Visual Studio 2011 / Windows 8 - StackFrame GetFileLineNumber() returns 0

by Administrator 17. December 2011 05:18

I wanted to add line number support to logging for my http://SolrContrib.CodePlex.com project (developing on Visual Studio 2011 / Windows 8 developer preview) and found it was not available.

In researching the topic I found this is not necessarily specific to VS2011 but according to Scott Hanselman (following link) it should be working so that was good enough for me to report it as a bug.
http://www.hanselman.com/blog/SairamasInterestingCodeOfTheDayPrintingLineNumbersWhileDebuggingC.aspx
 

 

LINK: https://connect.microsoft.com/VisualStudio/feedback/details/714453/stackframe-getfilelinenumber-returns-0-in-debug

Tags:

Visual Studio 2011: WPF button clicks are slow (1-2 second delay)

by Administrator 22. November 2011 20:14

When executing my Multi Targeted, Solr Contrib WPF Desktop application there is a considerable delay from the time the button is clicked to the time the event is raised.   If you observe the behavior closely you can see that the button remains depressed (layout) for a second or two and once it is released the event fires.  This behavior does not occur with the Silverlight version which uses the same exact code/xaml.  

This behavior is specific to DEBUG mode.   If you launch the WPF desktop application in release mode (Ctrl-F5) you will get expected behavior.  A workaround (that I provide in the following Microsoft bug report) is to launch in release mode and then attach a debugger to your running application.

If you are experiencing this issue please click on the following link and vote for the fix:

https://connect.microsoft.com/VisualStudio/feedback/details/705650/wpf-button-clicks-in-vs-11-are-slow-when-running-in-vs#