Пример #1
0
        private static void tcpConnection_newDataReceived(object sender, EventArgs e)
        {
            //while (tcpConnection.DataReceived.Count > 0)
            while (tcpConnection.HasData())
            {
                //object data = tcpConnection.DataReceived.ElementAt(0);
                object data = tcpConnection.PopData();
                if (data.GetType() == typeof(string))
                {
                    Console.WriteLine(data.GetType() + " | " + data);
                }
                else if (data.GetType() == typeof(MISD.Client.Model.LayoutChangeCommand))
                {
                    Console.WriteLine("LayoutChangeCommand " + ((MISD.Client.Model.LayoutChangeCommand)data).ToString());
                }
                else if (data.GetType() == typeof(Daten))
                {
                    //TypeConverter converter = TypeDescriptor.GetConverter(data);
                    //object convertedData = converter.ConvertFrom(data);

                    Console.WriteLine(data.GetType() + " | " + ((Daten)data).value);
                }
                else
                {
                    Console.WriteLine(">>> Unknown delivered type");
                }

                //tcpConnection.DataReceived.RemoveAt(0);
            }
        }
Пример #2
0
        private void tcpConnection_newDataReceived(object sender, EventArgs e)
        {
            while (tcpConnection.HasData())
            {
                object data = tcpConnection.PopData();

                if (data.GetType() == typeof(MISD.Client.Model.LayoutChangeCommand))
                {
                    IncommingLayoutChanges((MISD.Client.Model.LayoutChangeCommand)data);
                }
                else if (data.GetType() == typeof(DataModelChangeCommand))
                {
                    DataModelManager.Instance.TcpConnection_newDataReceived(data);
                }
                else
                {
                    //  Console.WriteLine(">>> Unknown delivered type");
                }
            }
        }