frmFashionMain.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace LYFZ.Software.UI
  10. {
  11. public partial class frmFashionMain : LYFZ.ComponentLibrary.BaseShadowForm,LYFZ.StandardInterface.IToolMenuClick,LYFZ.StandardInterface.IMenuClick
  12. {
  13. /// <summary>
  14. /// 当前显示的子窗体
  15. /// </summary>
  16. LYFZ.ComponentLibrary.BaseContentsFormMain thisChildForm = null;
  17. LYFZ.BLL.BLL_SystemToolsMenu bllToolsMenu = new BLL.BLL_SystemToolsMenu(false);
  18. public frmFashionMain()
  19. {
  20. this.WindowState = FormWindowState.Maximized;
  21. InitializeComponent();
  22. DynamicMenu.SetToolsChatListControl(toolsChatListControl1);
  23. this.IsUserControlsSize = true;
  24. this.IsFullScreen = true;
  25. // LYFZ.Model.Model_SystemToolsMenu.DefaultWelcomeForm dfWelcomeForm = bllToolsMenu.GetDefaultWelcomeForm();
  26. // ShowChildForm(dfWelcomeForm.ClassFullName, dfWelcomeForm.DllFileKey);
  27. if (DynamicMenu.IsToosClickOpen)
  28. {
  29. this.toolsChatListControl1.ClickSubItem += new ComponentLibrary.ChatListControl.ChatListBox.ChatListEventHandler(toolsChatListControl1_ClickSubItem);
  30. }
  31. else
  32. {
  33. this.toolsChatListControl1.DoubleClickSubItem += new ComponentLibrary.ChatListControl.ChatListBox.ChatListEventHandler(toolsChatListControl1_DoubleClickSubItem);
  34. }
  35. }
  36. /// <summary>
  37. /// 又击时设置窗体大小状态
  38. /// </summary>
  39. /// <param name="sender"></param>
  40. /// <param name="e"></param>
  41. protected virtual void frm_MouseDoubleClick(object sender, MouseEventArgs e)
  42. {
  43. this.SetWindowState();
  44. }
  45. /// <summary>
  46. /// 移动窗体
  47. /// </summary>
  48. /// <param name="sender"></param>
  49. /// <param name="e"></param>
  50. void frm_MouseDown(object sender, MouseEventArgs e)
  51. {
  52. if (e.Clicks == 1)
  53. LYFZ.WinAPI.Win32.FormMobile(this.Handle);
  54. }
  55. /// <summary>
  56. /// 在工作区显示子窗体
  57. /// </summary>
  58. /// <param name="classFullName">要显示的子窗体类名</param>
  59. public void ShowChildForm(string classFullName, string dllKey)
  60. {
  61. if (LYFZ.BLL.BLL_ErpUser.WhetherTimesOut)
  62. {
  63. this.splExFashionMainPanel.Panel2.Enabled = false;
  64. ShowLogin();
  65. ShowChildForm(classFullName, dllKey);
  66. }
  67. else
  68. {
  69. this.splExFashionMainPanel.Panel2.Enabled = true;
  70. thisChildForm = DynamicMenu.ShowEmbeddedFashionChildForm(classFullName, this.splExFashionMainPanel.Panel2.Controls, dllKey);
  71. thisChildForm.iMenuClick = this;
  72. thisChildForm.MouseDown += new System.Windows.Forms.MouseEventHandler(frm_MouseDown);
  73. thisChildForm.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(frm_MouseDoubleClick);
  74. thisChildForm.RefreshSystemMeun();
  75. }
  76. if (this.WindowState != FormWindowState.Maximized)
  77. {
  78. this.WindowState = FormWindowState.Maximized;
  79. }
  80. }
  81. /// <summary>
  82. /// 设置窗体状态
  83. /// </summary>
  84. /// <param name="wState"></param>
  85. public void SetWindowState(System.Windows.Forms.FormWindowState wState)
  86. {
  87. if (this.WindowState != wState)
  88. {
  89. this.WindowState = wState;
  90. }
  91. }
  92. bool isSwitchForms = false;
  93. /// <summary>
  94. /// 是否为切换窗体时关闭
  95. /// </summary>
  96. public bool IsSwitchForms
  97. {
  98. get { return isSwitchForms; }
  99. set { isSwitchForms = value; }
  100. }
  101. /// <summary>
  102. /// 显示登录窗体
  103. /// </summary>
  104. public virtual void ShowLogin(Form subfrm = null)
  105. {
  106. }
  107. /// <summary>
  108. /// 获取窗体名
  109. /// </summary>
  110. public string FormName
  111. {
  112. get { return this.Name; }
  113. }
  114. /// <summary>
  115. /// 关闭窗体。
  116. /// </summary>
  117. public void CloseForm()
  118. {
  119. this.isSwitchForms = true;
  120. this.Close();
  121. }
  122. /// <summary>
  123. /// 退出程序
  124. /// </summary>
  125. public virtual void ExitApplication()
  126. {
  127. }
  128. /// <summary>
  129. /// 刷新工具栏按钮
  130. /// </summary>
  131. public void RefreshTools()
  132. {
  133. this.toolsChatListControl1.RefreshTools();
  134. }
  135. /// <summary>
  136. /// 在本窗体中显示指定窗体
  137. /// </summary>
  138. /// <param name="classFullName">指定窗体的类的完全名称</param>
  139. /// <param name="dllKey">指定窗体类所在的dll Key</param>
  140. /// <param name="openMode">窗体显示方式</param>
  141. public void ShowForm(string classFullName, string dllKey, string openMode)
  142. {
  143. LYFZ.Model.Model_SystemToolsMenu.Item item = new Model.Model_SystemToolsMenu.Item();
  144. item.KeyName = "indexFrmFash";
  145. item.DllFileKey = dllKey;
  146. item.OpenMode = openMode;
  147. item.ClassFullName = classFullName;
  148. DynamicMenu.ToolsClickProcessingMethod(item, this);
  149. }
  150. #region 菜单按钮单击事件
  151. /// <summary>
  152. /// 设置菜单项单击事
  153. /// </summary>
  154. /// <param name="menuItem"></param>
  155. public void SetIMenuItem_Click(ToolStripMenuItem menuItem)
  156. {
  157. //请实现功能
  158. LYFZ.Model.Model_SystemToolsMenu.Item item = (LYFZ.Model.Model_SystemToolsMenu.Item)menuItem.Tag;
  159. if (!item.IsChildMenu && item.ClassFullName != "" && item.ClassFullName.ToLower() != "null")
  160. menuItem.Click += new EventHandler(FrmFashionMainMenuItem_Click);
  161. }
  162. /// <summary>
  163. /// 时尚窗体系统菜单项单击事件
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. public virtual void FrmFashionMainMenuItem_Click(object sender, EventArgs e)
  168. {
  169. DynamicMenu.MenuItemClickProcessingMethod(sender, e, this);
  170. }
  171. #endregion
  172. protected virtual void toolsChatListControl1_DoubleClickSubItem(object sender, ComponentLibrary.ChatListControl.ChatListEventArgs e)
  173. {
  174. LYFZ.ComponentLibrary.ChatListControl.ChatListSubItem selectSubItem = e.SelectSubItem;
  175. if (selectSubItem.Status != LYFZ.ComponentLibrary.ChatListControl.ChatListSubItem.UserStatus.OffLine)
  176. DynamicMenu.ToolsClickProcessingMethod(selectSubItem.Tag, this);
  177. }
  178. protected virtual void toolsChatListControl1_ClickSubItem(object sender, ComponentLibrary.ChatListControl.ChatListEventArgs e)
  179. {
  180. LYFZ.ComponentLibrary.ChatListControl.ChatListSubItem selectSubItem = e.SelectSubItem;
  181. if (selectSubItem.Status != LYFZ.ComponentLibrary.ChatListControl.ChatListSubItem.UserStatus.OffLine)
  182. DynamicMenu.ToolsClickProcessingMethod(selectSubItem.Tag, this);
  183. }
  184. }
  185. }