Beispiel #1
0
        protected override NotificationViewsList getRandomObject()
        {
            var l = new NotificationsList(getRandomNotificationDbRecordsList(),
                                          GetRandom.Object <RepositoryPage>());

            SetRandom.Values(l);
            return(new NotificationViewsList(l));
        }
        public IEnumerable <INotification> GetNotificationsToRemove(NotificationsList notifications)
        {
            var notificationsToRemove = notifications
                                        .Where(x => x.Value.Notification.DisplayPart.GetOptions().Tag == _tag)
                                        .Select(x => x.Value.Notification)
                                        .ToList();

            return(notificationsToRemove);
        }
Beispiel #3
0
        private void seed()
        {
            List <NotificationModel> seedList = new List <NotificationModel>();

            seedList.Add(new NotificationModel("someOne", "testUser", "", "Follow"));
            seedList.Add(new NotificationModel("someOne2", "testUser", "1234", "Like"));

            NotificationsList.Add("testUser", seedList);
        }
Beispiel #4
0
        public IEnumerable <INotification> GetNotificationsToRemove(NotificationsList notifications)
        {
            var notificationsToRemove = notifications
                                        .Select(x => x.Value.Notification)
                                        .Where(x => x.Message == _message)
                                        .ToList();

            return(notificationsToRemove);
        }
Beispiel #5
0
        public bool CheckNotification(string connectionId)
        {
            if (NotificationsList.ContainsKey(connectionId))
            {
                return(true);
            }

            return(false);
        }
Beispiel #6
0
 private void LoadNotifications(List <StudentData> Notifications)
 {
     foreach (var notif in Notifications)
     {
         NotificationsList.SetItemSubItems(notif.Name, notif.Registros.Matricula.ToString());
         NotificationsList.SetItemSubItems(notif.Name, notif.Registros.Hora_Entrada);
         NotificationsList.SetItemSubItems(notif.Name, notif.Registros.Hora_Salida);
     }
 }
        public IEnumerable <INotification> GetNotificationsToRemove(NotificationsList notifications)
        {
            var notificationsToRemove = notifications
                                        .Where(x => x.Value.Notification.Options.Tag.Equals(_tag))
                                        .Select(x => x.Value.Notification)
                                        .ToList();

            return(notificationsToRemove);
        }
Beispiel #8
0
        public IEnumerable <INotification> GetNotificationsToRemove(NotificationsList notifications)
        {
            if (notifications.IsEmpty)
            {
                return(Enumerable.Empty <INotification>());
            }

            var lastMessage = notifications.LastOrDefault().Value.Notification;

            return(new[] { lastMessage });
        }
Beispiel #9
0
 public void AddNotification(NotificationModel notificationModel)
 {
     if (NotificationsList.ContainsKey(notificationModel.TargetClient))
     {
         NotificationsList[notificationModel.TargetClient].Add(notificationModel);;
     }
     else
     {
         List <NotificationModel> list = new List <NotificationModel>();
         list.Add(notificationModel);
         NotificationsList.Add(notificationModel.TargetClient, list);
     }
 }
 private void RecomputeLayout()
 {
     Dispatcher.Invoke(((Action)(() =>
     {
         if (NotificationsList.GetItemCount() == 0)
         {
             this.Visibility = Visibility.Collapsed;
         }
         else
         {
             this.Visibility = Visibility.Visible;
         }
     })), DispatcherPriority.Render);
 }
Beispiel #11
0
        private void Editar_Click(object sender, EventArgs e)
        {
            //buscar registro
            Registro TempReg = new Registro();

            TempReg = DM.GetLastRegistroAddedByMatricula(int.Parse(NotificationsList.GetSubItemsFromSelectedIndex(1)));
            //modificarlo
            TempReg.Hora_Salida = Hora_S.Text;
            //guardar
            DM.UpdateFromNotification(TempReg);
            //eliminarlo de la lista
            DeleteSelectedIndex(false, NotificationsList.SelectedIndices);
            NotificationsList.DeleteSelectedIndex(false);
        }
