protected override void ProcessRecord() { base.ProcessRecord(); Session s = new Session(); SessionSettings sessionSettings = new SessionSettings(); sessionSettings.ClassOfService = ClassOfService.General; sessionSettings.IsoLanguage = "en-US"; sessionSettings.ApplicationName = "i3lets"; HostSettings hostSettings = new HostSettings(); hostSettings.HostEndpoint = new HostEndpoint(Host, HostEndpoint.DefaultPort); AuthSettings authSettings; if (String.IsNullOrEmpty(UserName) || Password == null) { authSettings = new WindowsAuthSettings(); } else { authSettings = new ICAuthSettings(UserName, Password); } StationSettings stationSettings = new StationlessSettings(); s.Connect(sessionSettings, hostSettings, authSettings, stationSettings); StaticDataStore.AddSession(s); WriteObject(s); }
public void SetAuthSettings() { if (WindowsAuth) { AuthSettings = new WindowsAuthSettings(); } else { AuthSettings = new ICAuthSettings(UserName, Password); } }
private void Connect() { _connectAttempts++; if (String.IsNullOrEmpty(_server)) { _server = _server1; } _session = new Session(); _session.ConnectionStateChanged += session_ConnectionStateChanged; if (_session.ConnectionState != ConnectionState.Up) { _logging.TraceMessage(0, "Qsect WebChatBuilder is trying to connect to: " + _server); try { SessionSettings sessionSettings = new SessionSettings(); HostSettings hostSettings = new HostSettings(); hostSettings.HostEndpoint = new HostEndpoint(_server, HostEndpoint.DefaultPort); StationSettings stationSettings = new StationlessSettings(); AuthSettings authSettings = new WindowsAuthSettings(); var userName = _user; var password = _password; if (!String.IsNullOrEmpty(userName) && !String.IsNullOrEmpty(password)) { authSettings = new ICAuthSettings(userName, password); } _session.ConnectAsync(sessionSettings, hostSettings, authSettings, stationSettings, session_ConnectCompleted, null); } catch (Exception Ex) { PartialUnload(); _logging.TraceException(Ex, "Error connecting to CIC"); _server = _server == _server1 ? _server2 : _server1; TryToReconnect(); } } }