public frmWebLogin() { InitializeComponent(); asyncControl = new AsyncControl(); this.Controls.Add(asyncControl); tsEndLoginButton.ButtonClick += TsEndLoginButton_ButtonClick; this.SizeChanged += FrmWebLogin_SizeChanged; }
public static void Initialize() { lock (typeof(PlayerConnection)) { if (initialized) { return; } string headerFile = System.Web.Configuration.WebConfigurationManager.AppSettings["HeaderFile"]; ID3V2_Header = System.IO.File.ReadAllBytes(headerFile); Initializer.Initialize(Program.INTEGRATION_INITIALIZATION); _control = Initializer.Control; _control.PushCommand("ldasm CPlayerStreamer.dll"); _control.PushCommand("setp 2"); _control.PushCommand("starthkm"); _control.WaitQueueExecution(); CPlayerStreamer.ImmediateStreamer streamer = Player.GetInstance().GetImplementer() as CPlayerStreamer.ImmediateStreamer; streamer.PushData += (o, d) => { LastDataPacket = d; DataRecived.Set(); DataRecived.Reset(); }; CPlayer.Output.Display.Print += (sender, text, color, newLine) => { if (newLine) { _sb.AppendLine(text); } else { _sb.Append(text); } LastOutput = text; TextRecieved.Set(); TextRecieved.Reset(); }; _buffer = new ReceiveBuffer(); initialized = true; } }
// Begin an asychronous write operation. public virtual IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, Object state) { // Validate the parameters and the stream. ValidateBuffer(buffer, offset, count); if (!CanWrite) { throw new NotSupportedException(_("IO_NotSupp_Write")); } // Create the result object. AsyncControl async = new AsyncControl (callback, state, this, buffer, offset, count, false); // Start the background write. async.Start(); return(async); }
// Begin an asynchronous operation to send from this socket. public IAsyncResult BeginSendTo(byte[] buffer, int offset, int size, SocketFlags socketFlags, EndPoint remoteEP, AsyncCallback callback, Object state) { // Validate the parameters. ValidateBuffer(buffer, offset, size); if(remoteEP == null) { throw new ArgumentNullException("remoteEP"); } else if(remoteEP.AddressFamily != family) { throw new SocketException(Errno.EINVAL); } // Create the result object. AsyncControl async = new AsyncControl (callback, state, this, buffer, offset, size, socketFlags, remoteEP, AsyncOperation.SendTo); // Start the background process. async.Start(); return async; }
// Begin an asynchronous operation to send on this socket. public IAsyncResult BeginSend(byte[] buffer, int offset, int size, SocketFlags socketFlags, AsyncCallback callback, Object state) { // Validate the parameters. ValidateBuffer(buffer, offset, size); // Create the result object. AsyncControl async = new AsyncControl (callback, state, this, buffer, offset, size, socketFlags, null, AsyncOperation.Send); // Start the background process. async.Start(); return async; }
// Begin an asynchronous operation to connect on this socket. public IAsyncResult BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state) { // Validate the parameters. if(remoteEP == null) { throw new ArgumentNullException("remoteEP"); } else if(remoteEP.AddressFamily != family) { throw new SocketException(Errno.EINVAL); } // Create the result object. AsyncControl async = new AsyncControl (callback, state, this, null, 0, 0, SocketFlags.None, remoteEP, AsyncOperation.Connect); // Start the background process. async.Start(); return async; }
}; // class AsyncControl // Begin an asynchronous operation to accept an incoming connection. public IAsyncResult BeginAccept(AsyncCallback callback, Object state) { // Create the result object. AsyncControl async = new AsyncControl (callback, state, this, null, 0, 0, SocketFlags.None, null, AsyncOperation.Accept); // Start the background process. async.Start(); return async; }
// Begin an asychronous write operation. public virtual IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, Object state) { // Validate the parameters and the stream. ValidateBuffer(buffer, offset, count); if(!CanWrite) { throw new NotSupportedException(_("IO_NotSupp_Write")); } // Create the result object. AsyncControl async = new AsyncControl (callback, state, this, buffer, offset, count, false); // Start the background write. async.Start(); return async; }