public void DisplayNotif(string title, string content, string type, string application, Action <Device> callbackYes, Action <Device> callbackNo, Device d) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, (ThreadStart) delegate { int slideOutTimer = 5; if (type == "appel") { slideOutTimer = 30; } if (type == "connexion") { slideOutTimer = 120; } NotificationView notif = new NotificationView(); NotificationViewModel notifContext = new NotificationViewModel(title, content, type, application, callbackYes, callbackNo, d); notif.DataContext = notifContext; notif.displayNotif(slideOutTimer); }); }