Remarks: Create a new instance of this class for each notification sent as they are not reusable. The ID and UserData should be used to specify what action would happen when the user clicks the notification (if applicable). All notifications should be handled by the Application.NotificationActivated event. Note that in some platforms (e.g. macOS), the application may have a notification clicked when the application isn't even started. In this case, the application is started an then sent the notification to the Application.NotificationActivated immediately.
Fields
Properties
ContentImage
#Gets or sets the content image of the notification
Remarks: This is used to provide context to the user for what the notification is for. Currently does nothing on WPF and WinForms. On these platforms set-up a global Style Style.Add<NotificationHandler>("info", h => h.NotificationIcon = NotificationIcon.Info); and the use it via new Notification { Style = "info" }
Remarks: This can sometimes be useful to get the platform-specific object. Some handlers may not have any backing object for its functionality, so this may be null. It is more preferred to use the Widget.Handler and cast that to the platform-specific handler class which can give you additional methods and helpers to do common tasks. For example, the Application object's handler for OS X has a AddFullScreenMenuItem property to specify if you want full screen support in your app.
Icon
#obsolete, use ContentImage instead
Gets or sets the icon for the Notification.
Remarks: Currently does nothing on WPF and WinForms.
Value: The icon of the Notification.
IsDisposed
Gets or sets a value indicating whether this Widget has been disposed.
Remarks: When the widget is disposed, it can no longer be used.
Value:
true if this instance has been disposed; otherwise, false.NativeHandle
public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object
RequiresTrayIndicator
#Gets a value indicating whether this Notification requires a TrayIndicator to be displayed.
Remarks: Usually if a tray is required but not provided, one will be created for the purposes of showing the notification with the same icon as the Application.MainForm.
Remarks: Styles allow you to attach custom platform-specific logic to a widget. In your platform-specific assembly, use Add{H} to add the style logic with the same id.
Example:
// in your UI
var control = new Button { Style = "mystyle" };
// in your platform assembly
using Eto.Mac.Forms.Controls;
Styles.AddHandler<ButtonHandler>("mystyle", handler => {
// this is where you can use handler.Control to set properties, handle events, etc.
handler.Control.BezelStyle = NSBezelStyle.SmallSquare;
});UserData
#Gets or sets user data for the notification.
Remarks: Use this to store application-specific data that would be useful for knowing what caused the notification. The data you store would usually determine what action to perform in the application. This is returned via Application.NotificationActivated via the NotificationEventArgs.
Methods
Dispose
public void Dispose()
Disposes of this widget, supressing the finalizer
Parameters:
| disposing (bool) | True if the caller called Widget.Dispose() manually, false if being called from a finalizer |
GetCallback
Gets an instance of an object used to perform callbacks to the widget from handler implementations
Remarks: The callback should implement the parent class' Widget.ICallback interface so that there only needs to be a single callback for the entire hierarchy. This should return a static instance to avoid having overhead for each instance of your control.
Returns: The callback instance to use for this widget
Initialize
protected void Initialize()
Initializes the widget handler
Remarks: This is typically called from the constructor after all of the logic is completed to construct the object. If your handler interface has the AutoInitializeAttribute set to false, then you are responsible for calling this method in your constructor after calling the creation method on your custom handler.
OnActivated
#obsolete, Use Application.OnNotificationActivated instead.
Raises the Activated event.
Parameters:
| e (EventArgs) | Event arguments. |
inherited fromWidget
Show
#Shows the current notification.
Remarks: On some platforms like Gtk and Windows 10 the indicator is not needed, while on the others like Windows 7 it's required. You can find out if the indicator is needed by looking at RequiresTrayIndicator property.
Parameters:
| indicator (TrayIndicator = null) | Indicator to use to show the notification. |
ToString
Gets a string that represents the current object with its ID if specified.
Returns: A string value indicating the type and ID (if specified) of this widget.
Overrides: Object.ToString
Events
Activated
#obsolete, Use Application.NotificationActivated instead.
Event to handle when the user left click the Notification.
inherited fromWidget