Esempio n. 1
0
        void updateButtons(bool operationStarted)
        {
            bool logged = !operationStarted && user != null && UserContext.LoginStatus == LoginStatus.Logged;

            btnEditProfile.Visible         = logged && user.User.IsMe();
            btnInviteAFriend.Visible       = logged && !user.User.IsMe() && !user.User.IsFriend() && !user.User.IsInInvitation() && !user.User.IsDeleted;
            btnRefresh.Visible             = logged && user.User.IsMe();
            btnRejectFriendship.Visible    = logged && (user.User.IsFriend() || user.User.IsInInvitation());
            btnReports.Visible             = btnOpenWorkoutsLog.Visible = logged && !user.User.IsMe() && user.User.HaveAccess(user.User.Privacy.CalendarView);
            btnAcceptFriend.Visible        = logged && user.User.IsInviter();
            btnSendMessage.Visible         = logged && !user.User.IsMe() && !user.User.IsDeleted;
            btnAddToFavorites.Visible      = logged && !user.User.IsMe() && !user.User.IsFriend() && !user.User.IsFavorite() && !user.User.IsDeleted;
            btnRemoveFromFavorites.Visible = logged && !user.User.IsMe() && !user.User.IsFriend() && user.User.IsFavorite() && !user.User.IsDeleted;
            //flowLayoutPanel1.Visible = !operationStarted;



            foreach (NaviBand band in naviBar1.Bands)
            {
                if (band.ClientArea.Controls.Count > 0)
                {
                    IUserDetailControl ctrl = band.ClientArea.Controls[0] as IUserDetailControl;
                    if (ctrl != null)
                    {
                        band.Visible = ctrl.UpdateGui(user);
                    }
                }
            }
        }
        void updateButtons(bool operationStarted)
        {
            bool logged = !operationStarted && user != null && UserContext.Current.LoginStatus == LoginStatus.Logged;

            ShowEditProfile         = logged && user.User.IsMe();
            ShowInvite              = logged && !user.User.IsMe() && !user.User.IsFriend() && !user.User.IsInInvitation() && !user.User.IsDeleted;
            ShowReject              = logged && (user.User.IsFriend() || user.User.IsInInvitation());
            ShowAccept              = logged && user.User.IsInviter();
            ShowCalendar            = logged && !user.User.IsMe() && user.User.HaveAccess(user.User.Privacy.CalendarView);
            ShowReports             = ShowCalendar;
            ShowAddToFavorites      = logged && !user.User.IsMe() && !user.User.IsFriend() && !user.User.IsFavorite() && !user.User.IsDeleted;
            ShowRemoveFromFavorites = logged && !user.User.IsMe() && !user.User.IsFriend() && user.User.IsFavorite() && !user.User.IsDeleted;
            ShowSocialGroup         = logged && !user.User.IsMe();
            ShowUserTab             = logged;
            ShowSendMessage         = logged && !user.User.IsMe() && !user.User.IsDeleted;

            foreach (AccordionItem band in accordionCtrl.Items)
            {
                //if (band.Controls.Count > 0)
                {
                    IUserDetailControl ctrl = band.Content as IUserDetailControl;
                    if (ctrl != null)
                    {
                        band.SetVisible(ctrl.UpdateGui(user));
                    }
                }
            }
        }