CAB & SCSF [SmartParts] Pt. 2

Actually Writing some Code!

  • So now that there is the basic structure of the application setup I started delving into the code.  The first thing I glanced and decided to straighten out was the fact that left and right workspace along with some other Constants where still declared in the Infrastructure.Interface Project under the Constants folder in the WorkspaceNames.cs file.  I removed everything and just left the following:

    public class WorkspaceNames

    {

        public const string LayoutWorkspace = "LayoutWorkspace";

    }

  • Some other code I went ahead and removed was located in the ModuleController.cs file.  Any code that is related to the tool strip I removed from the Run() Method and deleted the method dedicated to adding items to the tool strip.
  • The first files to dig into are the ModuleController.cs and WorkspaceNames.cs file located in the Constants application directory.  I opened those up for the following code surgery.
  • In addition to those two files I also created another file to store the constants that will be used for the various Views.  I placed this file in the Constants directory and names it simply Views.cs.
  • To the Views.cs file I added the following constant declarations:

    public class Views

    {

        public const string TripDestinations = "TripDestinations";

        public const string TripManagement = "TripManagement";

        public const string TripPurpose = "TripPurpose";

        public const string TripTypes = "TripTypes";

    }

  • To the WorkspaceNames.cs file I added the single constant:

    /// <summary>

    /// Constants for workspace names.

    /// </summary>

    public class WorkspaceNames : TravelTrackerSmartClient.Infrastructure.Interface.Constants.WorkspaceNames

    {

        public const string TripTabWorkspace = "TripTabWorkSpace";

    }

  • In the ModuleController.cs file I added the following code.  To read more about setting up Views read the documentation link that is commented out in this AddViews() method.  (Unless the Microsoft Team has removed it in current distributions)

        private void AddViews()

        {

            WorkItem.Items.AddNew<TripDestinations>(Constants.Views.TripDestinations);

            WorkItem.Items.AddNew<TripManagement>(Constants.Views.TripManagement);

            WorkItem.Items.AddNew<TripPurpose>(Constants.Views.TripPurpose);

            WorkItem.Items.AddNew<TripTypes>(Constants.Views.TripTypes);

        }

  • Once all of this is complete I now have an application that actually starts, loads the TravelTracker Project and on Run() adds each of the SmartPart Views into the WorkItem Items collection.  With this in place I can now wire up each of the specific event publications and subscriptions that will allow me to have each SmartPart displayed when a particular menu item is selected (or Tab Part).
  • To start wiring up the Subscription and Publications make a reference in the ModuleController:

using Microsoft.Practices.CompositeUI.EventBroker;

  • After adding that place some methods for the event subscriptions in the ModuleController.cs file and the respective event topic names to the constants file EventTopicNames.cs.

EventTopicNames.cs 

    public class EventTopicNames : TravelTrackerSmartClient.Infrastructure.Interface.Constants.EventTopicNames

    {

        public const string TripDestinationsClicked_Event = "TripDestinationsClicked_Event";

        public const string TripManagementClicked_Event = "TripManagementClicked_Event";

        public const string TripPurposeClicked_Event = "TripPurposeClicked_Event";

        public const string TripTypesClicked_Event = "TripTypesClicked_Event";

    }