Beispiel #12
0
        public static async Task <NotificationsList> GetNotifications()
        {
            NotificationsList notifications = new NotificationsList();
            HttpClient        client        = new HttpClient();

            client.DefaultRequestHeaders.Authorization = System.Net.Http.Headers.AuthenticationHeaderValue.Parse("Bearer " + await oAuth.GetAccessToken());
            client.DefaultRequestHeaders.Add("User-Agent", "google-oauth-playground");

            string      postData = "{\n\"maxResults\":10\n}";
            HttpContent content  = new StringContent(postData);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            HttpResponseMessage response = await client.PostAsync(new Uri(NOTIFICATION_API), content);

            if (response.IsSuccessStatusCode == true)
            {
                var result = JObject.Parse(await response.Content.ReadAsStringAsync());
                notifications.lastReadTime      = Convert.ToString((long)result["notificationsData"]["lastReadTime"]);
                notifications.continuationToken = (string)result["notificationsData"]["continuationToken"];
                foreach (var i in result["notificationsData"]["coalescedItem"])
                {
                    Notification notification = new Notification();
                    notification.id          = (string)i["id"];
                    notification.timestamp   = superKonweterKurwo((string)i["timestamp"]);
                    notification.title       = (string)i["entityData"]["summarySnippet"]["heading"];
                    notification.description = (string)i["entityData"]["summarySnippet"]["description"];
                    notification.isRead      = (bool)i["isRead"];
                    switch ((string)i["category"])
                    {
                    case "STREAM": notification.postID = (string)i["entityReference"];
                        break;

                    case "SQUARE": try { notification.communityID = (string)i["entityData"]["squares"]["subscription"].First()["square"]["oid"]; }
                        catch { }
                        break;

                    case "CIRCLE": notification.userID = (string)i["entityReference"];
                        break;
                    }
                    notifications.list.Add(notification);
                }
                return(notifications);
                //return await response.Content.ReadAsStringAsync();
            }
            else
            {
                return(null);
            }
        }
Beispiel #13
0
        public IEnumerable <INotification> GetNotificationsToRemove(NotificationsList notifications)
        {
            var notificationsToRemove = notifications
                                        .Select(x => x.Value.Notification)
                                        .Where(x =>
            {
                object otherTag = x.Options.Tag;
                if (ReferenceEquals(otherTag, null))
                {
                    return(ReferenceEquals(_tag, null));
                }
                else
                {
                    return(otherTag.Equals(_tag));
                }
            })
                                        .ToList();

            return(notificationsToRemove);
        }
 public void CloseNotification(NotificationDisplayPart notification)
 {
     NotificationsList.RemoveNotification(notification);
     RecomputeLayout();
 }
 public void ShowNotification(NotificationDisplayPart notification)
 {
     NotificationsList.AddNotification(notification);
     RecomputeLayout();
 }
Beispiel #16
0
 public void clearNotifications(string userName)
 {
     NotificationsList.Remove(userName);
 }
Beispiel #17
0
 private void Eliminar_Click(object sender, EventArgs e)
 {
     ListView.SelectedListViewItemCollection v = NotificationsList.SelectedItems;
     DeleteSelectedIndex(false, NotificationsList.SelectedIndices);
     NotificationsList.DeleteSelectedIndex(false);
 }
Beispiel #18
0
 private void DeleteSelectedIndex(bool All, ListView.SelectedIndexCollection Selection)
 {
     if (All)
     {
         for (int i = Notifiy.Count - 1; i >= 0; i--)
         {
             Notifiy.RemoveAt(i);
         }
     }
     else
     {
         if (Selection.Count <= 1)
         {
             if (((StudentData)Notifiy[Selection[0]]).Registros.Matricula.CompareTo(int.Parse(NotificationsList.GetSubItemsFromSelectedIndex(1))) != 1)
             {
                 Notifiy.RemoveAt(Selection[0]);
             }
         }
         else
         {
             for (int i = Selection.Count - 1; i >= 0; i--)
             {
                 Notifiy.RemoveAt(Selection[i]);
             }
         }
     }
 }
Beispiel #19
0
 private void EliminaHorario_Click(object sender, EventArgs e)
 {
     DeleteSelectedIndex(true, NotificationsList.SelectedIndices);
     NotificationsList.DeleteSelectedIndex(true);
 }
Beispiel #20
0
 public IEnumerable <INotification> GetNotificationsToRemove(NotificationsList notifications)
 {
     return(notifications.Select(x => x.Value.Notification));
 }