示例#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
			Button button = FindViewById<Button> (Resource.Id.MyButton);
			textView = FindViewById<TextView> (Resource.Id.textView1);
			EditText editText = FindViewById<EditText> (Resource.Id.editText1);
			button.Click += delegate {
				targetPeer = editText.Text;
				PeerNet.DataConnectionOptions dataConnectionOptions = new DataConnectionOptions (null, null, DataConnectionOptions.SerializationType.json, true);
				dataConnection = peer.Connect (targetPeer, dataConnectionOptions);
				dataConnection.DataConnectionOpened += DataConnection_DataConnectionOpened;
			};
			Button sendButton = FindViewById<Button> (Resource.Id.button1);
			sendButton.Click += SendButton_Click;


			peer = new Peer (null, new PeerOptions (null, null, "ytgklpf684u0udi", null, null), this);
			peer.PeerConnected += Peer_PeerConnected;
		}
示例#2
0
文件: Peer.cs 项目: akonsand/Peer.Net
		public DataConnection Connect (string peer, DataConnectionOptions options)
		{
			Peer peerToConnect = new Peer (peer);
			DataConnection dataConnection = new DataConnection (peerToConnect, this, options);
			this.connections.Add (dataConnection);
			return dataConnection;
		}
示例#3
0
		public DataConnectionObserver (DataChannel dataChannel, DataConnection dataConnection)
		{
			this.dataChannel = dataChannel;
			this.dataConnection = dataConnection;
		}