Beispiel #1
0
        private void HandleShowBallon(object sender, ShowBalloonEventArgs e)
        {
            _growlNotifications.AddNotification(new Notification
            {
                Title    = e.Title,
                ImageUrl = e.ToastImageResource,    //"pack://application:,,,/Wpf/Resources/bolt_32x32.png",
                Message  = e.Message
            });

            _notifyIcon.Icon = e.TrayIcon;
            //_notifyIcon.ShowBalloonTip(e.Timeout,e.Title,e.Message,ToolTipIcon.None);
        }
Beispiel #2
0
        //todo: unit test.
        private void HandleUserMessageServiceReceivedMessages(object sender, Core.Services.AsyncCompletedEventArgs <ICollection <UserMessageReceipt> > e)
        {
            if (e.Error != null || e.Result == null)
            {
                return;
            }

            foreach (UserMessageReceipt message in e.Result)
            {
                _growlNotifiactions.AddNotification(new Notification()
                {
                    ImageUrl = "pack://application:,,,/Wpf/Resources/mail_24x18.png",
                    Message  =
                        string.Format("{0} | {1} : {2}", message.FromName, message.SendTime, message.Message),
                    Title = "Time Warp Message"
                });
            }
        }
Beispiel #3
0
        public void pushNotification(dynamic tootNotification /*, int type*/)
        {
            String typeStr = tootNotification["type"];

            if (typeStr == null)
            {
                return;
            }

            if (typeStr == "favourite")
            {
                typeStr = "favorited your post";
            }
            else if (typeStr == "mention")
            {
                typeStr = "mentioned you";
            }
            else if (typeStr == "reblog")
            {
                typeStr = "boosted you";
            }
            else
            {
                Console.WriteLine("Unhandled type: " + typeStr);
                return;
            }

            /*if (type == 0)
             *  typeStr = "mentioned you.";
             * else if (type == 1)
             *  typeStr = "sent you a direct message.";
             * dynamic user;
             * if (type == 1)
             *  user = tootNotification["sender"];
             * else
             *  user = tootNotification["account"];*/

            dynamic user = tootNotification["account"];

            dynamic toot = tootNotification["status"];

            String content = toot["content"];

            content = Regex.Replace(content, "<.*?>", String.Empty);

            Notification notification = new Notification {
                Title    = (String)user["display_name"] + " (" + "@" + (String)user["acct"] + ") " + typeStr,
                ImageUrl = ((String)user["avatar"]),
                Message  = content
            };

            growlNotifications.AddNotification(notification);

            /*MentionsNotification notification = new MentionsNotification();
             * notification.tootCell.tootID = tootNotification["id_str"];
             * notification.tootCell.entities = tootNotification["entities"];
             *
             * dynamic user = tootNotification["user"];
             * Uri ImageURL = (Uri)user["profile_image_url_https"];
             *
             * notification.tootCell.nameLabel.Content = user["name"];
             * notification.tootCell.handleLabel.Content = "@" + (String)user["screen_name"];
             * notification.tootCell.userHandle = (String)user["screen_name"];
             *
             * notification.tootCell.tootText.Text = WebUtility.HtmlDecode((String)tootNotification["text"]);
             *
             * BitmapImage profilePic = new BitmapImage();
             * profilePic.BeginInit();
             * profilePic.UriSource = ImageURL;
             * profilePic.CacheOption = BitmapCacheOption.OnLoad;
             * profilePic.EndInit();
             * notification.tootCell.profilePic.Source = profilePic;
             *
             * notification.tootCell.tootText.Arrange(new Rect(0, 0, notification.tootCell.tootText.Width, 1000));
             * double pageHeight = notification.tootCell.tootText.DesiredSize.Height;
             * //cell.tootText.Height = pageHeight + 10;
             * notification.tootCell.Height = 10 + pageHeight;
             * notification.Height = notification.tootCell.Height + 24;
             *
             * Rect desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
             * if (notifications.Count > 0)
             *  notification.Top = notifications[notifications.Count - 1].Top - (notifications[notifications.Count - 1].ActualHeight + 5);
             * else
             *  notification.Top = desktopWorkingArea.Height - (notification.Height + 40);
             * notification.Left = desktopWorkingArea.Width - notification.Width;
             *
             * Console.WriteLine("Showing notification!");
             *
             * notification.Show();
             * notifications.Add(notification);*/
        }
        void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (lblCustID.Text == "-")
                {
                    if (txtCustomerName.Text.Trim() == string.Empty)
                    {
                        growlNotifications.AddNotification(new Notification {
                            Title = "Mensaje de Alerta", Message = "Por favor inserte el nombre del cliente", ImageUrl = "pack://application:,,,/Notifications/Radiation_warning_symbol.png"
                        });
                        txtCustomerName.Focus();
                    }
                    else if (txtPhone.Text.Trim() == string.Empty)
                    {
                        growlNotifications.AddNotification(new Notification {
                            Title = "Mensaje de Alerta", Message = "Por favor inserte Contacto", ImageUrl = "pack://application:,,,/Notifications/Radiation_warning_symbol.png"
                        });
                        txtPhone.Focus();
                    }
                    else if (CombType.Text.Trim() == string.Empty)
                    {
                        growlNotifications.AddNotification(new Notification {
                            Title = "Mensaje de Alerta", Message = "Por favor inserte el Tipo", ImageUrl = "pack://application:,,,/Notifications/Radiation_warning_symbol.png"
                        });
                        CombType.Focus();
                    }
                    else if (txtCity.Text.Trim() == string.Empty)
                    {
                        growlNotifications.AddNotification(new Notification {
                            Title = "Mensaje de Alerta", Message = "Por favor inserte la Ciudad", ImageUrl = "pack://application:,,,/Notifications/Radiation_warning_symbol.png"
                        });
                        txtCity.Focus();
                    }
                    else if (txtCustomerAddress.Text.Trim() == string.Empty)
                    {
                        growlNotifications.AddNotification(new Notification {
                            Title = "Mensaje de Alerta", Message = "Por favor inserte la dirección", ImageUrl = "pack://application:,,,/Notifications/Radiation_warning_symbol.png"
                        });
                        txtCustomerAddress.Focus();
                    }
                    else
                    {
                        var sqlCmd = "insert into tbl_customer (name, emailaddress, phone, address, city, peopletype ) " +
                                     " values ('" + txtCustomerName.Text + "', '" + txtEmailAddress.Text + "', '" + txtPhone.Text + "', '" + txtCustomerAddress.Text + "', "
                                     + " '" + txtCity.Text + "', '" + CombType.SelectedValue.ToString() + "')";
                        DataAccess.ExecuteSQL(sqlCmd);
                        lblmsg.Text = "Guardado con éxito";
                        CustomerDatabind();
                        clearform();
                    }
                }
                else  //Update
                {
                    var sqlUpdateCmd = "update tbl_customer set name = '" + txtCustomerName.Text + "', emailaddress= '" + txtEmailAddress.Text + "', " +
                                       " address = '" + txtCustomerAddress.Text + "', phone = '" + txtPhone.Text + "', city = '" + txtCity.Text + "' , " +
                                       " peopletype = '" + CombType.SelectedValue.ToString() + "'   where id = '" + lblCustID.Text + "'";
                    DataAccess.ExecuteSQL(sqlUpdateCmd);
                    growlNotifications.AddNotification(new Notification {
                        Title = "Wow", Message = "Actualizado exitosamente", ImageUrl = "pack://application:,,,/Notifications/notification-icon.png"
                    });

                    // lblmsg.Text = "Actualizado exitosamente";
                    DetailsData(lblCustID.Text);
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show("Lo sentimos\r\n este identificador ya ha sido agregado \n\n " + exp.Message);
            }
        }
 private void ButtonClick1(object sender, RoutedEventArgs e)
 {
     growlNotifications.AddNotification(new Notification {
         Title = "Mesage #1", ImageUrl = "pack://application:,,,/Resources/notification-icon.png", Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
     });
 }
        public void pushNotification(dynamic tootNotification /*, int type*/)
        {
            String typeStr = tootNotification["type"];

            if (typeStr == null)
            {
                return;
            }

            if (typeStr == "favourite")
            {
                typeStr = "favorited your post";
            }
            else if (typeStr == "mention")
            {
                typeStr = "mentioned you";
            }
            else if (typeStr == "reblog")
            {
                typeStr = "boosted you";
            }
            else
            {
                Console.WriteLine("Unhandled type: " + typeStr);
                return;
            }

            /*if (type == 0)
             *  typeStr = "mentioned you.";
             * else if (type == 1)
             *  typeStr = "sent you a direct message.";
             * dynamic user;
             * if (type == 1)
             *  user = tootNotification["sender"];
             * else
             *  user = tootNotification["account"];*/

            dynamic user = tootNotification["account"];

            dynamic toot = tootNotification["status"];

            String content = toot["content"];

            content = Regex.Replace(content, "<.*?>", String.Empty);

            if (currentOS.IsEqualTo(OsVersion.Win7))
            {
                WPFGrowlNotification.Notification notification = new WPFGrowlNotification.Notification
                {
                    Title    = (String)user["display_name"] + " (" + "@" + (String)user["acct"] + ") " + typeStr,
                    ImageUrl = ((String)user["avatar"]),
                    Message  = content
                };
                growlNotifications.AddNotification(notification);
                PlaySound();
            }
            else
            {
                // Construct notification
                WebClient webClient = new WebClient();
                String    tempFile  = Path.GetTempFileName();
                webClient.DownloadFileCompleted += (sender, e) =>
                {
                    ToastVisual visual = new ToastVisual()
                    {
                        BindingGeneric = new ToastBindingGeneric()
                        {
                            Children =
                            {
                                new AdaptiveText()
                                {
                                    Text         = (String)user["display_name"] + " " + typeStr,
                                    HintMaxLines = 3
                                },

                                new AdaptiveText()
                                {
                                    Text = WebUtility.HtmlDecode(content)
                                }
                            },

                            /*Attribution = new ToastGenericAttributionText()
                             * {
                             *  Text = $"Via {(String)toot["application"]["name"]}"
                             * },*/

                            AppLogoOverride = new ToastGenericAppLogo()
                            {
                                Source   = tempFile,
                                HintCrop = ToastGenericAppLogoCrop.Circle
                            }
                        }
                    };

                    ToastAudio toastAudio = new ToastAudio();
                    toastAudio.Src = new Uri("pack://*****:*****@" + (String)user["screen_name"];
             * notification.tootCell.userHandle = (String)user["screen_name"];
             *
             * notification.tootCell.tootText.Text = WebUtility.HtmlDecode((String)tootNotification["text"]);
             *
             * BitmapImage profilePic = new BitmapImage();
             * profilePic.BeginInit();
             * profilePic.UriSource = ImageURL;
             * profilePic.CacheOption = BitmapCacheOption.OnLoad;
             * profilePic.EndInit();
             * notification.tootCell.profilePic.Source = profilePic;
             *
             * notification.tootCell.tootText.Arrange(new Rect(0, 0, notification.tootCell.tootText.Width, 1000));
             * double pageHeight = notification.tootCell.tootText.DesiredSize.Height;
             * //cell.tootText.Height = pageHeight + 10;
             * notification.tootCell.Height = 10 + pageHeight;
             * notification.Height = notification.tootCell.Height + 24;
             *
             * Rect desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
             * if (notifications.Count > 0)
             *  notification.Top = notifications[notifications.Count - 1].Top - (notifications[notifications.Count - 1].ActualHeight + 5);
             * else
             *  notification.Top = desktopWorkingArea.Height - (notification.Height + 40);
             * notification.Left = desktopWorkingArea.Width - notification.Width;
             *
             * Console.WriteLine("Showing notification!");
             *
             * notification.Show();
             * notifications.Add(notification);*/
        }