Daap.Client.Login C# (CSharp) Method

Login() public method

public Login ( string username, string password ) : void
username string
password string
return void
        public void Login(string username, string password)
        {
            fetcher.Username = username;
            fetcher.Password = password;

            try {
                bag = ContentCodeBag.ParseCodes (fetcher.Fetch ("/content-codes"));
                ContentNode node = ContentParser.Parse (bag, fetcher.Fetch ("/login"));
                ParseSessionId (node);

                FetchDatabases ();
                Refresh ();

                if (serverInfo.SupportsUpdate) {
                    updateRunning = true;
                    Thread thread = new Thread (UpdateLoop);
                    thread.Name = "DAAP";
                    thread.IsBackground = true;
                    thread.Start ();
                }
            } catch (WebException e) {
                if (e.Response != null && (e.Response as HttpWebResponse).StatusCode == HttpStatusCode.Unauthorized)
                    throw new AuthenticationException ("Username or password incorrect");
                else
                    throw new LoginException ("Failed to login", e);
            } catch (Exception e) {
                throw new LoginException ("Failed to login", e);
            }
        }

Same methods

Client::Login ( ) : void
Client::Login ( string password ) : void

Usage Example

Ejemplo n.º 1
0
 private void AuthenticatedLogin(string username, string password)
 {
     ThreadAssist.Spawn(delegate {
         try {
             client.Login(username, password);
         } catch (DAAP.AuthenticationException) {
             ThreadAssist.ProxyToMain(delegate {
                 ShowErrorView(DaapErrorType.InvalidAuthentication);
             });
         }
     });
 }
All Usage Examples Of Daap.Client::Login