Archive for March, 2008

Locus Effects

Thursday, March 20th, 2008

A while ago I stumbled on a very interesting article by Yuval Naveh on CodeProject about Locus Effects

Locus- Latin for "the place."

So our Locus is the place where our conscious/mind is set. It is the state of our mind. The Locus can change if an external event alarms our mind. For example: when we are reading a book, if a rapid ball of fire moves from right to left in the horizon, it is likely to catch our attention. This biological mechanism is built in us for survival. If a dangerous event happens, our mind pays attention to it since it is something that can kill us, harm us etc.

It is obvious that our Locus can be changed. This can be taken into consideration while designing a user interface that requires user’s attention. But usually it is misused or overly used; causing distracted user interfaces that makes us unproductive and tired. Modal forms attract our locus but since they are so repetitive and since they block our work we tend to click OK automatically and close these nags. Locus changes should be done as and when needed with great care and thought. If the locus changes for a brief time, our productivity is not harmed but after that we loose concentration in our previous task. Switching back to the previous task is quite slow and causes productivity problems.

At the time I thought it was a pretty nifty tool but couldn’t really see where I would be able to use it.

I’m currently on-site at a client implementing a Work in progress manufacturing system.Bearing in mind that the users of the system have been using a Unix based system for more than 10 years, it is a rather daunting task to get them onto windows.One of the processes in the system requires a number of steps to be completed, while testing we found that it can get a bit confusing on what to do next. So we decided to put something in place to indicate to the users which steps to follow etc.

At first we thought a simple 1,2,3 list would work, but I weren’t happy with the solution, so I had a look around and tried a few things before I remembered Locus Effects. I am happy to report that it works like a charm, we’ve added a "What Now" button, so whenever the user is lost in the process they can simply click the button, and an arrow will indicate the next step/option available for them. Pretty cool stuff.

Helpdesk for Outlook

Thursday, March 13th, 2008

My company, Coalition Software, has released its latest product. It’s a Helpdesk Add-in for Outlook 2007.

It’s a small tool for use by in-house support teams. The users they support can submit tickets quickly and easily directly from Outlook. It can be run in online as well as offline mode. In online mode the applications and priorities gets read from a SQL server database and in offline mode (when the user has no access to the database) it can submit the ticket via email, with pre set applications and priorities.

We’ve decided to create it as an add-in for Outlook due to the fact that most Outlook users have it open the better part of the day, this way they do not need to switch between different applications or learn any radically new interfaces.

You can download the videos on using it in here.

You’re welcome to let me know what you think and suggestions are always welcome.

CSLA.Net:Step-by-Step – Using the BindingNavigator

Thursday, March 6th, 2008

I was recently asked how to use the BindingNavigator to scroll through a list of objects. It is actually a very simple process, and here’s how:

I’m using the same Northwind BO Library as with the previous posts. We have a Customer object, and the table design looks something like this:

image

Right, next create a new class called Customers. This class will inherit from EditableRootListBase . You can paste the following into the class:

 _
Public Class Customers
Inherits EditableRootListBase(Of Customer)
#Region " Business Methods "
Protected Overrides Function AddNewCore() As Object
Dim item As Customer = Customer.NewCustomer
Add(item)
Return item
End Function
#End Region
#Region " Factory Methods "
Public Shared Function GetList() As Customers
Return DataPortal.Fetch(Of Customers)()
End Function
Private Sub New()
Me.AllowEdit = True
Me.AllowNew = True
Me.AllowRemove = True
End Sub
#End Region
#Region " Data Access "
Private Overloads Sub DataPortal_Fetch()
Me.RaiseListChangedEvents = False
Using sqlconn As New SqlConnection(Database.NorthwindConnection)
sqlconn.Open()
Using cm As SqlCommand = sqlconn.CreateCommand
cm.CommandType = CommandType.Text
cm.CommandText = "SELECT * FROM Customers WITH (NOLOCK)"
Using dr As New SafeDataReader(cm.ExecuteReader())
While dr.Read
Add(Customer.GetCustomer(dr.GetInt32("CustomerID")))
End While
dr.Close()
End Using
End Using
sqlconn.Close()
End Using
Me.RaiseListChangedEvents = True
End Sub
#End Region
End Class 

Compile your project and add a new form. Drag the Customers object from the Data Sources window to your newly created form. It should automatically add a BindingNavigator and a Datagridview to your form. Go ahead and delete the grid.

Next, drag the CustomerTextID, CompanyName, ContactName fields onto your form. Your form should look something like this:

image_3

Select the Save button on the BindingNavigator and set it’s Enabled property to True. Switch to Code view and add the following declaration:

Dim _cust As Customer

Next, add the following code to your form’s Load Event:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CustomersBindingSource.DataSource = Customers.GetList
End Sub 

Now, we need to handle the BindingNavigator’s Save event. You do not need to worry about the AddNew or Delete Events, the business object handles those for you.

Add the following code to the BindingSource’s PositionChanged event:

Private Sub CustomersBindingSource_PositionChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles CustomersBindingSource.PositionChanged
_cust = CType(CustomersBindingSource.Current, Customer)
End Sub 

Finally, add the following to the Save button’s click event:

Private Sub CustomersBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles CustomersBindingNavigatorSaveItem.Click
_cust.ApplyEdit()
_cust.Save(True)
End Sub 

Press F5 and see your handy work, it should look something like this:

image_4 

There you go, a quick and neat way to use the BindingNavigator with CSLA objects. Until next time, keep coding…


Google Analytics integration offered by Wordpress Google Analytics Plugin