问题
I have a Windows Forms client application.
The application uses built-in WebBrowser to display a ASP.NET Core locally hosted site. The client does not have a persistent Internet connection (sometimes available, sometimes not).
Now I want to be able to send notifications from BackOffice to users of this application. So I have two ways:
Send notifications to ASP Core project. This project will transfer notification to JavaScript.
Send notification straight to UI JavaScript.
I wanted to use Azure Norification Hub for this purpose, but it looks like I can not use it in Forms application. After some investigation I have found no way to handle push notifications in Forms application using Notification hub. Notification hub examples use only UWP apps for windows notification + according to this conversation I can not achieve the goal.
So my first question - is there a way I can use the Notification hub to send push notifications to a WinForms application?
The Notification hub uses Google Firebase Cloud Messages (FCM) to send push notifications to Android devices. FCM have JavaScript notifications. So I was thinking of sending notifications through the Azure Notification Hub using Firebase.
My second question - is it possible to send notifications using Azure Notification Hub, pass notifications to Firebase and catch notifications in JavaScript?
My third question - could you please tell me other approaches I can use to get notifications for a WinForms application?
回答1:
is there a way I can use the Notification hub to send push notifications to a WinForms application?
It is not possible to use Azure Notification Hubs for this purpose.Azure Notification Hubs do not work with devices directly, rather it communicates via the Platform Notification Services for each platform .
Azure notification support Apple(APNS),Google(GCM),Window(WNS),Windows Phone (MPNS), Amazon (ADM), Baidu (Android China).
If we want to use Windows notification Service that we need to a associate our app to the Windows Store and config our notification hub to integrate with WNS. But Windows Form /WPF is not supported in the Windows store now. So we can't use the notification hub to send push notifications to a WinForm application.
is it possible to send notifications using Azure Notification Hub, pass notifications to Firebase and catch notifications in JavaScript?
Based on my understanding, no. We need to use Android SDK to get device registration token but you are using winform project
could you please tell me other approaches I can use to get notifications for a WinForms application?
You may need to use socket to implement it customized.
来源:https://stackoverflow.com/questions/43026884/notifications-for-winforms-wpf-application