예제 #1
0
        protected override void configureWorker()
        {
            worker.DoWork += (sender, e) =>
            {
                //BackgroundWorker bw = sender as BackgroundWorker;
                e.Result = ((Func <DoWorkEventArgs, DelegateInformation>)e.Argument)(e);
            };

            worker.RunWorkerCompleted += (sender, e) =>
            {
                delegateInfo                  = (DelegateInformation)e.Result;
                SchedulerOption               = delegateInfo.MeetingRequestsDeliveryScope.ToString();
                OriginalSchedulerOption       = SchedulerOption;
                MailboxToAddAsDelegate        = null;
                NewDelegateReceivesSchedulers = false;
                OnPropertyChanged("NewDelegateReceivesSchedulers");
                NewDelegateViewPrivateItems = false;
                OnPropertyChanged("NewDelegateViewPrivateItems");
                DelegateUsers.Clear();
                foreach (DelegateUserResponse response in delegateInfo.DelegateUserResponses)
                {
                    if (response.ErrorMessage == null)
                    {
                        DelegateUsers.Add(new DelegateUserViewModel(response.DelegateUser, this));
                    }
                }
                Status = "";
                NewDelegatesView.Refresh();
            };
        }
예제 #2
0
        private bool filterDelegatesList(object obj)
        {
            MailboxWrapper mailbox = obj as MailboxWrapper;

            //You can't add groups as delegates.
            if (mailbox.RecipientType.Contains("Group"))
            {
                return(false);
            }
            //You can't add the user as a delegate to their own mailbox.
            if (mailbox.DistinguishedName == ParentMailboxViewModel.Mailbox.DistinguishedName)
            {
                return(false);
            }
            //Neither can you add users who are already delegates.
            DelegateUserViewModel dup = DelegateUsers.SingleOrDefault(x =>
                                                                      x.EwsDelegateUser.UserId.PrimarySmtpAddress == mailbox.PrimarySmtp);

            if (dup != null)
            {
                return(false);
            }
            return(true);
        }