Exemplo n.º 1
0
 public Notification(AlertMessage am)
 {
     switch (am.IconType)
     {
     default:
         alertImage = DefaultProperties.ReturnImage(DefaultProperties.SecurityAlertIcon);
         break;
     }
     siteName = am.Headline;
     status   = am.Message;
     if (am.PublishedDate.HasValue)
     {
         int days = (int)DateTime.Now.Subtract(am.PublishedDate.Value).TotalDays;
         if (days >= 365)
         {
             status = string.Format((string)Application.Current.Resources["OldPasswordDesktop"], days);
         }
     }
     uuid         = am.UUID;
     AlertMessage = am;
 }
Exemplo n.º 2
0
 private void ChangeImage(string resource)
 {
     ProductTourCurrentImage = DefaultProperties.ReturnImage(resource);
 }
        public Alert(AlertNotification an)
        {
            resolver = ((PBApp)Application.Current).GetResolver();
            if (resolver != null)
            {
                pbData = resolver.GetInstanceOf <IPBData>();
            }

            string path = AppHelper.ImageFolderLocation + an.image_id + ".png";

            if (File.Exists(path))
            {
                alertImage  = c.GetImageForPath(path, loadDefaultIfNeeded: false);
                icon_width  = 60;
                icon_height = 40;
            }
            else
            {
                alertImage  = DefaultProperties.ReturnImage(DefaultProperties.SecurityAlertIcon);
                icon_width  = 21;
                icon_height = 18;
            }
            if (an.AlertType == AlertType.SecurityAlert)
            {
                siteName = an.site_name;
                if (an.has_duplicate)
                {
                    status = (string)Application.Current.Resources["DuplicatePassword"];
                }
                else if (an.is_weak)
                {
                    status = (string)Application.Current.Resources["WeakPassword"];
                }
                else if (an.last_password_change.HasValue)
                {
                    int days = (int)DateTime.Now.Subtract(an.last_password_change.Value).TotalDays;
                    if (days >= 365)
                    {
                        status = string.Format((string)Application.Current.Resources["OldPasswordDesktop"], days);
                    }
                }
            }
            else if (an.AlertType == AlertType.NewShare)
            {
                siteName = an.CustomMessage;
                if (pbData != null)
                {
                    email   = an.sender == pbData.ActiveUser ? an.receiver : an.sender;
                    visible = true;
                }
                status      = an.nickname;// an.message;
                shareStatus = an.status;
                uuid        = an.id;
                alertImage  = (ImageSource)Application.Current.FindResource("imgShare2Hover");
                icon_width  = 21;
                icon_height = 18;
            }
            if (uuid == null)
            {
                uuid = an.secure_item_id;
            }
            AlertNotification = an;
        }