Beispiel #1
0
        /// <summary>
        /// Executes login.
        /// </summary>
        private void LoginExecute()
        {
            this.BusyCount++;
            this.LoginCommand.RaiseCanExecuteChanged();

            #region prepare url
            string serverUrl = ServerPath;
            if (!ServerPath.StartsWith("http://") && !ServerPath.StartsWith("https://"))
            {
                serverUrl = string.Concat("http://", ServerPath);
            }
            if (!serverUrl.EndsWith("/"))
            {
                serverUrl = string.Concat(serverUrl, "/");
            }

            #endregion

            try
            {
                Membership.CheckUserData(Login, Password, serverUrl, LoginCallback);
            }
            catch
            {
                this.BusyCount--;
#if !UNIT_TEST
                MessageBox.Show((Application.Current.Resources["LanguageStrings"] as LanguageStrings).WRONG_SERVER_ADDRESS);
#else
                RaiseTestCompleted("cannot locate server");
#endif
            }
        }
Beispiel #2
0
 private string MakeConnectionString()
 {
     if (ConnectionType == ConnectionType.Embedded)
     {
         return(String.Format("type=embedded;storesDirectory={0}", DirectoryPath));
     }
     if (ConnectionType == ConnectionType.Http || ConnectionType == ConnectionType.Tcp)
     {
         var connString = new StringBuilder();
         connString.Append(ConnectionType == ConnectionType.Http
                               ? "type=http;endpoint=http://"
                               : "type=tcp;endpoint=net.tcp://");
         connString.Append(ServerName);
         if (!String.IsNullOrEmpty(ServerPort))
         {
             connString.Append(":");
             connString.Append(ServerPort);
         }
         if (!String.IsNullOrEmpty(ServerPath))
         {
             if (!ServerPath.StartsWith("/"))
             {
                 connString.Append("/");
             }
             connString.Append(ServerPath);
         }
         return(connString.ToString());
     }
     if (ConnectionType == ConnectionType.NamedPipe)
     {
         var connString = new StringBuilder();
         connString.Append("type=namedpipe;endpoint=net.pipe://");
         connString.Append(ServerName);
         if (!PipeName.StartsWith("/"))
         {
             connString.Append("/");
         }
         connString.Append(PipeName);
         return(connString.ToString());
     }
     throw new NotSupportedException(String.Format("Cannot generate connection string for connection type {0}", ConnectionType));
 }