Ejemplo n.º 1
0
        public static byte[] SendFile(byte[] dataToPredict, ushort selectedAlgortihm, AsynchronousClient client)
        {
            try
            {
                byte[] requestBytes = CreateFTRequestBytes(dataToPredict, selectedAlgortihm);

                using (client)
                {
                    client.ExceptionReport += (sender, e) =>
                    {
                        client.Dispose();
                        //window.Dispatcher.BeginInvoke((MethodInvoker)(() =>
                        //    MessageBox.Show(e.Exception.Message, Application.ProductName,
                        //        MessageBoxButtons.OK, MessageBoxIcon.Error)));
                    };

                    client.Connect(Dns.GetHostName());

                    client.SendData(requestBytes);

                    var result = client.ReceiveResponse();

                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                //EventManager.RaiseOnMainThread(EventType.EndWork, true);
                IsDisposed = true;

                if (disposing)
                {
                    ResetSubscription();
                    Client?.Dispose();
                }
            }
        }