Exemplo n.º 1
0
        /// <summary>
        /// Updates the form's UI (Home tab info, title bar, workspace users).
        /// </summary>
        public void UpdateUI(Workspace kws)
        {
            ToolStripLabel statusKwsName = AppStatusStrip.Items[2] as ToolStripLabel;
            Debug.Assert(statusKwsName != null);

            UpdateDeleteItemToolbarButton();

            // Set the title and status bar.
            if (kws == null)
            {
                HideAdvancedView();
                this.Text = Base.GetKwmString();
                statusKwsName.Visible = false;
                kwsHeader.Visible = false;
                createKwsHeader.Visible = true;
            }

            else
            {
                createKwsHeader.Visible = false;
                kwsHeader.Visible = true;
                kwsHeader.UpdateUI(kws);
                if (kwsHeader.HasError || Misc.ApplicationSettings.ShowMainFormAdvancedView)
                    ShowAdvancedView();
                else
                    HideAdvancedView();

                this.Text = Base.GetKwmString() + " - " + kws.GetKwsName();
                statusKwsName.Visible = true;
                statusKwsName.Text = kws.GetKwsName();
                lnkShowProperties.Enabled = !kws.IsPublicKws();
            }

            // Update the invitation controls status.
            UpdateInviteStatus(kws);

            // Set the user list.
            UpdateKwsUserList(kws);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update the invitation UI (button, textbox and linklabel) so that
        /// the controls are enabled at the right moment.
        /// </summary>
        private void UpdateInviteStatus(Workspace kws)
        {
            if (kws == null)
            {
                btnInvite.Enabled = false;
                btnCustomInvite.Enabled = false;
                return;
            }

            bool enable = (kws.LoginStatus == KwsLoginStatus.LoggedIn &&
                           kws.IsOnlineCapable() &&
                          !kws.IsPublicKws());

            btnInvite.Enabled = enable;
            btnCustomInvite.Enabled = enable;
        }