//public enum Priority { ProwlNotificationPriority. public static void Send(string msgDescription, string msgEvent, Priority msgPriority) { // Before posting a notification, // check out the [app.config] file to configure the Prowl client. try { // Create a notification. var notification = new ProwlNotification(); notification.Description = msgDescription; notification.Event = msgEvent; notification.Priority = (ProwlNotificationPriority)msgPriority; // 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 clientCfg = new ProwlClientConfiguration(); clientCfg.ApiKeychain = API_KEY; clientCfg.ApplicationName = "Copper Hedge"; var prowlClient = new ProwlClient(clientCfg); // Post the notification. prowlClient.PostNotification(notification); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
void IJob.DoJob(Operation operation) { // Construct Notification text string body = "Einsatz:\r\n"; body += "Zeitstempel: " + operation.Timestamp.ToString() + "\r\n"; body += "Stichwort: " + operation.Keyword + "\r\n"; body += "Einsatznr: " + operation.OperationNumber + "\r\n"; body += "Hinweis: " + operation.Comment + "\r\n"; body += "Mitteiler: " + operation.Messenger + "\r\n"; body += "Einsatzort: " + operation.Location + "\r\n"; body += "Straße: " + operation.Street + " " + operation.StreetNumber + "\r\n"; body += "Ort: " + operation.ZipCode + " " + operation.City + "\r\n"; body += "Objekt: " + operation.Property + "\r\n"; ProwlNotification notifi = new ProwlNotification(); notifi.Priority = ProwlNotificationPriority.Emergency; notifi.Event = "Feuerwehr Einsatz"; notifi.Description = body; //Send the Message try { pclient.PostNotification(notifi); } catch (Exception ex) { Logger.Instance.LogFormat(LogType.Error, this, "An error occurred while sending the Prowl Messages."); Logger.Instance.LogException(this, ex); } }
private static void Main(string[] args) { var show_help = false; var apikey = ""; var applicationName = "Default"; var eventName = "Default"; var show_timestamp = false; var p = new OptionSet { { "a|apikey=", "the {APIKEY} for Prowl.", v => { if (v == null) { throw new OptionException("Missing api key for option -a", "-a"); } apikey = v; } }, { "n|name=", "the {NAME} of the application that sends the notification.", v => applicationName = v }, { "e|event=", "the {EVENT} of the notification.", v => eventName = (v ?? "Default") }, { "d|datetime=", "shows a timestamp with the message.", v => show_timestamp = v != null }, { "h|help", "show this message and exit", v => show_help = v != null }, }; List<string> extra; try { extra = p.Parse(args); } catch (OptionException e) { Console.Write("prowlNotifier: "); Console.WriteLine(e.Message); Console.WriteLine("Try 'prowlNotifier --help' for more information."); return; } if (show_help || string.IsNullOrEmpty(apikey)) { ShowHelp(p); return; } // Create and send the notification. var message = string.Join(" ", extra.ToArray()); if (string.IsNullOrEmpty(message)) { message = "Test"; } if (show_timestamp) message = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " " + message; var notification = new ProwlNotification { Description = message, Event = eventName, Priority = ProwlNotificationPriority.Normal }; var client = new ProwlClient(new ProwlClientConfiguration { ApiKeychain = apikey, ApplicationName = applicationName }); client.PostNotification(notification); }
public void Send(string myevent, string mydesc, ProwlNotificationPriority priority = ProwlNotificationPriority.Normal) { var notification = new ProwlNotification(); notification.Event = myevent; notification.Description = mydesc; notification.Priority = priority; m_prowl.PostNotification(notification); }
private void sendProwlMessage(string prowlEvent, string description, ProwlNotificationPriority priority = ProwlNotificationPriority.Normal) { var notification = new ProwlNotification(); notification.Event = prowlEvent; notification.Description = description; notification.Priority = priority; _prowl.PostNotification(notification); }