Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            lst_info = FindViewById <TextView>(Resource.Id.lst_info);

            Button btn_connect = FindViewById <Button>(Resource.Id.btn_connect);

            btn_connect.Click += btn_connect_Click;
            Button btn_send = FindViewById <Button>(Resource.Id.btn_send);

            btn_send.Click += btn_send_Click;

            Button btn_disconnect = FindViewById <Button>(Resource.Id.btn_disconnect);

            btn_disconnect.Click += btn_disconnect_Click;

            client              = new my_client("android");
            client.get_message += client_get_message;
        }
        public void StartConnect(IPCheck check)
        {
            IPAddress[] address = new IPAddress[0];
            foreach (string item in check.selected)
            {
                Array.Resize(ref address, address.Length + 1);
                Console.WriteLine(item);
                address[address.Length - 1] = IPAddress.Parse(item);
            }

            mine = new my_client[address.Length];
            for (int i = 0; i < address.Length; i++)
            {
                mine[i] = new my_client();
                mine[i].Connect(address[i], 2001);

                MessageBox.Show("start");
                mine[i].sentMessage("start");
            }
        }