Пример #1
0
        /// <summary>
        /// update the UI
        /// </summary>
        private void UpdateControls()
        {
            // hosts list
            if (_enterpriseSession != null && _enterpriseSession.AuthenticationErrorCode == EnterpriseAuthenticationErrorCode.NONE && (RemoteSession == null || RemoteSession.State == RemoteSessionState.Disconnecting || RemoteSession.State == RemoteSessionState.Disconnected))
            {
                toolbar.Style["visibility"] = "hidden";
                toolbar.Style["display"]    = "none";
                hosts.Visible        = true;
                newHost.Visible      = _enterpriseSession.IsAdmin;
                hostsList.DataSource = _enterpriseClient.GetSessionHosts(_enterpriseSession.SessionID);
                hostsList.DataBind();
            }
            // active remote session
            else if (RemoteSession != null && (RemoteSession.State == RemoteSessionState.Connecting || RemoteSession.State == RemoteSessionState.Connected))
            {
                toolbar.Style["visibility"] = "visible";
                toolbar.Style["display"]    = "block";
                serverInfo.Value            = (!string.IsNullOrEmpty(RemoteSession.ServerName) ? RemoteSession.ServerName : RemoteSession.ServerAddress);
                stat.Value          = RemoteSession.StatMode ? "Hide Stat" : "Show Stat";
                stat.Disabled       = false;
                debug.Value         = RemoteSession.DebugMode ? "Hide Debug" : "Show Debug";
                debug.Disabled      = false;
                browser.Value       = RemoteSession.CompatibilityMode ? "HTML5" : "HTML4";
                browser.Disabled    = false;
                scale.Value         = RemoteSession.ScaleDisplay ? "Unscale" : "Scale";
                scale.Disabled      = false;
                keyboard.Disabled   = false;
                clipboard.Disabled  = !RemoteSession.AllowRemoteClipboard;
                files.Disabled      = RemoteSession.ServerAddress.ToLower() != "localhost" && RemoteSession.ServerAddress != "127.0.0.1" && RemoteSession.ServerAddress != "[::1]" && RemoteSession.ServerAddress != Request.Url.Host && string.IsNullOrEmpty(RemoteSession.UserDomain);
                cad.Disabled        = false;
                mrc.Disabled        = false;
                share.Disabled      = !RemoteSession.AllowSessionSharing || !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                disconnect.Disabled = false;
            }
            // login screen
            else
            {
                login.Visible = true;

                // MFA
                if (_mfaAuthClient.GetState())
                {
                    mfaDiv.Visible        = true;
                    mfaProvider.InnerText = _mfaAuthClient.GetPromptLabel();
                    mfaProvider.HRef      = _mfaAuthClient.GetProviderURL();
                }

                // enterprise mode
                if (_enterpriseClient.GetState())
                {
                    domainServerDiv.Visible = false;
                }
                // standard mode
                else
                {
                    connect.Attributes["onclick"] = "showToolbar();";
                }
            }
        }
Пример #2
0
        /// <summary>
        /// update the UI
        /// </summary>
        private void UpdateControls()
        {
            // remote session toolbar
            if (RemoteSession != null && (RemoteSession.State == RemoteSessionState.Connecting || RemoteSession.State == RemoteSessionState.Connected))
            {
                toolbarToggle.Style["visibility"] = "visible";
                toolbarToggle.Style["display"]    = "block";
                serverInfo.Value    = !string.IsNullOrEmpty(RemoteSession.VMGuid) ? RemoteSession.VMGuid : (!string.IsNullOrEmpty(RemoteSession.HostName) ? RemoteSession.HostName : RemoteSession.ServerAddress);
                userInfo.Value      = !string.IsNullOrEmpty(RemoteSession.VMGuid) || RemoteSession.SecurityProtocol == SecurityProtocolEnum.rdp ? string.Empty : RemoteSession.UserName;
                userInfo.Visible    = !string.IsNullOrEmpty(userInfo.Value);
                stat.Value          = RemoteSession.StatMode ? "Hide Stat" : "Show Stat";
                stat.Disabled       = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                debug.Value         = RemoteSession.DebugMode ? "Hide Debug" : "Show Debug";
                debug.Disabled      = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                browser.Value       = RemoteSession.CompatibilityMode ? "HTML5" : "HTML4";
                browser.Disabled    = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                scale.Value         = RemoteSession.ScaleDisplay ? "Unscale" : "Scale";
                scale.Disabled      = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH;
                keyboard.Disabled   = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                clipboard.Disabled  = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH || !RemoteSession.AllowRemoteClipboard || (!string.IsNullOrEmpty(RemoteSession.VMGuid) && !RemoteSession.VMEnhancedMode);
                files.Disabled      = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH || !RemoteSession.AllowFileTransfer || (RemoteSession.ServerAddress.ToLower() != "localhost" && RemoteSession.ServerAddress != "127.0.0.1" && RemoteSession.ServerAddress != "[::1]" && RemoteSession.ServerAddress != Request.Url.Host && string.IsNullOrEmpty(RemoteSession.UserDomain)) || !string.IsNullOrEmpty(RemoteSession.VMGuid);
                cad.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH;
                mrc.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH;
                vswipe.Disabled     = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH;
                share.Disabled      = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || !RemoteSession.AllowSessionSharing;
                disconnect.Disabled = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
            }
            // hosts list
            else if (_enterpriseSession != null && _enterpriseSession.AuthenticationErrorCode == EnterpriseAuthenticationErrorCode.NONE)
            {
                hosts.Visible              = true;
                enterpriseUserInfo.Value   = _enterpriseSession.UserName;
                enterpriseUserInfo.Visible = !string.IsNullOrEmpty(enterpriseUserInfo.Value);
                newRDPHost.Visible         = _enterpriseSession.IsAdmin;
                newSSHHost.Visible         = _enterpriseSession.IsAdmin;
                hostsList.DataSource       = _enterpriseClient.GetSessionHosts(_enterpriseSession.SessionID);
                hostsList.DataBind();
            }
            // login screen
            else
            {
                login.Visible = true;

                // MFA
                if (_mfaAuthClient.GetState())
                {
                    mfaDiv.Visible        = true;
                    mfaProvider.InnerText = _mfaAuthClient.GetPromptLabel();
                    mfaProvider.HRef      = _mfaAuthClient.GetProviderURL();
                }

                // enterprise mode
                if (_enterpriseClient.GetState())
                {
                    hostConnectDiv.Visible = false;
                }
                // standard mode
                else
                {
                    connect.Attributes["onclick"] = "initDisplay();";
                }
            }
        }