public ClientThread() { listenPort = SRLibFun.StringConvertToInt32(SRConfig.Instance.GetAppString("Port")); socketWatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socketWatch.Bind(new IPEndPoint(GetIP(), listenPort)); socketWatch.Listen(10); }
private void PicTool_Click(object sender, EventArgs e) { if ((e as MouseEventArgs).Button == System.Windows.Forms.MouseButtons.Right) { return; } PictureBox pb = sender as PictureBox; if (pb.Name == "p14")//center1KeywordFilter { //查询是否设置filterKeyword var userSettingEnt = DataBase.Instance.tSR_UserSetting.Get_Entity(Param.UserId); if (userSettingEnt == null || string.IsNullOrEmpty(userSettingEnt.DefaultKeyword)) { return; } if (SROperation.Instance.OnlyShow) { p14.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._14_0; } else { p14.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._14_2; pb.MouseLeave -= new EventHandler(toolsIcon_MouseLeave); } } else { string id = pb.Name.Replace("p", ""); if ("4,5,6,7,8".Contains(id)) { p4.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._4_0; p5.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._5_0; p6.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._6_0; p7.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._7_0; p8.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._8_0; pb.MouseLeave -= new EventHandler(toolsIcon_MouseLeave); } pb.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_" + id + "_1") as Image; } if (OnPageToolClicked != null) { if (SROperation2.Instance.PicSelected != null && SROperation2.Instance.PicSelected.Count > 0) { SROperation.Instance.LeftSelectedId = SROperation2.Instance.PicSelected.FirstOrDefault().Pid; } OnPageToolClicked(sender, new ToolEventArgs() { PicIndex = SRLibFun.StringConvertToInt32(pb.Name.Substring(1)) }); //把按钮自身作为参数传递 } }
public Add() { InitializeComponent(); id = SRLibFun.StringConvertToInt32(Param.DPageParameter); List <SR_WordbookEntity> allPurviewEntList = DataBase.Instance.tSR_Wordbook.Get_EntityCollection(null, " Dtype=[$Dtype$] ", new DataParameter("Dtype", "用户权限")); //List<SR_WordbookEntity> myEntList = DataBase.Instance.tSR_Wordbook.Get_EntityCollection(null, " Ordernumber=[$Ordernumber$] and Dtype=[$Dtype$] ", new DataParameter("Ordernumber", id), new DataParameter("Dtype", "my用户权限")); if (allPurviewEntList == null) { allPurviewEntList = new List <SR_WordbookEntity>(); } //if (myEntList == null) myEntList = new List<SR_WordbookEntity>(); //List<SR_WordbookEntity> treeviewEntList = new List<SR_WordbookEntity>(); this.BindData(); }
/// <summary> /// Sets the text for the specified control in multithreading circumstances. /// </summary> /// <param name="control"></param> /// <param name="text"></param> public static void SetTreeNode(TreeView control, TreeNodeCollection val, String strc) { if (control != null) { string[] arrls = strc.Split(new char[] { '|' }); if (control.InvokeRequired) { SetTreeNodeSafe scts = new SetTreeNodeSafe(SetTreeNode); control.Invoke(scts, new Object[] { control, val, strc }); } else { if (String.IsNullOrEmpty(strc) == true) { for (int i = 0; i < val.Count; i++) { control.Nodes.Add(val[i]); } } else { TreeNode pnode = null; Int32 ik = 0; foreach (var item in arrls) { if (ik == 0) { pnode = control.Nodes[SRLibFun.StringConvertToInt32(item)]; } else { pnode = pnode.Nodes[SRLibFun.StringConvertToInt32(item)]; } ik++; } for (int i = 0; i < val.Count; i++) { pnode.Nodes.Add(val[i]); } } control.ExpandAll(); } } }
private void Browser_Load(object sender, EventArgs e) { this.right1.BindData(); //this.right1.OnPageClicked += right1_OnPageClicked; this.right1.OnPageAftered += right1_OnPageAftered; this.center2_11.OnPageClicked += center2_11_OnPageClicked; //双缓存 //base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); //base.SetStyle(ControlStyles.ResizeRedraw | ControlStyles.Selectable, true); //Path|Index if (String.IsNullOrEmpty(Param.DPageParameter) == false) { //1:1显示 String[] arrls = Param.DPageParameter.Split(new char[] { '|' }); index = SRLibFun.StringConvertToInt32(arrls[1]); PicId = SRLibFun.StringConvertToInt32(arrls[2]); inPutBuffer(arrls[0].Replace(Param.ServerCacheIP, Param.IP), 0); SROperation2.Instance.BrowserPicId = this.PicId; } this.center2_11.BindData(ref this.lvic); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); //右键菜单 CustomToolStripColorTable ctsct = new CustomToolStripColorTable(); contextMenuStrip1.RenderMode = ToolStripRenderMode.Professional; contextMenuStrip1.Renderer = new ToolStripProfessionalRenderer(ctsct); contextMenuStrip2.RenderMode = ToolStripRenderMode.Professional; contextMenuStrip2.Renderer = new ToolStripProfessionalRenderer(ctsct); //FrmFame 事件 //this.center2_11.listView1.KeyDown += Browser_KeyDown; splitContainer1.SplitterMoved += splitContainer1_SplitterMoved; splitContainer1.SplitterDistance = SROperation.Instance.BrowserSplitContainer1SplitterDistance; this.FindForm().KeyPreview = true; this.FindForm().KeyUp += Browser_KeyUp; this.FindForm().MouseWheel += Browser_MouseWheel; this.FindForm().FormClosing += Browser_FormClosing; }
private void btn_Click(object sender, EventArgs e) { Int32 itag = 0; Label lbl = sender as Label; if (lbl != null) { itag = SRLibFun.StringConvertToInt32(lbl.Tag.ToString()); } else { PictureBox pic = sender as PictureBox; itag = SRLibFun.StringConvertToInt32(pic.Tag.ToString()); } if (OnPageClicked != null) { OnPageClicked(sender, new MyEventArgs() { Action = itag }); //把按钮自身作为参数传递 } }
//右边事件 void right1_OnPageAftered(object sender, TreeViewEventArgs e) { if (e.Node == null || e.Node.Tag == null) { return; } { Int32 ibiaojiId = (e.Node.Tag as SRRC_BiaojiEntity).Id; String strPicSelected = this.PicId.ToString(); strPicSelected = strPicSelected.TrimEnd(','); if (string.IsNullOrEmpty(strPicSelected) == false) { DataBase.Instance.tSRRC_Resourcebiaojirel.Delete(" User_id=[$User_id$] and Biaoji_id=[$Biaoji_id$] and Resource_id in (" + strPicSelected + ") ", new DataParameter("User_id", SROperation.Instance.RightDtype.Equals("Study") == true ? 0 : Param.UserId), new DataParameter("Biaoji_id", ibiaojiId) ); if (e.Node.Checked == true) { List <SRRC_ResourcebiaojirelEntity> resourcebiaojirelEntList = new List <SRRC_ResourcebiaojirelEntity>(); foreach (var item in strPicSelected.Split(new char[] { ',' })) { resourcebiaojirelEntList.Add(new SRRC_ResourcebiaojirelEntity() { Addtime = DateTime.Now, Biaoji_id = ibiaojiId, Resource_id = SRLibFun.ToInt32(item), User_id = SROperation.Instance.RightDtype.Equals("Study") == true ? 0 : Param.UserId }); } DataBase.Instance.tSRRC_Resourcebiaojirel.Add(resourcebiaojirelEntList.ToArray()); DataBaseHelper.Instance.Helper.ExecuteNonQuery(System.Data.CommandType.Text, " update SRRC_Resource set bjtime=Getdate() where id in(" + strPicSelected + ") "); } } } }
void center2_11_OnPageClicked(object sender, MyEventArgs e) { switch (e.Action) { case 11: { index--; //if (index < 0) // index = 0; if (index >= 0) { SRRC_ResourceEntity ent = lvic[index].Tag as SRRC_ResourceEntity; this.PicId = ent.Id; this.inPutBuffer(ent.Serverip + ent.Path, 0); this.center2_11.SetSelectedState(index); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } else { index = 0; MessageBox.Show("已是第一张"); } } break; case 12: { index++; if (lvic.Count > index) { SRRC_ResourceEntity ent = lvic[index].Tag as SRRC_ResourceEntity; this.PicId = ent.Id; this.inPutBuffer(ent.Serverip + ent.Path, 0); this.center2_11.SetSelectedState(index); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } else { index = lvic.Count - 1; MessageBox.Show("已是最后一张"); } } break; case 13: { this.inPutBuffer(strPic, -1); } break; case 14: { this.inPutBuffer(strPic, 0); } break; case 15: { this.inPutBuffer(strPic, 0); } break; case 16: //显示图片 { if (String.IsNullOrEmpty(e.Parameter.ToString()) == false) { //1:1显示 String[] arrls = e.Parameter.ToString().Split(new char[] { '|' }); index = SRLibFun.StringConvertToInt32(arrls[1]); PicId = SRLibFun.StringConvertToInt32(arrls[2]); inPutBuffer(arrls[0], 0); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } } break; default: break; } }
public SetHide() { InitializeComponent(); iuser_id = SRLibFun.StringConvertToInt32(Param.DPageParameter); }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.textBox1.Text) == true) { new SRFMessageBox("用户名不能为空!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } if (this.textBox2.Text.Length == 0) { new SRFMessageBox("密码不能为空!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } id = SRLibFun.StringConvertToInt32(Param.DPageParameter); if (DataBase.Instance.tSR_User.Get_Entity(" Loginname=[$Loginname$] and Id !=[$Id$] ", new DataParameter("Loginname", this.textBox1.Text), new DataParameter("Id", id)) != null) { new SRFMessageBox("用户名已经被使用,请输入其它用户名!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } if (id > 0) { SR_UserEntity userEnt = DataBase.Instance.tSR_User.Get_Entity(id); userEnt.Loginname = this.textBox1.Text; userEnt.Pwd = this.textBox2.Text; if (this.radioButton1.Checked == true) { userEnt.Groupid = 1; } else if (this.radioButton2.Checked == true) { userEnt.Groupid = 2; } else if (this.radioButton3.Checked == true) { userEnt.Groupid = 3; } else if (this.radioButton4.Checked == true) { userEnt.Groupid = 4; } DataBase.Instance.tSR_User.Update(userEnt); } else { //object objval = DataBase.Instance.tSR_User.Math(FunType.Count, SR_UserEntity.FiledType.Id,null,null); //if (objval != DBNull.Value && SRLibFun.StringConvertToInt32(objval.ToString()) >=30) //{ // new SRFMessageBox("用户名数量已达到上限!", "提示", MessageBoxButtons.OK).ShowDialog(); // return; //} SR_UserEntity userEnt = new SR_UserEntity(); userEnt.Loginname = this.textBox1.Text; userEnt.Pwd = this.textBox2.Text; if (this.radioButton1.Checked == true) { userEnt.Groupid = 1; } else if (this.radioButton2.Checked == true) { userEnt.Groupid = 2; } else if (this.radioButton3.Checked == true) { userEnt.Groupid = 3; } else if (this.radioButton4.Checked == true) { userEnt.Groupid = 4; } id = DataBase.Instance.tSR_User.Add(userEnt); } DataBase.Instance.tSR_Systemrecord.Add(new SR_SystemrecordEntity() { Adddate = DateTime.Now, Ltype = "日志", Title = Param.Loginname, Description = this.textBox1.Text + "用户", Remark = "设置" }); new SRFMessageBox("保存成功!", "提示", MessageBoxButtons.OK).ShowDialog(); this.ParentForm.DialogResult = DialogResult.OK; this.ParentForm.Close(); }