// [END mListener_variable_reference] // [START auth_oncreate_setup_beginning] protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Put application specific code here. // [END auth_oncreate_setup_beginning] SetContentView (Resource.Layout.activity_main); logView = FindViewById<TextView> (Resource.Id.sample_logview); logView.SetTextAppearance (this, Resource.Style.Log); logView.SetBackgroundColor (Android.Graphics.Color.White); logView.Append ("\r\n"); // [START auth_oncreate_setup_ending] if (savedInstanceState != null) authInProgress = savedInstanceState.GetBoolean (AUTH_PENDING); buildFitnessClient(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); #region Configure Activity Controls var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var chatMessagesLabel = new TextView(this); chatMessagesLabel.Text = "Chat Messages"; /// <summary> /// The text view in which the chat messages are displayed /// </summary> var chatTextView = new TextView(this); var chatInputLabel = new TextView(this); chatInputLabel.Text = "Enter the text to chat here"; /// <summary> /// The text view which is the chat message to be broadcast /// </summary> var chatInput = new EditText(this); /// <summary> /// The button that sends the chat message /// </summary> var chatButton = new Button(this); chatButton.Text = "Chat"; layout.AddView(chatInputLabel); layout.AddView(chatInput); layout.AddView(chatButton); layout.AddView(chatMessagesLabel); layout.AddView(chatTextView); SetContentView(layout); #endregion #region Configure the SignalR bindings //Create the Hub Proxy connection HubConnection connection = new HubConnection(HUB_URL); IHubProxy hubProxy = connection.CreateHubProxy(HUB_NAME); //Receive chat messages hubProxy.On<string, string>( SOMEONE_ELSE_IS_CHATTING_METHOD, (p1, p2) => { //Need to ensure the changes are in the UI thread, //since SignalR can fire the events from a different thread RunOnUiThread(() => chatTextView.Append(String.Format("{0}: {1}\n", p1, p2)) ); }); //Send out chat messages chatButton.Click += (sender, e) => { hubProxy.Invoke<String[]>( I_AM_CHATTING_METHOD, new String[] { "Android", chatInput.Text }); chatInput.Text = ""; }; //Start the link with the hub connection.Start().Wait(); #endregion }
public InspectorView(Android.Content.Context context, TextView view) : base(context, CreateInstance ()) { textView = view; textView.Append ("Vulkan instance created\n\n"); }