Example #1
0
 public bool PreFilterMessage(ref Message msg)
 {
     if (msg.Msg == WM_SYSCOMMAND)
     {
         SysCommand?.Invoke(msg);
     }
     return(false);
 }
Example #2
0
 public static extern bool PostMessage(IntPtr hWnd, WindowMessage Msg, SysCommand wParam, uint lParam);
Example #3
0
 /// <summary>
 /// Main constructor for <see cref="Syscall"/>
 /// </summary>
 /// <param name="command_">The type of the command you want to send. See also <seealso cref="SysCommand"/></param>
 /// <param name="data_">The object associated to the <see cref="SysCommand"/></param>
 public Syscall(SysCommand command_, Object data_)
 {
     this.Command = command_;
     this.Data    = data_;
 }
Example #4
0
        private void ExecuteCommand(object obj)
        {
            if (obj is byte[])
            {
                byte[] buffertemp = obj as byte[];
                if (buffertemp.Count() > 0)
                {
                    //if (BitConverter.IsLittleEndian)
                    //    Array.Reverse(buffertemp);
                    StreamType type = (StreamType)BitConverter.ToInt32(new byte[] { buffertemp[0], buffertemp[1], buffertemp[2], buffertemp[3] }, 0);

                    int command = BitConverter.ToInt32(new byte[] { buffertemp[4], buffertemp[5], buffertemp[6], buffertemp[7] }, 0);
                    switch (type)
                    {
                    case StreamType.CommandSystem:
                        SysCommand sysCommand = (SysCommand)command;
                        switch (sysCommand)
                        {
                        case SysCommand.ShutDown:
                            SysCommandManager.ShutDownS(30);
                            break;

                        case SysCommand.Dormancy:
                            SysCommandManager.Dormancy();
                            break;

                        case SysCommand.VolumeDown:
                            SysCommandManager.VolumeDown();
                            break;

                        case SysCommand.VolumeUp:
                            SysCommandManager.VolumeUp();
                            break;

                        case SysCommand.VolumeMute:
                            SysCommandManager.VolumeMute();
                            break;

                        case SysCommand.CancelShutDown:
                            SysCommandManager.CancelShutDown();
                            break;

                        case SysCommand.Restart:
                            SysCommandManager.Restart();
                            break;
                        }
                        break;

                    case StreamType.CommandPPT:
                        PPTCommand        pptCommand = (PPTCommand)command;
                        PPTCommandManager manager    = PPTCommandManager.GetInstance();
                        switch (pptCommand)
                        {
                        case PPTCommand.Start:
                            manager.Start();
                            break;

                        case PPTCommand.Next:
                            manager.Next();
                            break;

                        case PPTCommand.Last:
                            manager.Last();
                            break;

                        case PPTCommand.Exit:
                            manager.Exit();
                            break;
                        }
                        break;

                    case StreamType.CommandAV:
                        AVCommand        avCommand        = (AVCommand)command;
                        AVCommandManager avCommandManager = AVCommandManager.GetInstance();
                        switch (avCommand)
                        {
                            /*
                             * case AVCommand.AVStart:
                             * if (FrmAV.GetInstance() == null)
                             * {
                             *  FrmAV.GetInstance(FrmAV.FormType.Callee).Show();
                             * }
                             * break;
                             * case AVCommand.AVAccept:
                             * if (FrmAV.GetInstance() != null)
                             * {
                             *  avCommandManager.BeginMonitorWebcam(FrmAV.GetInstance().avLocalhost);
                             * }
                             * break;
                             * case AVCommand.AVRefuse:
                             * if (FrmAV.GetInstance() != null)
                             * {
                             *  FrmAV.GetInstance().lbTips.Text = "对方拒绝了您的请求";
                             * }
                             * break;
                             * case AVCommand.AVSuspend:
                             * if (FrmAV.GetInstance() != null)
                             * {
                             *  FrmAV.GetInstance().lbTips.Text = "对方挂断了视频";
                             * }
                             * break;
                             */
                        }
                        break;

                    case StreamType.VideoStream:
                        /*
                         * byte[] bytes2 = new byte[buffertemp.Length - 8];
                         * Buffer.BlockCopy(buffertemp, 8, bytes2, 0, buffertemp.Length - 8);
                         * if (FrmAV.GetInstance() != null)
                         * {
                         *  MemoryStream stream = new MemoryStream(bytes2);
                         *
                         *  FrmAV.GetInstance().avPhone.Image = System.Drawing.Image.FromStream(stream);
                         * }
                         * else
                         * {
                         *  FrmAV.GetInstance(FrmAV.FormType.Callee).Show();
                         *  MemoryStream stream = new MemoryStream(bytes2);
                         *
                         *  FrmAV.GetInstance().avPhone.Image = System.Drawing.Image.FromStream(stream);
                         * }
                         */
                        break;
                    }
                }
            }
            byte[] buffertemp2 = new byte[BUFFERSIZE];
            //recSocket = tcpListener.EndAccept(ar);
            recSocket.BeginReceive(buffertemp2, 0, BUFFERSIZE, SocketFlags.None, new AsyncCallback(ReceiveHandle), buffertemp2);
        }