구상되는 기본틀은 모두 Template를 이용하고, Template에서 이용되는 method들을 따로 객체화 시킨다.
namespace TemplatePattern
{
public abstract class SYNCmailBasePannel
{
public abstract void LoadPannel();
public abstract void MoveNextPannel();
public abstract void MovePreviousPannel();
public void ArrangeSubControls()
{
//NOTE : arrange sub controls
}
public void PaintPanel()
{
//NOTE : paint panel
}
}
#region Using Strategy Pattern
public interface ILoginService
{
bool Login(string logonName, string password);
}
public interface IChangeDisplayName
{
bool ChangeDisplayName(string displayName);
}
public class SYNCmailLoginService : ILoginService
{
#region ILoginService Members
public bool Login(string logonName, string password)
{
throw new NotImplementedException();
}
#endregion
}
public class SYNCmailChangeDisplayNamer : IChangeDisplayName
{
#region IChangeDisplayName Members
public bool ChangeDisplayName(string displayName)
{
throw new NotImplementedException();
}
#endregion
}
#endregion
public class SYNCmailDisplayPannel : SYNCmailBasePannel
{
public IChangeDisplayName iChangeDisplayName;
public override void LoadPannel()
{
throw new NotImplementedException();
}
public override void MoveNextPannel()
{
iChangeDisplayName.ChangeDisplayName("newDisplayName");
}
public override void MovePreviousPannel()
{
throw new NotImplementedException();
}
}
public class SYNCmailLoginPannel : SYNCmailBasePannel
{
public ILoginService iLoginService;
public override void LoadPannel()
{
//TODO : GET Login information
}
public override void MoveNextPannel()
{
//TODO :
// 1. Connection SYNCmail API
// 2. Check Login Informations
if ( iLoginService.Login("logonName", "password") )
{
//NOTE : Move Next Pannel
}
}
public override void MovePreviousPannel()
{
//TODO :
// Move previous Pannel
}
}
}