Пример #1
0
        private void AddInitData()
        {
            using (var context = new DatabaseContext())
            {
                context.Messengers.Add(new Messenger("rajzfilm", "pack://application:,,,/Resources/Images/demo images/cartoons.jpg", SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("macska", "pack://application:,,,/Resources/Images/demo images/cat.jpg", SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("sok", "pack://application:,,,/Resources/Images/demo images/many.jpg", SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("film", "pack://application:,,,/Resources/Images/demo images/movie.jpg", SessionViewModel.User.Username));

                Messenger foods = new Messenger("ételek", "pack://application:,,,/Resources/Images/demo images/foods/food.jpg", SessionViewModel.User.Username);
                foods.AddChild(new Messenger("éhes", "pack://application:,,,/Resources/Images/demo images/foods/hungry.jpg", SessionViewModel.User.Username));
                foods.AddChild(new Messenger("narancs", "pack://application:,,,/Resources/Images/demo images/foods/orange.jpg", SessionViewModel.User.Username));
                foods.AddChild(new Messenger("szendvics", "pack://application:,,,/Resources/Images/demo images/foods/sandwich.jpg", SessionViewModel.User.Username));
                foods.AddChild(new Messenger("leves", "pack://application:,,,/Resources/Images/demo images/foods/soup.jpg", SessionViewModel.User.Username));
                foods.AddChild(new Messenger("szomjas", "pack://application:,,,/Resources/Images/demo images/foods/thirsty.jpg", SessionViewModel.User.Username));
                context.Messengers.Add(foods);

                context.Messengers.Add(new Messenger("fáradt", "pack://application:,,,/Resources/Images/demo images/tired.jpg", SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("ma", "pack://application:,,,/Resources/Images/demo images/today.jpg", SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("fogkefe", "pack://application:,,,/Resources/Images/demo images/toothbrush.jpg", SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("tegnap", "pack://application:,,,/Resources/Images/demo images/yesterday.jpg", SessionViewModel.User.Username));

                Messenger games = new Messenger("játékok", "pack://application:,,,/Resources/Images/demo images/game/game.jpg", SessionViewModel.User.Username);
                games.AddChild(new Messenger("labda", "pack://application:,,,/Resources/Images/demo images/game/ball.jpg", SessionViewModel.User.Username));
                games.AddChild(new Messenger("lufi", "pack://application:,,,/Resources/Images/demo images/game/balloons.jpg", SessionViewModel.User.Username));
                games.AddChild(new Messenger("játszani", "pack://application:,,,/Resources/Images/demo images/game/play.jpg", SessionViewModel.User.Username));
                games.AddChild(new Messenger("medence", "pack://application:,,,/Resources/Images/demo images/game/pool.jpg", SessionViewModel.User.Username));
                context.Messengers.Add(games);

                Messenger school = new Messenger("iskola", "pack://application:,,,/Resources/Images/demo images/school/school.jpg", SessionViewModel.User.Username);
                school.AddChild(new Messenger("barát", "pack://application:,,,/Resources/Images/demo images/school/friend.jpg", SessionViewModel.User.Username));
                school.AddChild(new Messenger("papír", "pack://application:,,,/Resources/Images/demo images/school/paper.jpg", SessionViewModel.User.Username));
                school.AddChild(new Messenger("toll", "pack://application:,,,/Resources/Images/demo images/school/pen.jpg", SessionViewModel.User.Username));
                school.AddChild(new Messenger("ceruza", "pack://application:,,,/Resources/Images/demo images/school/pencil.jpg", SessionViewModel.User.Username));
                school.AddChild(new Messenger("iskola táska", "pack://application:,,,/Resources/Images/demo images/school/school bag.jpg", SessionViewModel.User.Username));
                Messenger study = new Messenger("tanulás", "pack://application:,,,/Resources/Images/demo images/school/study/study.jpg", SessionViewModel.User.Username);
                study.AddChild(new Messenger("számítógép", "pack://application:,,,/Resources/Images/demo images/school/study/computer.jpg", SessionViewModel.User.Username));
                study.AddChild(new Messenger("könyv", "pack://application:,,,/Resources/Images/demo images/school/study/book.jpg", SessionViewModel.User.Username));
                school.AddChild(study);
                context.Messengers.Add(school);

                context.Messengers.Add(new Messenger("szia!", "pack://application:,,,/Resources/Images/demo images/basic/hello.jpg", MessengerType.pinned, SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("viszlát!", "pack://application:,,,/Resources/Images/demo images/basic/goodbye.jpg", MessengerType.pinned, SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("igen", "pack://application:,,,/Resources/Images/demo images/basic/yes.jpg", MessengerType.pinned, SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("nem", "pack://application:,,,/Resources/Images/demo images/basic/no.jpg", MessengerType.pinned, SessionViewModel.User.Username));
                context.Messengers.Add(new Messenger("köszönöm!", "pack://application:,,,/Resources/Images/demo images/basic/thank you.jpg", MessengerType.pinned, SessionViewModel.User.Username));
                context.SaveChanges();
            }
        }
Пример #2
0
 private void SetRootObjects()
 {
     if (IsSharingSession)
     {
         return;
     }
     foreach (Messenger msg in DatabaseContextUtility.LoadAllGeneralMessenger())
     {
         GeneralRootMessenger.AddChild(msg);
     }
     if (!Messengers.Contains(GeneralRootMessenger))
     {
         Messengers.Add(GeneralRootMessenger);
     }
     foreach (Messenger msg in DatabaseContextUtility.GetPinnedMessengers())
     {
         PinnedRootMessenger.AddChild(msg);
     }
     if (!Messengers.Contains(PinnedRootMessenger))
     {
         Messengers.Add(PinnedRootMessenger);
     }
 }