📄 mainwindow.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using CallCenter.BusinessInterfaces.MainForms;
using System.Reflection;
using CallCenter.BusinessLayer;
using CallCenter.DALFactory;
using CallCenter.IDAL;
using CallCenter.Modules;
using CallCenter.OracleDAL;
using System.Data;
using System.IO;
using CallCenter.BusinessInterfaces.BaseForms;
namespace CallCenter.BusinessInterfaces.MainForms
{
/// <summary>
/// MainWindow 的摘要说明。
/// mdi主窗体是用来展现用应程序的容器,
/// 功能说明:本窗体分为菜单栏,工具条,树形条,来电窗口,tab工作区,状态栏构成
/// 此部分采取动态生成菜单项,树形条,tab工作区,主要由用户权限来控制菜单项,树形条,tab工作区的显示
/// 编写人:赵维
/// 编写时间:2006-5-20
/// 修改人:赵维
/// 修改时间:2006-6-2
///
/// </summary>
public class MainWindow : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBar sbr_SysStatus;
private string login_name;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
private AxUSE_AgentBar32.AxUSE_AgentBar axUSE_AgentBar1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private DevExpress.XtraNavBar.NavBarControl navBarControl1;
private System.Windows.Forms.StatusBarPanel statusBarPanel3;
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.TabControl tabControl1;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.MenuItem menuItem2;
private int ipage=0;
private System.Windows.Forms.Button button1;
private CallCenter.BusinessInterfaces.BaseForms.TelCallingControl telCallingControl1;
private static UserControl _telcall=null;
public static UserControl telcall
{
get
{
return _telcall;
}
set
{
_telcall=value;
}
}
public MainWindow()
{
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainWindow));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.sbr_SysStatus = new System.Windows.Forms.StatusBar();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel3 = new System.Windows.Forms.StatusBarPanel();
this.axUSE_AgentBar1 = new AxUSE_AgentBar32.AxUSE_AgentBar();
this.panel1 = new System.Windows.Forms.Panel();
this.navBarControl1 = new DevExpress.XtraNavBar.NavBarControl();
this.panel2 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.telCallingControl1 = new CallCenter.BusinessInterfaces.BaseForms.TelCallingControl();
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.panel3 = new System.Windows.Forms.Panel();
this.tabControl1 = new System.Windows.Forms.TabControl();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.axUSE_AgentBar1)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.navBarControl1)).BeginInit();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.SuspendLayout();
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// sbr_SysStatus
//
this.sbr_SysStatus.Location = new System.Drawing.Point(0, 553);
this.sbr_SysStatus.Name = "sbr_SysStatus";
this.sbr_SysStatus.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel1,
this.statusBarPanel2,
this.statusBarPanel3});
this.sbr_SysStatus.ShowPanels = true;
this.sbr_SysStatus.Size = new System.Drawing.Size(804, 32);
this.sbr_SysStatus.TabIndex = 3;
this.sbr_SysStatus.TabStop = true;
this.sbr_SysStatus.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.sbr_SysStatus_PanelClick);
//
// statusBarPanel1
//
this.statusBarPanel1.Text = "statusBarPanel1";
this.statusBarPanel1.Width = 400;
//
// statusBarPanel2
//
this.statusBarPanel2.MinWidth = 20;
this.statusBarPanel2.Text = "statusBarPanel2";
this.statusBarPanel2.Width = 400;
//
// statusBarPanel3
//
this.statusBarPanel3.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.statusBarPanel3.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.Raised;
this.statusBarPanel3.Text = "地图显示";
//
// axUSE_AgentBar1
//
this.axUSE_AgentBar1.Dock = System.Windows.Forms.DockStyle.Top;
this.axUSE_AgentBar1.Enabled = true;
this.axUSE_AgentBar1.Location = new System.Drawing.Point(0, 0);
this.axUSE_AgentBar1.Name = "axUSE_AgentBar1";
this.axUSE_AgentBar1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axUSE_AgentBar1.OcxState")));
this.axUSE_AgentBar1.Size = new System.Drawing.Size(804, 54);
this.axUSE_AgentBar1.TabIndex = 9;
//
// panel1
//
this.panel1.Controls.Add(this.navBarControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 54);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(152, 499);
this.panel1.TabIndex = 10;
//
// navBarControl1
//
this.navBarControl1.ActiveGroup = null;
this.navBarControl1.AllowDrop = true;
this.navBarControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.navBarControl1.LargeImages = this.imageList1;
this.navBarControl1.Location = new System.Drawing.Point(0, 0);
this.navBarControl1.Name = "navBarControl1";
this.navBarControl1.Size = new System.Drawing.Size(152, 499);
this.navBarControl1.SmallImages = this.imageList1;
this.navBarControl1.TabIndex = 22;
this.navBarControl1.Text = "navBarControl1";
//
// panel2
//
this.panel2.BackColor = System.Drawing.SystemColors.Desktop;
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.button1);
this.panel2.Controls.Add(this.telCallingControl1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(152, 54);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(652, 114);
this.panel2.TabIndex = 12;
//
// button1
//
this.button1.BackColor = System.Drawing.SystemColors.Menu;
this.button1.Location = new System.Drawing.Point(192, 64);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// telCallingControl1
//
this.telCallingControl1.AutoScroll = true;
this.telCallingControl1.BackColor = System.Drawing.SystemColors.Menu;
this.telCallingControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.telCallingControl1.Location = new System.Drawing.Point(0, 0);
this.telCallingControl1.Name = "telCallingControl1";
this.telCallingControl1.Size = new System.Drawing.Size(650, 112);
this.telCallingControl1.TabIndex = 2;
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "关闭选项卡";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.Text = "关闭全部选项卡";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click_1);
//
// panel3
//
this.panel3.Controls.Add(this.tabControl1);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(152, 168);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(652, 385);
this.panel3.TabIndex = 16;
//
// tabControl1
//
this.tabControl1.ContextMenu = this.contextMenu1;
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(652, 385);
this.tabControl1.TabIndex = 0;
//
// MainWindow
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(804, 585);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.sbr_SysStatus);
this.Controls.Add(this.axUSE_AgentBar1);
this.IsMdiContainer = true;
this.Menu = this.mainMenu1;
this.Name = "MainWindow";
this.Text = "社区服务呼叫中心系统";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Closing += new System.ComponentModel.CancelEventHandler(this.MainWindow_Closing);
this.Load += new System.EventHandler(this.MainWindow_Load);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.axUSE_AgentBar1)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.navBarControl1)).EndInit();
this.panel2.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void MainWindow_Load(object sender, System.EventArgs e)
{
this.sbr_SysStatus.Panels[0].Text="当前用户:"+ShareClass.Operator;
this.sbr_SysStatus.Panels[1].Text="登录时间:"+ShareClass.LoginDate;
login_name=ShareClass.Operator;
SysoperatorBLL sysbll=new SysoperatorBLL();
SysoperatorInfo sysinfo=new SysoperatorInfo();
sysinfo=sysbll.getSysoperatorByLname(login_name);
int i=0;
int j=0;
int img=0;
int item=0;
MenuItem mitem=new MenuItem();
SysMenuBLL sysmenu=new SysMenuBLL();
DataSet ds=new DataSet();
DataTable dt=new DataTable();
DataColumn dc=new DataColumn();
try
{
ds=sysmenu.getSysmenu();
dt=ds.Tables["sysmenu"];
dc=dt.Columns["mname"];
foreach(DataRow dr in dt.Rows)
{
if(dr[dt.Columns["pid"]].ToString()=="" || dr[dt.Columns["pid"]]==null)
{
if(sysinfo.omenuid.IndexOf(dr[dt.Columns["id"]].ToString())!=-1)
{
this.mainMenu1.MenuItems.Add(dr[dc].ToString());
mitem=this.mainMenu1.MenuItems[i];
this.navBarControl1.Groups.Add();
this.navBarControl1.Groups[j].Caption=dr[dc].ToString();
this.navBarControl1.Groups[j].Expanded=true;
}
else
{
continue;
}
}
string strexp="pid="+dr[dt.Columns["id"]];
string strord="ordernum asc";
DataRow[] funrow=ds.Tables["sysmenu"].Select(strexp,strord);
foreach(DataRow drc in funrow)
{
// MessageBox.Show(drc[dt.Columns["id"]].ToString());
if(sysinfo.omenuid.IndexOf(drc[dt.Columns["id"]].ToString())!=-1)
{
mitem.MenuItems.Add(drc[dc].ToString(),new EventHandler(Mnu_NewMenuItem_Click));
if(drc[dt.Columns["toolbar"]].ToString()=="0")
{
this.navBarControl1.Groups[j].AddItem();
this.navBarControl1.Items[item].Caption=drc[dc].ToString();
this.navBarControl1.Items[item].Tag=drc[dt.Columns["mname"]].ToString();
this.navBarControl1.Items[item].LinkClicked+=new DevExpress.XtraNavBar.NavBarLinkEventHandler(MainWindow_LinkClicked);
// this.toolBar1.Buttons[j].ToolTipText=drc[dt.Columns["mname"]].ToString();
string imgpath=Application.StartupPath+"\\ico\\"+drc[dt.Columns["imagename"]].ToString();
// MessageBox.Show(Application.StartupPath+"\\ico\\"+drc[dt.Columns["imagename"]].ToString());
if(File.Exists(imgpath))
{
this.imageList1.Images.Add(System.Drawing.Image.FromFile(imgpath));
this.navBarControl1.Items[item].LargeImageIndex=img;
}
item++;
img++;
}
}
else
{
continue;
}
}
i++;
j++;
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
MenuManage mm=new MenuManage();
mm.Show();
}
private void Menu_Click(object sender, EventArgs e)
{
string path="CallCenter.BusinessInterfaces";
string classname=path+".MainForms.UserManage";
Assembly assembly=Assembly.Load(path);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -