예제 #1
0
        private void _btnOK_Click(object sender, System.EventArgs e)
        {
            ConfluenceSoap confluence = new ConfluenceSoap();

            try
            {
                _lblProgress.Visible = true;
                _lblProgress.Refresh();

                if (_edtUrl.Text.IndexOf("://") < 0)
                {
                    _edtUrl.Text = "http://" + _edtUrl.Text;
                }

                confluence.Url = _edtUrl.Text + LoginManager.ServicePath;

                _loginToken = confluence.login(_edtUserName.Text, _edtPassword.Text);
            }
            catch (Exception ex)
            {
                _lblProgress.Text = ex.Message;
                return;
            }
            LoginManager.Url      = _edtUrl.Text;
            LoginManager.UserName = _edtUserName.Text;
            LoginManager.Password = _edtPassword.Text;
            DialogResult          = DialogResult.OK;
        }
예제 #2
0
파일: PostDialog.cs 프로젝트: mo5h/omeo
        private void _btnPost_Click(object sender, System.EventArgs e)
        {
            bool postSuccess = false;

            _lblProgress.Text = "Posting...";
            _lblProgress.Refresh();

            ConfluenceSoap confluence = new ConfluenceSoap();

            confluence.Url = LoginManager.ServiceUrl;
            // the login token may have expired, so let's login again, just in case
            string loginToken = confluence.login(LoginManager.UserName, LoginManager.Password);

            try
            {
                if (_radNewPage.Checked)
                {
                    postSuccess = PostPage(confluence, loginToken);
                }
                else
                {
                    PostBlog(confluence, loginToken);
                    postSuccess = true;
                }
            }
            catch (Exception ex)
            {
                _lblProgress.Text = ex.Message;
            }

            Core.SettingStore.WriteString("PostToConfluence", "LastSpace", (_cmbSpaces.SelectedItem as SpaceSummary).Key);
            Core.SettingStore.WriteBool("PostToConfluence", "LastNewPage", _radNewPage.Checked);
            if (postSuccess)
            {
                Close();
            }
            else
            {
                _asyncOperation = false;
                UpdateButtonStatus();
            }
        }
예제 #3
0
        /// <summary>
        /// Returns the login token for Confluence Remote API calls. If there is no
        /// stored login information, or the stored login information is not valid,
        /// </summary>
        /// <returns>The login token or null if the login was cancelled by the user</returns>
        public static string GetLoginToken()
        {
            string url      = LoginManager.Url;
            string userName = LoginManager.UserName;
            string password = LoginManager.Password;

            // try stored login information
            if (url.Length > 0 && userName.Length > 0 && password.Length > 0)
            {
                ConfluenceSoap confluence = new ConfluenceSoap();
                confluence.Url = LoginManager.ServiceUrl;
                try
                {
                    return(confluence.login(userName, password));
                }
                catch (Exception)
                {
                    // ignore
                }
            }

            return(GetLoginTokenFromDialog());
        }