Windows System Notification Event Service & Custom Events - c#

I know with the Windows System Notification Event Service (SNES) I can subscribe to many different system events.
Is it possible to create my own type of System Event and publish events to the System Notification Event Service?

Have you tried developing your own COM object and seeing if these events are captured by the SENS service? If so, you should be able to create a listener based on the CLSID.

Related

Creating up a Azure Event Subscription to blob storage

I am developing a .net core application where I would like to create an Azure Event Subscription to Azure blob storage in C#. I've set up a Event Grid System Topic
This Event Grid Topic is supposed to have a subscription that listens to events on Blobstore (created, delete, rename) and pushes them to a Service bus.
I would like to create an EventSubscription in C# but I can't find any references.
Eventgrid operates as a push and forget mechanism. So you can't have your aplication polling Event grid for an event. You need to have your application triggered by Event grid instead. The most suitable option would be an Azure function with is triggered by Event grid. See Link.
You can use a service bus output binding to write to Service bus. Refer to this documentation.

"Eternal" Azure Function?

I want to create an Azure Function that constantly listens for events from an IP Cam SDK.
Is it possible to do something like this? Or my process would be killed eventually?
while (true)
{
new System.Threading.AutoResetEvent(false).WaitOne();
}
Azure functions differ from traditional services in a way that they don't need to listen for events continuously.
They get invoked each time automatically by triggers
Most common trigger types are:
ServiceBus
HTTP call
Timer
And many others
Check the official documentation here https://learn.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings

Nservice bus ... Publisher subscriber Filtering subscribers

I am beginner in Nservice bus
I have an webapplication and a desktop windows applicaton
the web application will publish some events and the desktop windows will subscribe to receive that events.
The windows application will be installed on multiple different machines
and i imagin that every instance will act as subscriber.
each instance would be used by different user , the user would not be intrested in receiving everything ,he should receive the message only depending on his category .
is it possible to filter the subscribers who should recieve this message before publishing it in case they already subscribed
The scenario you are describing is content based routing, not supported in NSB v5.x.
A solution can be to discard of the message in the message handler on the subscriber...

System event notifications are not supported under the current context

I am getting this error when binding to SystemEvents.PowerModeChanged in a WCF service hosted in IIS:
"System event notifications are not supported under the current context. Server processes, for example, may not support global system event notifications."
at Microsoft.Win32.SystemEvents.EnsureSystemEvents(Boolean requireHandle, Boolean throwOnRefusal)
at Microsoft.Win32.SystemEvents.add_PowerModeChanged(PowerModeChangedEventHandler value)
Looking online for some solutions but cannot find any. I am assuming this is an issue related to IIS hosting since the service has some layers of separation from the OS?
Are there any other events I could bind to which would indicate system "suspend" and "resume" states?
I guess your exception message is self explanatory. global system event notifications are not supported here.
I don't know why you want to do this in IIS. But as you want to so, i would suggest you to write a windows service and communicate with it using something like Named Pipes, MSMQ etc to get such events.

Which Event handler should i use for my windows application?

I have a mobile applciation thats interacts with a server. The mobile application should be allowed to do a http posting to the server.
The server should be able to handle the event and display out using a custom windows .net application on the server almost immediately based on event.
The http post will be in a asp.net webpage. From this page what type of application of event handling should i be used so that it can trigger a custom code in a c# windows application that i will be coding.
So what are the right ways to do it?
Is there any event handling that works on c#.net that can be applied on the above scenario?
So far i only thought of msmq event handling. The mobile app does a http post on the server, the server creates a msmq on the server side and the windows applications listens for the new msmq message.
you can use WCF to communicate with the desktop app.
It supports callbacks and events, which is exactly what you need.
see here.

Categories