public static ThumbnailToolbarButton CreateThumbnailToolbarButton(this Gtk.Action action, Func<Gtk.Action, System.Drawing.Icon> icon_callback) { var button = new ThumbnailToolbarButton (id++) { DismissOnClick = false, Tooltip = action.Label.Replace ("_", ""), Enabled = action.Sensitive, Hidden = !action.Visible, Icon = icon_callback != null ? icon_callback (action) : null }; button.Clicked += (o, e) => action.Activate (); action.AddNotification ("icon-name", (o, args) => button.Icon = icon_callback != null ? icon_callback (action) : null); action.AddNotification ("stock-id", (o, args) => button.Icon = icon_callback != null ? icon_callback (action) : null); action.AddNotification ("tooltip", (o, args) => button.Tooltip = action.Label.Replace ("_", "")); action.AddNotification ("sensitive", (o, args) => button.Enabled = action.Sensitive); action.AddNotification ("visible", (o, args) => button.Hidden = !action.Visible); return button; }
public static void NotifyWithSettings(this IManageToasts toasts, NotificationModel notification, ChannelSettingsModel.NotifyLevel notifyLevel) { switch (notifyLevel) { case ChannelSettingsModel.NotifyLevel.NoNotification: break; case ChannelSettingsModel.NotifyLevel.NotificationOnly: toasts.AddNotification(notification); break; case ChannelSettingsModel.NotifyLevel.NotificationAndToast: toasts.AddNotification(notification); toasts.FlashWindow(); toasts.ShowToast(); break; case ChannelSettingsModel.NotifyLevel.NotificationAndSound: toasts.AddNotification(notification); toasts.FlashWindow(); toasts.PlaySound(); toasts.ShowToast(); break; } }