Class ChannelReceiver
Definition
- Assembly:
- Tizen.Core.dll
Represents the channel receiver used for inter-task communication.
public class ChannelReceiver : IDisposable
- Inheritance
-
objectChannelReceiver
- Implements
-
System.IDisposable
Methods
View SourceDispose()
Release any unmanaged resources used by this object.
Declaration
public void Dispose()
Dispose(bool)
Release any unmanaged resources used by this object.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | If true, disposes any disposable objects. If false, does not dispose disposable objects. |
~ChannelReceiver()
Finalizes an instance of the ChannelReceiver class.
Declaration
protected ~ChannelReceiver()
Receive()
Asynchronously receives the channel object from the sender.
Declaration
public Task<ChannelObject> Receive()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><ChannelObject> | The received channel object. |
Examples
var channel = new Channel();
var task = TizenCore.Find("Test");
task.Send(async () => {
try {
var channelObject = await channel.Receiver.Receive();
Console.WriteLine("Message = {}", (string)channelObject.Data);
} catch (Exception e) {
Console.Error.WriteLine("Failed to receive message: {0}", e.ToString());
}
});
Exceptions
Type | Condition |
---|---|
System.OutOfMemoryException | Thrown when out of memory. |
System.InvalidOperationException | Thrown when failed due to an invalid operation. |
Events
View SourceReceived
Occurs whenever a channel object is received in the main loop of the task.
Declaration
public event EventHandler<ChannelReceivedEventArgs> Received
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ChannelReceivedEventArgs> |
Remarks
The registered event handler will be invoked when the channel receiver is added to the specific task.
Examples
var channel = new Channel();
var receiver = channel.Receiver;
receiver.Received += (sender, args) => {
Console.WriteLine("OnChannelObjectReceived. Message = {0}", (string)args.Data);
};
Implements
System.IDisposable