public static void AddPwgSessionInfoToPwgSessionWPF(PwgSession aPwgSession, ref PwgSessionWPF aPwgSessionWPF)
 {
     if (aPwgSession != null)
     {
         if (aPwgSessionWPF == null)
         {
             aPwgSessionWPF = new PwgSessionWPF();
         }
         aPwgSessionWPF.IsConnected = aPwgSession.IsConnected;
         aPwgSessionWPF.UserName = aPwgSession.UserName;
         aPwgSessionWPF.Status = aPwgSession.Status;
         aPwgSessionWPF.Template = aPwgSession.Template;
         aPwgSessionWPF.Theme = aPwgSession.Theme;
         aPwgSessionWPF.CharSet = aPwgSession.CharSet;
     }
 }
        /// <summary>
        /// Log to the gallery using a account
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="Password"></param>
        /// <returns></returns>
        public PwgSession Login(String UserName, String Password)
        {
            PwgSession = null;
            Boolean isConnected = false;
            try
            {
                PwgSessionProxyResponse response = PwgSessionProxy.pwg_session_login(UserName, Password);

                if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok)
                {

                    if (response.Erreur != null)
                    {
                        throw new PwgServiceException("Login, the server has return the error.",
                            response.Erreur.Code,
                            response.Erreur.Message);
                    }
                    else
                    {
                        throw new PwgServiceException("Login : a error occurs during server process.");
                    }
                }
                else
                {
                    isConnected = true;
                }
            }
            catch (PwgProxyException ex)
            {
                throw new PwgServiceException("Login : a error is raised by proxy.", ex);
            }

            PwgSession sess= GetPwgSession();
            sess.IsConnected = isConnected;
            return sess;
        }
        /// <summary>
        /// private: convert response to dto object
        /// </summary>
        /// <param name="response"></param>
        /// <param name="session"></param>
        internal static void ConvertProxyResponseToDTO(PwgSessionProxyResponse response, ref PwgSession session)
        {
            if (session == null)
            {
                session = new PwgSession();
            }

            if (response != null)
            {
                session.CharSet = response.CharSet;
                session.Language = response.Language;
                session.Status = PwgEnumHelper<PwgSessionStatusEnum>.enumValueOf(response.Status);
                session.Template = response.Template;
                session.Theme = response.Theme;
                session.UserName = response.UserName;
                session.SecurityToken = response.PwgToken;
            }
        }