Exemple #1
0
        /// <summary>
        /// Sends a note to the Pushbullet service
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <param name="callback"></param>
        void Pushbullet(string title, string message, Action <bool> callback = null)
        {
            var payload = new PushbulletNote {
                title = title, body = message, type = "note"
            };

            if (!ErrorHandling(payload))
            {
                return;
            }

            WebRequest(pushbulletUrl, payload.QueryString(), callback, pushbulletHeaders);
        }
Exemple #2
0
        bool ErrorHandling(PushbulletNote payload, Action <bool> callback = null)
        {
            if (string.IsNullOrEmpty(pushbulletToken) || pushbulletToken.Length != 34)
            {
                LogWarning("Pushbullet access token not set! Please set it and try again");
                return(false);
            }

            if (string.IsNullOrEmpty(payload.title))
            {
                LogWarning("Title not given! Please enter one and try again");
                return(false);
            }

            if (string.IsNullOrEmpty(payload.body))
            {
                LogWarning("Body not given! Please enter one and try again");
                return(false);
            }

            return(true);
        }