private void listboxMenu_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            ListBoxItem item = (ListBoxItem)listboxMenu.SelectedValue;

            if (item != null)
            {
                switch (item.Content.ToString())
                {
                case "New Login":
                    listboxMenu.Visibility    = Visibility.Hidden;
                    listboxLoginAs.Visibility = Visibility.Hidden;
                    MenuButtonImage.Source    = new BitmapImage(new Uri("/Resources/Pictures/menu.png", UriKind.Relative));
                    WebLogin WebLogin1 = new WebLogin();
                    WebLogin1.RaiseCustomEvent += new EventHandler <CustomEventArgs>(WebLogin1_RaiseCustomEvent);
                    WebLogin1.Show();
                    listboxMenu.UnselectAll();
                    break;

                case "Login as...":
                    if (UserManager1.GetListOfUsers().Count > 0)
                    {
                        listboxLoginAs.Visibility = Visibility.Visible;
                        ObservableCollection <User> oUsers = new ObservableCollection <User>(UserManager1.GetListOfUsers());
                        listboxLoginAs.DataContext = oUsers;
                        Binding binding = new Binding();
                        listboxLoginAs.SetBinding(ListBox.ItemsSourceProperty, binding);
                    }
                    break;
                }
            }
        }
 public void GetAndUpdateList_IDOfFirstAndFourthUsersShouldBeTheSameInBothListAndInsertedArray()
 {
     UserManager.UserManager users = new UserManager.UserManager();
     List<User> userList = new List<User>();
     userList.AddRange(new User[] { new User("1"), new User("2"), new User("3"), new User("4")});
     users.UpdateUserList(userList);
     Assert.AreEqual("1", users.GetListOfUsers()[0].ID);
     Assert.AreEqual("4", users.GetListOfUsers()[3].ID);
 }
Example #3
0
        public void GetAndUpdateList_IDOfFirstAndFourthUsersShouldBeTheSameInBothListAndInsertedArray()
        {
            UserManager.UserManager users    = new UserManager.UserManager();
            List <User>             userList = new List <User>();

            userList.AddRange(new User[] { new User("1"), new User("2"), new User("3"), new User("4") });
            users.UpdateUserList(userList);
            Assert.AreEqual("1", users.GetListOfUsers()[0].ID);
            Assert.AreEqual("4", users.GetListOfUsers()[3].ID);
        }