|
using System;
using System.Collections.Generic;
using System.Text;
namespace MvpExample
{
public class LogonService : ILogonService
{
private INotify mNotifier;
public LogonService()
{
// instead of having it as null
mNotifier = new EmptyNotify();
}
public LogonService(INotify notifier)
{
mNotifier = notifier;
}
public bool Logon(string userName, string password)
{
// simulate a long operation, wait 3 seconds.
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));
bool rc;
if ((userName == "mike") && (password == "aop"))
{
mNotifier.Notify("Logon Successful");
rc = true;
}
else
{
mNotifier.Notify("Invliad User or Password");
rc = false;
}
return rc;
}
public INotify Notifier
{
set { mNotifier = value; }
get { return mNotifier; }
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am currently working as a team leader with a group of amazing .NET programmers. I love coding with .NET, and I love to apply design patterns into my work. Lately I had some free time, so I decided to write some articles, hoping I will spare someone frustration and anxiety.