コード例 #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
ファイル: StyleInstance.cs プロジェクト: svenwal/sayHello
        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
ファイル: StyleInstance.cs プロジェクト: TlhanGhun/mailMe
        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
ファイル: StyleInstance.cs プロジェクト: TlhanGhun/SnarlSMS
 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
ファイル: StyleInstance.cs プロジェクト: TlhanGhun/Tweet-it
        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
ファイル: StyleInstance.cs プロジェクト: svenwal/Hover
        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
ファイル: StyleInstance.cs プロジェクト: TlhanGhun/Hover
        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
ファイル: StyleEngine.cs プロジェクト: fullphat/netredirect
        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
ファイル: StyleInstance.cs プロジェクト: TlhanGhun/runMe
 void IStyleInstance.UpdateContent(ref notification_info NotificationInfo)
 {
     snarlText = NotificationInfo.Text;
     snarlTitle = NotificationInfo.Title;
 }
コード例 #11
0
ファイル: StyleInstance.cs プロジェクト: svenwal/mySnarlStyle
 public void UpdateContent(ref notification_info NotificationInfo)
 {
     System.Windows.Forms.MessageBox.Show(NotificationInfo.Text, NotificationInfo.Title, System.Windows.Forms.MessageBoxButtons.OK);
 }