private void bwLogin_DoWork(object sender, DoWorkEventArgs e)
 {
     int referenceCode = 0;
     loginDetails = mezeoFileCloud.Login(txtUserName.Text, txtPasswrod.Text,validateServiceUrl(txtServerUrl.Text), ref referenceCode);
     e.Result = referenceCode;
 }
        public LoginDetails loginFromSyncManager()
        {
            int referenceCode = 0;
            loginDetails = mezeoFileCloud.Login(BasicInfo.UserName, BasicInfo.Password, validateServiceUrl(BasicInfo.ServiceUrl), ref referenceCode);
            if (referenceCode == ResponseCode.LOGINFAILED1 || referenceCode == ResponseCode.LOGINFAILED2)
            {
                if (syncManager != null)
                {
                    syncManager.Hide();
                }
                ShowLoginAgainFromSyncMgr();

                return null;
            }
            else if (referenceCode != ResponseCode.LOGIN)
            {
                if (syncManager != null)
                {
                    //syncManager.DisableSyncManager();
                    //syncManager.ShowSyncManagerOffline();
                    //syncManager.CheckServerStatus();
                    return null;
                }
                return null;
            }
            else
            {
                CheckAndCreateSyncDirectory();
                CheckAndCreateNotificationQueue();
                HandleUpdates();
                return loginDetails;
            }
        }
        public void VerifyCredentialsAgainFromSyncMgr()
        {
            this.UseWaitCursor = true;

            this.txtUserName.Enabled = false;
            this.txtPasswrod.Enabled = false;
            this.txtServerUrl.Enabled = false;
            this.btnLogin.Enabled = false;
            this.labelError.Text = "";

            int referenceCode = 0;
            loginDetails = mezeoFileCloud.Login(txtUserName.Text, txtPasswrod.Text, validateServiceUrl(txtServerUrl.Text), ref referenceCode);
            if (loginDetails == null && (referenceCode == 401 || referenceCode == 403))
            {
                this.UseWaitCursor = false;
                ShowLoginAgainFromSyncMgr();
                return;
            }

            string NQParentURI = mezeoFileCloud.NQParentUri(loginDetails.szManagementUri, ref referenceCode);
            if (NQParentURI.Trim().Length != 0 && (referenceCode == 401 || referenceCode == 403))
            {
                this.UseWaitCursor = false;
                ShowLoginAgainFromSyncMgr();
                return;
            }

            loginDetails.szNQParentUri = NQParentURI;

            isLoginSuccess = true;
            this.UseWaitCursor = false;
            BasicInfo.Password = txtPasswrod.Text;
            syncManager.LoginDetail = loginDetails;
            if (showLogin)
            {
                this.Close();
            }

            showLogin = false;
            isFromSyncMgrVerification = false;

            niSystemTray.ContextMenuStrip = cmSystemTraySyncMgr;

            if (isLoginSuccess)
            {
                LoginSuccessTask();
            }
        }
 public int checkReferenceCode()
 {
     int referencecode = 0;
         loginDetails = mezeoFileCloud.Login(BasicInfo.UserName, BasicInfo.Password, validateServiceUrl(BasicInfo.ServiceUrl), ref referencecode);
         return referencecode;
 }