Esempio n. 1
0
        //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);
            }
        }
Esempio n. 2
0
        private void startProwl(string applicationName)
        {
            var config = new ProwlClientConfiguration();

            config.ApplicationName = applicationName;
            config.ApiKeychain     = "75fcd3a230ac062616e14c15ed5f79bdb5d0d199";
            config.BaseUrl         = "https://api.prowlapp.com/publicapi";
            config.ProviderKey     = "";
            _prowl = new ProwlClient(config);
        }
        public ProwlPub(string apiKey, string appName = "(general)")
        {
            var configuration = new ProwlClientConfiguration();

            // Provider keys are used by developers to allow applications to connect with Prowl with an
            // increased request limit and allow for retrieving new API keys from user's accounts.
            //configuration.ProviderKey = apiKey;
            configuration.ApiKeychain     = apiKey;
            configuration.ApplicationName = appName;
            m_prowl = new ProwlClient(configuration);
        }
Esempio n. 4
0
        bool IJob.Initialize()
        {
            pcconfig = new ProwlClientConfiguration();

            pcconfig.ApplicationName = SettingsManager.Instance.GetSetting("ProwlJob", "ApplicationName").GetString();
            pcconfig.ProviderKey = SettingsManager.Instance.GetSetting("ProwlJob", "ProviderKey").GetString();
            pcconfig.ApiKeychain = SettingsManager.Instance.GetSetting("ProwlJob", "API").GetString();

            pclient = new ProwlClient(pcconfig);

            return false;
        }
Esempio n. 5
0
        bool IJob.Initialize()
        {
            try
            {
                pcconfig = new ProwlClientConfiguration();

                pcconfig.ApplicationName = SettingsManager.Instance.GetSetting("ProwlJob", "ApplicationName").GetString();
                pcconfig.ProviderKey     = SettingsManager.Instance.GetSetting("ProwlJob", "ProviderKey").GetString();
                pcconfig.ApiKeychain     = SettingsManager.Instance.GetSetting("ProwlJob", "API").GetString();

                pclient = new ProwlClient(pcconfig);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Esempio n. 6
0
        bool IJob.Initialize()
        {
            try
            {
                _configuration = new ProwlClientConfiguration();

                _configuration.ApplicationName = SettingsManager.Instance.GetSetting("ProwlJob", "ApplicationName").GetString();
                _configuration.ProviderKey = SettingsManager.Instance.GetSetting("ProwlJob", "ProviderKey").GetString();

                string apiKeychain = string.Join(",", SettingsManager.Instance.GetSetting("ProwlJob", "API").GetStringArray());
                _configuration.ApiKeychain = apiKeychain;

                _client = new ProwlClient(_configuration);
                return true;
            }
            catch (Exception ex)
            {
                Logger.Instance.LogFormat(LogType.Error, this, "Error while initializing Prowl.", ex);
                return false;
            }
        }