ModuleController.cs

        [EventSubscription(Constants.EventTopicNames.TripDestinationsClicked_Event, ThreadOption.UserInterface)

        public void TripDestinationsClicked_Handler(object sender, EventArgs e)

        {}

 

        [EventSubscription(Constants.EventTopicNames.TripManagementClicked_Event, ThreadOption.UserInterface)

        public void TripManagementClicked_Handler(object sender, EventArgs e)

        {}

 

        [EventSubscription(Constants.EventTopicNames.TripPurposeClicked_Event, ThreadOption.UserInterface)

        public void TripPurposeClicked_Handler(object sender, EventArgs e)

        {}

 

        [EventSubscription(Constants.EventTopicNames.TripTypesClicked_Event, ThreadOption.UserInterface)

        public void TripTypesClicked_Handler(object sender, EventArgs e)

        {}

  • At this point I actually, for readability, went back and changed in the ShellForm.cs code and events for the menu selections.  Along with that I added the event publications attributes and more.  The code when finished looks like this:

        [EventSubscription(Constants.EventTopicNames.TripDestinationsClicked_Event, ThreadOption.UserInterface)]

        public void TripDestinationsClicked_Handler(object sender, EventArgs e)

        {

            if (!WorkItem.SmartParts.Contains(Constants.Views.TripDestinations))

            {

                WorkItem.SmartParts.AddNew<TripDestinations>(Constants.Views.TripDestinations);

            }

 

            WorkItem.RootWorkItem.Workspaces[Constants.WorkspaceNames.TripTabWorkspace].Show(

                WorkItem.SmartParts.Get<TripDestinations>(Constants.Views.TripDestinations));

        }

 

Well, that's that.  I'm all wired up.  The next step (Part 3, it's coming soon) is to wire up some button pushin data entering GUI Interacing events, buttons, and other such items.  Stay tuned...

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/30/2006 at 6:41 PM
Categories: Centerstance | How-To, Samples, and Such
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Fired, Employed

While in another conversation another statement was brought up that is absolutely true also.  A good employee in the software industry is the one who rides the line between fired and employed.  The reason being is if a software developer isn't pushing the envelope to keep things progressively moving forward in a company they likely aren't putting their full potential into their career.  The whole concept of flying under the radar is not a good place to live, it just puts a person in the direct line of the cutting blade during a downturn.

Where one wants to be in software is always pushing forward, always learning the latest or just learning, always learning more about the business and what the business can do, and never ever letting things become mediocre.  Perfection is the goal and will always keep the software industry working diligently to attain.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/30/2006 at 8:29 AM
Categories: Centerstance
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Developer Thought of the Day

While in conversation with some co-workers a statement was made that made really good sense.  Many, if unaware of this concept should take heed.  The statement went like this, "developers do what they're told, if they're told wrong they will end up doing wrong."  It is a similar statement to what Demming had made about factory workers in relation to quality being introduced at places like Boeing, Ford, GM, and other places.

So the next time a good developer messes something up, think about the premise.  Most likely he was just doing something he was told to do, it was the teller that told them wrong.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/30/2006 at 8:23 AM
Categories: Centerstance
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

CAB & SCSF [SmartParts] Pt. 1

SmartParts.  The coolest (or maybe just the prettiest) part of the View of Model View Presenters (MVP) and Model View Controllers (MVC).  At least in my not so humble opinion.  A SmartPart is generally used to implement what amounts to a Custom User Control in a Windows Application.  Utilizing various controls a SmartPart usually captures a single domain within a business use case.  An example would be a data entry form for entering sales information in a point of sales system or the report criteria screen in the same system.

Below are some of the SmartPart examples I've created for my Travel Tracker Application that I'm working on.  I started with the following standard steps to create an Smart Client Software Factory (SCSF) based Composite UI Application Block (CAB) Application.

Setting up the actual Solution

  • Open Visual Studio and start a new SCSF Project.

  • I named my project Travek Tracker Smart Client and... well you can see that info in the screenshot above.
  • Next I entered the appropriate information for the SCSF Project.  Uncheck both the "Create a seperate module to define the layout for the shell" and the "Show related documentation after running the recipe".

  • Before going forward hit F5 (Run, not just build) and make sure everything builds and the application starts.  It is important that you do this as one little change that alters the build might compile fine, but then it will break the actual application.  This is very cumbersome to troubleshoot after the fact.
  • Once everything loads up I setup a seperate application folder and right click to add a "Business Module" within the structure of the new solution shown below.

 

  •  Once you have all of this finished right click on the Views folder and click on Smart Client > Add View and select a name for the new view as below.

 

  •  Once complete you should have a folder structure like the one below.  Now I'll start digging into the actual Smart Parts that have been created.

  • There are four screens that are going to make up the SmartPart list.  Each screen has some basic control elements that are used in almost every type of application for data entry and manipulation.
  • Per the data model (shown below) I have the four different views.

  • Before getting ahead of myself I went ahead back and setup some basic properties for the Shell Application Project.
  • First setup the Shell so that the Split Pane Control is removed and add a Deck Workspace Control to the application in place of the Split Pane Control.  I then set the application so that the Shell application will launch center of screen and at a resolution of 800x600. I really had to do some messing around to get the Split Panel Control deleted.  The easiest way I found was the undock the control, then shrink it by resizing.  I could then easily right click and select delete.

  • After I removed the Split Panel Control I ran the solution again to see what wouldn't build.  I assumed, rightfully so, that some parts would have code segments somewhere.  Sure enough the _leftWorkspace and _rightWorkspace on lines 44 & 45 of the ShellForm.cs file don't exist anymore, but the code is there so I deleted it.  I ran it again after that and the app popped up just fine.
  • One other good thing to get in the habit of is to set the Localizable property to true.  This will put all of the text and other associated user visible text in a resource file in the project.  It's as simple as adding new language resource files later.
  • I also removed the menu bar, ran the application, and removed any pertinent lines of code for that also.  There are two lines that need removed in the ShellForm.cs and ShellApplication.cs files.
  • After that I added the menu options needed for displaying the various Smart Parts.

  • After adding the menu additions I then added a Tab Workspace Control, removed all of the tabs and named the control accordingly.

  • Again I ran the application to assure the solution would build and start.  A'OK.
  • After that I tidied up the screen, made sure the Tab Workspace Control has all the properties set I wanted, and prepared to wire up some of this contraption to actually display the four Smart Parts I've created.
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/26/2006 at 11:41 AM
Categories: Centerstance | How-To, Samples, and Such
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

SCSF built MVP and MVC Application Breakdown of Tasks

In an MVC or MVP Project the obvious usage reason is to break down tasks among the various aspects of the architect.  In either model view controller or model view presenter there are three specific areas in which tasks need performed.  Depending on team size the breakdowns can occur in various ways.  The example below is one way to break down the tasks.  I hopefully will dredge up some time and list out other scenarios that can be met with this architecture.  This however is the most straight forward and obvious development method usage of MVP and MVC.

Task:  There is a need for a new screen that will contain interfacing to data within the database.  The screen has at least 2-3 buttons and a good number of text boxes, drop downs, and or any other development elements needed.  This screen needs put in place ASAP with validation, logging, and all the plumbing of the pattern that is in use (MVC or MVP).

Team Staff (Medium Size):  Business Analyst, Senior Developer (Patterns Guru), Intermediate or New Developer, and a Database Developer.

  • Model - BA & Senior Developer should work on this element.
  • View - Inter/New Developer.  The view gives the basic overview of business logic and also give a good starting point working with MVC & MVP because any developer knows how to develop a screen.
  • Controller / Presenter - Database Developer should work on this element.  If a database developer works with the dev team in a scenario like this, he inherently should work on the aspects of development that he is most familiar with, thus the aspects that are closest to the data.

Team Staff (Large Size):  Senior Developer (Patterns Guru), 5 Intermediate Developers ranging from straight out of college to 1-2 years of experience.  These silos that each dev group works in after a short period will make this a very fast method to develop new features with.  Only breaking out developers in such a way and allowing actual specialization of labor to occur can one really get the full benifit of this architecture.  So break the groups up, allow some cross training, but primarily focus on specialization if you need speed of development.

  • Model - Senior Developer & 2 Intermediate Developer
  • View - 1 Intermediate Developer
  • Controller / Presenter - 2 Intermediate Developers.

Team Staff (Small Size):  Senior Developer (Patterns Guru), 1 Intermediate Developer.  One could say, "We'll meet in the middle!"

  • Model - Senior Developer 
  • View - Intermediate Developer
  • Controller / Presenter - Senior Developer & Intermediate Developer
kick it on DotNetKicks.com
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/20/2006 at 10:31 AM
Categories: How-To, Samples, and Such
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

.NET 3.0

So if anybody reads any blogs on .NET then ya know 3.0 is out.  3.0 is really nothing more than additional parts tacked onto 2.0.  So with that I wanted to toss a kewl link up that is relative to learning and knowing 3.0 like we all know and love 2.0.

Windows SDK Blog

The Windows SDK Blog is rather cool and recently Karin Meier posted an entry with a whole BUNCH of samples for .NET 3.0.  Specifically...

  • 430 Windows Presentation Foundation samples
  • 140 Windows Communication Foundation samples
  • 60 Windows Workflow Foundation samples
  • 200 New to Vista (Win32/COM-based) samples
  • 23 Cross technology samples

...more links to come.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/15/2006 at 7:06 PM
Categories: IDEs, Software Tools, and Applications
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

CAB Problem and a Simple Fix

So it's annoying and seems to pop up regular while working with SmartParts in CAB/SCSF Apps.

If you get this...

...close the SmartParts and rebuild the solution. All will be well when done.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/14/2006 at 9:29 PM
Categories: IDEs, Software Tools, and Applications
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

CAB, SCSF, MVP, and MVC

So some awesome things have been going on the work front.  The major thing is that I'm finally starting to understand certain patterns in our architecture.  Some of them I understood better than I realized.  Because of odd and not particularly straight forward requirements for usage of the patterns I ended up heading down the wrong path on a few scenarios.  Now that I'm back on road I've been moving forward rapidly with the rest of the team and will prospecively be able to provide more assistance in the near future.

One of the other awesome things is our team now has an insignia and team name.  It's odd, a little strange, and not all that normal for a software development team to have such but it's cool.  Period.

With that I present...

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/3/2006 at 1:08 PM
Categories: Centerstance
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

More Travel Tracker (Pt. 2)

So I setup a basic and quick rendering of the Travel Tracker Application so that I could get some of my initial prospective users to work with the Web Application Version of it.  Post prototype I will get a authenticated roles based version up and running.  One other thing I have decided to do during the creation of this application is to integrate it into the existing Community Server Web Application that I am running for my own website.

The current integration seems to use ASP.NET 2.0 Membership features thus it looks to be an easy integration.  Hopefully I'll have it up for others to play with and test soon!

Here are some screen shots of what I've got working so far.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by: Adron
Posted on: 11/2/2006 at 1:20 PM
Categories: My Projects
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed