示例#1
0
        protected override void ProcessRecord()
        {
            try
            {
                Log.Info("Invoke-OSANMA - ProcessRecord - Started");

                var notification =
                    new NMANotification
                {
                    Description = Description, Event = Event, Priority = (NMANotificationPriority)Priority
                };

                NMAClientConfiguration config = new NMAClientConfiguration();
                config.ApplicationName = "OSA";
                config.ApiKeychain     = APIKey;

                var client = new NMAClient(config);

                // Post the notification.
                client.PostNotification(notification);

                WriteObject(true);
            }
            catch (Exception exc)
            { Log.Error("An error occured while trying to run the command invoke-osanma, details", exc); }
        }
        protected override void ProcessRecord()
        {
            try
            {
                logging.AddToLog("Invoke-OSANMA - ProcessRecord - Started", false);

                var notification =
                    new NMANotification
                {
                    Description = this.Description,
                    Event       = this.Event,
                    Priority    = (NMANotificationPriority)Priority
                };

                NMAClientConfiguration config = new NMAClientConfiguration();
                config.ApplicationName = "OSA";
                config.ApiKeychain     = APIKey;

                var client = new NMAClient(config);

                // Post the notification.
                client.PostNotification(notification);

                WriteObject(true);
            }
            catch (Exception exc)
            {
                logging.AddToLog("An error occured while trying to run the command invoke-osanma, details: \r\n" + exc.Message, true);
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            // Before posting a notification, 
            // check out the [app.config] file to configure the Prowl client.

            // Create a notification.
            var testNotification =
                new NMANotification
                {
                    Description = "This is a test notification.",
                    Event = "Testing...",
                    Priority = NMANotificationPriority.Normal
                };

            // Create the Prowl client.
            // By default, the Prowl client will attempt to load configuration
            // from the configuration file (app.config).  You can use an overloaded constructor
            // to configure the client directly and bypass the configuration file.
            var testClient = new NMAClient();

            // Post the notification.
            testClient.PostNotification(testNotification);
        }
示例#4
0
        static void Main(string[] args)
        {
            // Before posting a notification,
            // check out the [app.config] file to configure the Prowl client.

            // Create a notification.
            var testNotification =
                new NMANotification
            {
                Description = "This is a test notification.",
                Event       = "Testing...",
                Priority    = NMANotificationPriority.Normal
            };

            // Create the Prowl client.
            // By default, the Prowl client will attempt to load configuration
            // from the configuration file (app.config).  You can use an overloaded constructor
            // to configure the client directly and bypass the configuration file.
            var testClient = new NMAClient();

            // Post the notification.
            testClient.PostNotification(testNotification);
        }