Ejemplo n.º 1
0
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            BindingGroup bindingGroup = value as BindingGroup;

            if (bindingGroup.Items.Count == 1)
            {
                object          item      = bindingGroup.Items[0];
                MemberViewModel viewModel = item as MemberViewModel;
                if (!viewModel.AreRequiredFieldsFilled())
                {
                    return(new ValidationResult(false, "Some of the required fields are not set!"));
                }
            }
            return(ValidationResult.ValidResult);
        }
        private void InitializeFields()
        {
            List <string> roles = new List <string>();
            Task          t     = Task.Factory.StartNew(() =>
            {
                MemberViewModel = new MemberViewModel();
                roles           = MemberViewModel.GetRoles();

                CheckedTeams = new ObservableCollection <CheckedItem>();
                MemberViewModel.GetTeams().ForEach(x => CheckedTeams.Add(x));
            });
            Task t2 = t.ContinueWith(antecedent =>
            {
                DataContext            = MemberViewModel;
                lbTeam.DataContext     = CheckedTeams;
                cbRole.DataContext     = roles;
                progressBar.Visibility = System.Windows.Visibility.Hidden;
                mainGrid.Visibility    = System.Windows.Visibility.Visible;
                this.tbMemberUserName.Focus();
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
        private void InitializeFields()
        {
            List<string> roles = new List<string>();
            Task t = Task.Factory.StartNew(() =>
            {
                MemberViewModel = new MemberViewModel();
                roles = MemberViewModel.GetRoles();

                CheckedTeams = new ObservableCollection<CheckedItem>();
                MemberViewModel.GetTeams().ForEach(x => CheckedTeams.Add(x));
            });
            Task t2 = t.ContinueWith(antecedent =>
            {
                DataContext = MemberViewModel;
                lbTeam.DataContext = CheckedTeams;
                cbRole.DataContext = roles;
                progressBar.Visibility = System.Windows.Visibility.Hidden;
                mainGrid.Visibility = System.Windows.Visibility.Visible;
                this.tbMemberUserName.Focus();
            }, TaskScheduler.FromCurrentSynchronizationContext());
            
        }
Ejemplo n.º 4
0
 private void Login_Loaded(object sender, RoutedEventArgs e)
 {
     this.tbMemberUserName.Focus();
     MemberProxy = new MemberViewModel();
     DataContext = MemberProxy;
 }
Ejemplo n.º 5
0
 private void Login_Loaded(object sender, RoutedEventArgs e)
 {
     this.tbMemberUserName.Focus();
     MemberProxy = new MemberViewModel();
     DataContext = MemberProxy;           
 }