Пример #1
0
        void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
        {
            string myUpdate = NotificationInfo.Title + " - " + NotificationInfo.Text;

            if (myUpdate.Length > 140)
            {
                myUpdate = myUpdate.Substring(0, 137) + "...";
            }

            try
            {
                var twitter = FluentTwitter.CreateRequest()
                              .AuthenticateWith(Settings.Default.ConsumerKey, Settings.Default.ConsumerSecret,
                                                Settings.Default.AccessToken, Settings.Default.AccessTokenSecret)
                              .Account().VerifyCredentials();

                var response = twitter.Request();
                var profile  = response.AsUser();

                if (profile != null)
                {
                    var twitterPost = FluentTwitter.CreateRequest()
                                      .AuthenticateWith(Settings.Default.ConsumerKey, Settings.Default.ConsumerSecret,
                                                        Settings.Default.AccessToken, Settings.Default.AccessTokenSecret)
                                      .Statuses().Update(myUpdate);
                    var postresponse = twitterPost.Request();
                }
            }
            catch
            {
                MessageBox.Show("Error in sending notification to Twitter", "Error sending to Twitter", MessageBoxButton.OK);
            }
        }
Пример #2
0
        void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
        {
            try
            {
                if (NotificationInfo.Scheme != string.Empty)
                {
                    vox.SelectVoice(getVoiceName(NotificationInfo.Scheme));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                string text = Properties.Settings.Default.spokenText;
                text     = text.Replace("$title", NotificationInfo.Title);
                text     = text.Replace("$text", NotificationInfo.Text);
                vox.Rate = Properties.Settings.Default.speechRate;
                vox.SpeakAsync(text);
            }
            catch (Exception e)
            {
                // MessageBox.Show(e.Message, "Error in speaking this notification", MessageBoxButtons.OK);
                // MessageBox.Show(e.StackTrace, "Details", MessageBoxButtons.OK);
                Console.WriteLine(e.Message);
            }
        }
Пример #3
0
        void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
        {
            snarlText = NotificationInfo.Text;
            snarlTitle = NotificationInfo.Title;

            if (Properties.Settings.Default.mailServerHost == string.Empty || Properties.Settings.Default.username == string.Empty)
            {
                MessageBox.Show("Please set at least a mail server host and a username");
                return;
            }

            try
            {

                SmtpClient client = new SmtpClient(Properties.Settings.Default.mailServerHost, Properties.Settings.Default.mailServerPort);

                client.Credentials = new NetworkCredential(Properties.Settings.Default.username, Crypto.ToInsecureString(Crypto.DecryptString(Properties.Settings.Default.password)));
                client.EnableSsl = Properties.Settings.Default.mailServerUseSSL;

                using (MailMessage msg = new MailMessage())
                {
                    msg.From = new MailAddress(replacePlaceholder(Properties.Settings.Default.from));
                    msg.Subject = replacePlaceholder(Properties.Settings.Default.subject);
                    msg.Body = replacePlaceholder(Properties.Settings.Default.body);
                    msg.To.Add(new MailAddress(replacePlaceholder(Properties.Settings.Default.to)));

                    client.Send(msg);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Пример #4
0
 void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
 {
     if (Properties.Settings.Default.username == string.Empty || Properties.Settings.Default.password == string.Empty || Properties.Settings.Default.phonenumber == string.Empty)
     {
         System.Windows.Forms.MessageBox.Show("Please setup your credentials and phonenumber in the style settings first");
         return;
     }
     WebClient client = new WebClient ();
     client.Headers.Add ("user-agent", "Snarl style to send SMS");
     client.QueryString.Add("user", Properties.Settings.Default.username);
     client.QueryString.Add("password", Crypto.ToInsecureString(Crypto.DecryptString(Properties.Settings.Default.password)));
     client.QueryString.Add("api_id", "3212636");
     client.QueryString.Add("to", Properties.Settings.Default.phonenumber);
     client.QueryString.Add("text", NotificationInfo.Title + " :" + NotificationInfo.Text);
     string baseurl ="https://api.clickatell.com/http/sendmsg";
     Stream data = client.OpenRead(baseurl);
     StreamReader reader = new StreamReader (data);
     string s = reader.ReadToEnd ();
     data.Close ();
     reader.Close ();
     if(!s.ToLower().StartsWith("id")) {
         System.Windows.Forms.MessageBox.Show("Error in sending - response from clickatell:\n" + s);
     }
     return;
 }
Пример #5
0
        void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
        {
            snarlText  = NotificationInfo.Text;
            snarlTitle = NotificationInfo.Title;

            if (Properties.Settings.Default.mailServerHost == string.Empty || Properties.Settings.Default.username == string.Empty)
            {
                MessageBox.Show("Please set at least a mail server host and a username");
                return;
            }

            try
            {
                SmtpClient client = new SmtpClient(Properties.Settings.Default.mailServerHost, Properties.Settings.Default.mailServerPort);

                client.Credentials = new NetworkCredential(Properties.Settings.Default.username, Crypto.ToInsecureString(Crypto.DecryptString(Properties.Settings.Default.password)));
                client.EnableSsl   = Properties.Settings.Default.mailServerUseSSL;

                using (MailMessage msg = new MailMessage())
                {
                    msg.From    = new MailAddress(replacePlaceholder(Properties.Settings.Default.from));
                    msg.Subject = replacePlaceholder(Properties.Settings.Default.subject);
                    msg.Body    = replacePlaceholder(Properties.Settings.Default.body);
                    msg.To.Add(new MailAddress(replacePlaceholder(Properties.Settings.Default.to)));

                    client.Send(msg);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Пример #6
0
        void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
        {
            string myUpdate = NotificationInfo.Title + " - " + NotificationInfo.Text;
            if (myUpdate.Length > 140)
            {
                myUpdate = myUpdate.Substring(0, 137) + "...";
            }

            try
            {
                var twitter = FluentTwitter.CreateRequest()
                    .AuthenticateWith(Settings.Default.ConsumerKey, Settings.Default.ConsumerSecret,
                                      Settings.Default.AccessToken, Settings.Default.AccessTokenSecret)
                    .Account().VerifyCredentials();

                var response = twitter.Request();
                var profile = response.AsUser();

                if (profile != null)
                {

                    var twitterPost = FluentTwitter.CreateRequest()
                    .AuthenticateWith(Settings.Default.ConsumerKey, Settings.Default.ConsumerSecret,
                                      Settings.Default.AccessToken, Settings.Default.AccessTokenSecret)
                                      .Statuses().Update(myUpdate);
                    var postresponse = twitterPost.Request();
                }
            }
            catch
            {
                MessageBox.Show("Error in sending notification to Twitter", "Error sending to Twitter", MessageBoxButton.OK);
            }
        }
Пример #7
0
        void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
        {
            // MessageBox.Show("UpdateContent");
            try
            {
                if (myDisplay == null)
                {
                    myDisplay = new BeezleDisplay();
                }
                if (myDisplay.isClosing)
                {
                    myDisplay.stopClosing();
                }
                myDisplay.setNewIconPath(NotificationInfo.Icon);
                myDisplay.setPriority(false);
                if (NotificationInfo.Flags == S_NOTIFICATION_FLAGS.S_NOTIFICATION_IS_PRIORITY)
                {
                    myDisplay.setPriority(true);
                }



                switch (NotificationInfo.Scheme)
                {
                case "icon only":
                    myDisplay.showIconOnly();
                    break;

                case "title":
                    myDisplay.showText(NotificationInfo.Title);
                    break;

                case "text":
                    myDisplay.showText(NotificationInfo.Text);
                    break;

                case "meter":
                    myDisplay.showProgressBar(parseTextForPercentage(NotificationInfo.Text));
                    break;

                default:
                    myDisplay.showIconOnly();
                    break;
                }

                myDisplay.startTimer(5);
            }
            catch
            {
                Console.WriteLine("Mist");
            }
        }
Пример #8
0
        void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
        {
            // MessageBox.Show("UpdateContent");
            try
            {
                if (myDisplay == null)
                {
                    myDisplay = new BeezleDisplay();
                }
                if (myDisplay.isClosing)
                {
                    myDisplay.stopClosing();
                }
                myDisplay.setNewIconPath(NotificationInfo.Icon);
                myDisplay.setPriority(false);
                if (NotificationInfo.Flags == S_NOTIFICATION_FLAGS.S_NOTIFICATION_IS_PRIORITY)
                {
                    myDisplay.setPriority(true);
                }

                switch (NotificationInfo.Scheme)
                {
                    case "icon only":
                        myDisplay.showIconOnly();
                        break;

                    case "title":
                        myDisplay.showText(NotificationInfo.Title);
                        break;

                    case "text":
                        myDisplay.showText(NotificationInfo.Text);
                        break;

                    case "meter":
                        myDisplay.showProgressBar(parseTextForPercentage(NotificationInfo.Text));
                        break;

                    default:
                        myDisplay.showIconOnly();
                        break;
                }

                myDisplay.startTimer(5);
            }
            catch
            {
                Console.WriteLine("Mist");
            }
        }
Пример #9
0
        void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
        {
            // translate the incoming notification_info into something more useful, then call 
            // sendContent() which can be overridden by implementing classes...
            Dictionary<string, string> content = _packedStrToDictionary(NotificationInfo.Text);
            string strPriority = _SafeGetValue(content, "priority", "0");
            int intPriority = 0;

            try
            {
                intPriority = int.Parse(strPriority);
            }
            catch
            {
            }

            this.SendContent(NotificationInfo.Title, NotificationInfo.Scheme, content, NotificationInfo.Icon, intPriority);
        }
Пример #10
0
 void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
 {
     snarlText = NotificationInfo.Text;
     snarlTitle = NotificationInfo.Title;
 }
Пример #11
0
 public void UpdateContent(ref notification_info NotificationInfo)
 {
     System.Windows.Forms.MessageBox.Show(NotificationInfo.Text, NotificationInfo.Title, System.Windows.Forms.MessageBoxButtons.OK);
 }