/// <summary> /// Performs application-defined tasks associated with freeing, /// releasing, or resetting unmanaged resources. /// </summary> /// <param name="isDisposing">Explicit dispose</param> protected virtual void Dispose(bool isDisposing) { //Se sto facendo la dispose if (isDisposing) { //Rilascio i layers e la sessione BasicLayer?.Dispose(); DataSession?.Dispose(); //AuthorizationLayer?.Dispose(); } //Chiamo il metodo base //base.Dispose(isDisposing); }
public void BeginLogin() { Status = ConnectStatus.Connecting; Session.Invoke <LoginResult> ( () => { var dataSession = new DataSession() { Alias = new ConnectionAlias() { HostName = _hostName, InstanceName = _instanceName } }; dataSession.Alias.SessionInfo.UserID = _userName; dataSession.Alias.SessionInfo.Password = _password == null ? "" : _password; dataSession.Alias.SessionInfo.Environment = "SilverlightClient"; dataSession.Open(); try { var applicationRows = new List <object[]>(); using (var applications = dataSession.OpenReadOnlyDataView(".Frontend.Applications")) { foreach (DAE.Runtime.Data.Row row in applications) { applicationRows.Add((object[])((NativeRow)row.AsNative).Values.Clone()); } } return(new LoginResult() { Applications = applicationRows, DataSession = dataSession }); } catch { dataSession.Dispose(); throw; } }, (Exception AException) => { Status = ConnectStatus.Login; Exception = AException; }, (LoginResult AResult) => { DataSession = AResult.DataSession; Applications = AResult.Applications; // If there is only 1 application, skip to login if (Applications.Count == 1) { ApplicationID = (string)Applications[0][0]; BeginStartApplication(); } else { Status = ConnectStatus.SelectApplication; } } ); }