您的位置:首页 > 移动开发

Application应用框架思考(一)

2009-04-09 20:08 246 查看
Application应用框架思考(一)

/// <summary>
/// 应用程序的框架管理类
/// </summary>
public interface IApplication : IServiceContainer
{
/// <summary>
/// //数据访问服务层
/// </summary>
DataAccessLayerBaseClass DataLayer { get; }

/// <summary>
/// //用户登陆服务
/// </summary>
IUserLogin UserLoginService { get; }

/// <summary>
/// 主框架窗体接口
/// </summary>
IMainApp MainApp { get; set; }

}

public interface IUserLogin
{
/// <summary>
/// 用户名
/// read only
/// </summary>
string UserName { get; }

/// <summary>
/// 密码
/// read only
/// </summary>
string Pwd { get; }

/// <summary>
/// 已登陆=true
/// read only
/// </summary>
bool Logined { get; }

/// <summary>
/// 隐藏用户登陆窗体
/// </summary>
void HideUserLoginUI();

/// <summary>
/// 显示用户登陆窗体
/// </summary>
void ShowDialogUserLoginUI();

/// <summary>
/// 显示用户登陆窗体
/// </summary>
/// <param name="ower"></param>
void ShowDialogUserLoginUI(IWin32Window ower);

/// <summary>
/// //权限列表
/// </summary>
List<string> UserLoginedLimitList { get; }

/// <summary>
/// //为用户授权_菜单级授权
/// </summary>
void GrantforUser();

/// <summary>
/// 注销用户
/// </summary>
/// <param name="UserName"></param>
/// <returns></returns>
bool LogoutUserName(string UserName);

}

/// <summary>
/// 主框架窗体接口 定义   (主界面控制元素接口)定位目标
/// </summary>
public interface IMainApp
{
/// <summary>
/// //退出系统
/// </summary>
void ExitSystem();

/// <summary>
/// //主框架窗体
/// </summary>
Form AppMainForm { get; }

/// <summary>
/// 获取或设置应用程序名称
/// </summary>
string ApplicationName { get; set; }

/// <summary>
/// 主框架资料管理类
/// </summary>
ComponentResourceManager AppMainResource { get; }

/// <summary>
/// 主框架状态栏接口
/// </summary>
IMainFrameWorkStateBar AppMainFrameWorkStateBar { get; }
}

/// <summary>
/// 应用系统状态栏 接口
/// </summary>
public interface IMainFrameWorkStateBar
{
/// <summary>
/// 获取或设置 状态栏显示 比例尺
/// </summary>
ToolStripStatusLabel MapScale { get; set; }
/// <summary>
/// 获取或设置 状态栏显示 x,y坐标
/// </summary>
ToolStripStatusLabel MapXY { get; set; }

/// <summary>
/// 获取或设置 状态栏显示 相关信息
/// </summary>
ToolStripStatusLabel MapInformation { get; set; }

/// <summary>
/// 获取或设置 窗体宽度
/// </summary>
int FormWidth { get; set; }

/// <summary>
/// 执行重定义状态栏的尺寸大小方法
/// </summary>
void execReSize();
}

/// <summary>
/// 应用系统状态栏
/// </summary>
public class ManagementSystemStateBar : IMainFrameWorkStateBar
{

#region IMainFrameWorkStateBar 成员

private ToolStripStatusLabel m_MapScale = null;
public ToolStripStatusLabel MapScale
{
get
{
return m_MapScale;
}
set
{
m_MapScale = value;
}
}

private ToolStripStatusLabel m_MapXY = null;
public ToolStripStatusLabel MapXY
{
get
{
return m_MapXY;
}
set
{
m_MapXY = value;
}
}

private ToolStripStatusLabel m_MapInformation = null;
public ToolStripStatusLabel MapInformation
{
get
{
return m_MapInformation;
}
set
{
m_MapInformation = value;
}
}

public virtual void execReSize()
{
#region 实现细节
int winwidth = this.FormWidth;
try
{
int subWidth = (int)winwidth / 3;

if (this.MapXY != null)
{
this.MapXY.Width = subWidth;
this.MapXY.Alignment = ToolStripItemAlignment.Left;
}

if (this.MapScale != null)
{
this.MapScale.Width = subWidth;
this.MapScale.Alignment = ToolStripItemAlignment.Left;
}

if (this.MapInformation != null)
{
this.MapInformation.Width = subWidth;
this.MapInformation.Alignment = ToolStripItemAlignment.Left;
}

}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
finally
{
}
#endregion
}

private int m_FormWidth = -1;
public int FormWidth
{
get
{
return m_FormWidth;
}
set
{
m_FormWidth = value;
}
}

#endregion
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息