override public void HandleMessage(Message msg) { if (msg.What != WHAT_SIGNED_IN) { return; } Android.App.Activity activity = mFragment.GetActivity(); if (mFragment.mPlusClient.IsConnected() && activity is OnSignedInListener) { ((OnSignedInListener)activity).OnSignedIn(mFragment.mPlusClient); } }
public override void HandleMessage(Message m) { view.mStatusText.SetVisibility(m.GetData().GetInt("viz")); view.mStatusText.SetText(m.GetData().GetString("text")); }
/// <summary> /// Handle the actual message. /// </summary> public bool HandleMessage(Message message) { return handler(message); }
public override void HandleMessage(Message msg) { Thread.Sleep(5000); }
private bool Handler(Message message) { message.Callback.Run(); return true; }
public override void HandleMessage(Message msg) { switch (msg.What) { case MESSAGE_STATE_CHANGE: if (D) Log.I(TAG, "MESSAGE_STATE_CHANGE: " + msg.Arg1); switch (msg.Arg1) { case BluetoothChatService.STATE_CONNECTED: chat.SetStatus(chat.GetString(R.Strings.title_connected_to, chat.mConnectedDeviceName)); chat.mConversationArrayAdapter.Clear(); break; case BluetoothChatService.STATE_CONNECTING: chat.SetStatus(R.Strings.title_connecting); break; case BluetoothChatService.STATE_LISTEN: case BluetoothChatService.STATE_NONE: chat.SetStatus(R.Strings.title_not_connected); break; } break; case MESSAGE_WRITE: byte[] writeBuf = (byte[])msg.Obj; // construct a string from the buffer var writeMessage = new string(writeBuf); chat.mConversationArrayAdapter.Add("Me: " + writeMessage); break; case MESSAGE_READ: byte[] readBuf = (byte[])msg.Obj; // construct a string from the valid bytes in the buffer var readMessage = new string(readBuf, 0, msg.Arg1); chat.mConversationArrayAdapter.Add(chat.mConnectedDeviceName + ": " + readMessage); break; case MESSAGE_DEVICE_NAME: // save the connected device's name chat.mConnectedDeviceName = msg.GetData().GetString(DEVICE_NAME); Toast.MakeText(chat.GetApplicationContext(), "Connected to " + chat.mConnectedDeviceName, Toast.LENGTH_SHORT).Show(); break; case MESSAGE_TOAST: Toast.MakeText(chat.GetApplicationContext(), msg.GetData().GetString(TOAST), Toast.LENGTH_SHORT).Show(); break; } }
public override void HandleMessage(Message msg) { switch (msg.What) { case MSG_UPDATE: { localService.mCurUpdate++; Intent intent = new Intent(ACTION_UPDATE); intent.PutExtra("value", localService.mCurUpdate); localService.mLocalBroadcastManager.SendBroadcast(intent); Message nmsg = localService.mHandler.ObtainMessage(MSG_UPDATE); localService.mHandler.SendMessageDelayed(nmsg, 1000); } break; default: base.HandleMessage(msg); break; } }
/// <summary> /// The background thread and notified us of some progress. /// This method is called on the initial thread. /// </summary> private bool HandleProgress(Message message) { worker.OnProgressChanged(new ProgressChangedEventArgs(message.Arg1, null)); return true; }
/// <summary> /// The background work has been completed. /// This method is called on the initial thread. /// </summary> private bool HandleWorkCompleted(Message message) { try { worker.OnRunWorkerCompleted(new RunWorkerCompletedEventArgs(result, error, false)); } finally { worker.OnDone(); } return true; }