private void switchPage(PageType pageType) { try { Dictionary <Label, string> dicOnePage = null; Label showPageLabel = null; string imgName = string.Empty; dicAllPage.TryGetValue(pageType, out dicOnePage); foreach (var item in dicOnePage) { showPageLabel = item.Key; imgName = item.Value; break;//只有一个 } Hover_Leave(showPageLabel, imgName, PageLabelEffect.MouseDown); #region 一定要在画面效果显示后才能保存选中的画面信息(先清理) dicCurrentPage.Clear(); dicCurrentPage.Add(showPageLabel, imgName); #endregion //"d"十进制整数 Control_welcome.SetForm(int.Parse(Enum.Format(pageType.GetType(), pageType, "d"))); showOnePage(pageType); } catch (Exception ex) { ShowMsgHelper.ShowError("画面切换出错:" + ex.Message); } }
/// <summary> /// 二次登陆系统判断上一次停留程序路径 /// </summary> /// <param name="DEmpID">登陆账号ID</param> protected void FormPath(string DEmpID) { try { Control_welcome we = new Control_welcome(); Control_welcome.DEmployeeID = Convert.ToInt32(DEmployeeID); Control_welcome.Logname = EmpName; DataSet ds = dbHelp.GetPIVAsDB("select * from PivasMateFormSet where DEmployeeID='" + DEmpID + "'"); bool noShowWelcome = true; //默认显示 PageType pageNo = PageType.Check; //默认是页面 if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { noShowWelcome = bool.Parse(ds.Tables[0].Rows[0]["Welcome"].ToString()); int iStartForm = Convert.ToInt32(ds.Tables[0].Rows[0]["StartForm"].ToString().Trim()); if (iStartForm > 0 && iStartForm < 8)//在PageType枚举范围内 { pageNo = (PageType)iStartForm; } } if (!noShowWelcome)//若显示,则添加 { panelContent.Controls.Add(we); we.Size = panelContent.Size; } switchPage(pageNo); } catch (Exception ex) { ShowMsgHelper.ShowError("登录后设置欢迎页面和上次页面出错:" + ex.Message); } }