public Form1(CmdServer server, InitForm msgForm, Blacklist blist) { this.cmdServer = server; this.msgForm = msgForm; InitializeComponent(); this.blacklist = new BlacklistControl(listView1, blist); addForm = new AddForm(); listView1.ContextMenuStrip = ClsMServer.MenuFactory.Produce( () => { DialogResult r = addForm.ShowDialog(); if (r == DialogResult.OK) { blacklist.Add(addForm.AddString); } }, () => { // Enable Byte[] msg = blacklist.Enable(); if (msg != null) { cmdServer.Broadcast(msg); } }, () => { Byte[] msg = blacklist.Disable(); if (msg != null) { cmdServer.Broadcast(msg); } }, () => { msgForm.LockScreen(); }, () => { msgForm.UnLockScreen(); }); }
/// <summary> /// Should be called in UI thread only /// </summary> public void LockScreen() { IsLockScreen = true; // type 2 for screenlock server.Broadcast(new byte[] { 2, 0 }); }