Пример #1
0
        private void MIN_Man_LostFocus(object sender, System.Windows.RoutedEventArgs e)
        {
            TextBox_LostFocus(sender, e);

            // Search Name of Man
            var man = context.Persons.FirstOrDefault(p => p.Id == MIN_Man.Text);

            if (man == null)
            {
                Text_Man.Content    = "Not Found !!!";
                Text_Man.Foreground = Brushes.Red;
            }
            else
            {
                Text_Man.Content    = man.FirstName + " " + man.LastName;
                Text_Man.Foreground = Brushes.Green;
            }

            MIN_Woman.Focus();
        }
Пример #2
0
        private void SocketReceiveThread()
        {
            var udpclient = new UdpClient(12345, AddressFamily.InterNetwork)
            {
                EnableBroadcast = true
            };
            var remoteIPEndPoint = new IPEndPoint(0, 0);

            while (true)
            {
                try
                {
                    var buffer = udpclient.Receive(ref remoteIPEndPoint);
                    // Wir brauchen nun einen String
                    var data = Encoding.ASCII.GetString(buffer, 0, buffer.Length);
                    Console.WriteLine("Packet von: {0}: {1}", remoteIPEndPoint, data);
                    data += "\t";
                    // call dispatcher with the data
                    Dispatcher.Invoke(
                        DispatcherPriority.Normal,
                        (Action) delegate()
                    {
                        if (MIN_Woman.IsFocused)
                        {
                            MIN_Woman.Text = data;
                            Next.Focus();
                        }

                        if (MIN_Man.IsFocused)
                        {
                            MIN_Man.Text = data;
                            MIN_Woman.Focus();
                        }
                    }
                        );
                }catch (Exception ex)
                {
                }
            }
        }