private void btnUserInfo_Click(object sender, RoutedEventArgs e)
        {
            Button  btn  = (Button)e.OriginalSource;
            UserDTO user = (UserDTO)btn.Tag;

            if (!user.IsDeleted && !user.IsMe())
            {
                MainWindow.Instance.ShowUserInformation(user);
            }
        }
Пример #2
0
        public void Fill(UserDTO user)
        {
            if (currentTask != null)
            {
                currentTask.Cancel();
                currentTask = null;
                updateButtons(false);
            }
            this.ClearContent();
            showProgress(true);
            currentTask = ParentWindow.TasksManager.RunAsynchronousOperation(delegate(OperationContext ctx)
            {
                GetProfileInformationCriteria criteria = new GetProfileInformationCriteria();
                criteria.UserId = user.Id;
                ProfileInformationDTO usr;
                if (user.IsMe())
                {
                    usr = UserContext.ProfileInformation;
                }
                else
                {
                    usr = ServiceManager.GetProfileInformation(criteria);
                }

                if (ctx.CancellatioToken.IsCancellationRequested)
                {
                    return;
                }
                this.user = usr;
                ParentWindow.SynchronizationContext.Send(delegate
                {
                    foreach (NaviBand band in naviBar1.Bands)
                    {
                        if (ctx.CancellatioToken.IsCancellationRequested)
                        {
                            return;
                        }
                        if (band.ClientArea.Controls.Count > 0)
                        {
                            IUserDetailControl ctrl = band.ClientArea.Controls[0] as IUserDetailControl;
                            if (ctrl != null)
                            {
                                ctrl.Fill(this.user, naviBar1.ActiveBand == band);
                                band.Text = ctrl.Caption;
                            }
                        }
                    }
                    //updateButtons();
                    //without these caption of navi bar was not refreshed in some cases
                    naviBar1.Refresh();
                    naviBar1.Update();
                    showProgress(false);
                }, null);
            }, asyncOperationStateChange, null, false);
        }
        public void Fill(UserDTO user)
        {
            if (currentTask != null)
            {
                currentTask.Cancel();
                currentTask = null;
                updateButtons(false);
            }
            this.ClearContent();
            if (accordionCtrl.SelectedItem == null)
            {
                ShowUserInfo();
            }
            showProgress(true);
            currentTask = ParentWindow.RunAsynchronousOperation(delegate(OperationContext ctx)
            {
                GetProfileInformationCriteria criteria = new GetProfileInformationCriteria();
                criteria.UserId = user.GlobalId;
                ProfileInformationDTO usr;
                if (user.IsMe())
                {
                    usr = UserContext.Current.ProfileInformation;
                }
                else
                {
                    usr = ServiceManager.GetProfileInformation(criteria);
                }

                if (ctx.CancellatioToken.IsCancellationRequested)
                {
                    return;
                }
                this.user = usr;
                UIHelper.BeginInvoke(new Action(delegate
                {
                    foreach (AccordionItem band in accordionCtrl.Items)
                    {
                        if (ctx.CancellatioToken.IsCancellationRequested)
                        {
                            return;
                        }
                        if (band.Content != null)
                        {
                            IUserDetailControl ctrl = band.Content as IUserDetailControl;
                            if (ctrl != null)
                            {
                                ctrl.Fill(this.user, accordionCtrl.SelectedItem == band);
                            }
                        }
                    }
                    updateButtons(false);
                    showProgress(false);
                }), Dispatcher);
            }, asyncOperationStateChange, null);
        }
Пример #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            UserDTO user = (UserDTO)value;

            return(!user.IsMe());
        }