示例#1
0
        /// <summary>
        /// Publically accessible login, to allow calling of login via AWB startup parameters
        /// </summary>
        /// <param name="profileID">Profile ID to login to</param>
        public void login(int profileID)
        {
            if (profileID == -1)
            {
                return;
            }

            try
            {
                AWBProfile startupProfile = AWBProfiles.GetProfile(profileID);

                if (!string.IsNullOrEmpty(startupProfile.Password))
                {//Get 'Saved' Password
                    browserLogin(startupProfile.Username, startupProfile.Password);
                }
                else
                {//Get Password from User
                    UserPassword password = new UserPassword();
                    password.SetText = "Enter password for " + startupProfile.Username;

                    if (password.ShowDialog() == DialogResult.OK)
                    {
                        browserLogin(startupProfile.Username, password.GetPassword);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
        /// <summary>
        /// Login based on selected item on the form
        /// </summary>
        private void login()
        {
            try
            {
                if (SelectedItem < 0) return;

                Cursor = Cursors.WaitCursor;
                CurrentSettingsProfile =
                    string.IsNullOrEmpty(lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text)
                        ? ""
                        : lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text;

                if (lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[2].Text == "Yes")
                {//Get 'Saved' Password
                    browserLogin(AWBProfiles.GetPassword(int.Parse(lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text)));
                }
                else
                {//Get Password from User
                    UserPassword password = new UserPassword();
                    password.SetText = "Enter password for " + lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[1].Text;

                    if (password.ShowDialog() == DialogResult.OK)
                        browserLogin(password.GetPassword);
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
示例#3
0
        /// <summary>
        /// Login based on selected item on the form
        /// </summary>
        private void Login()
        {
            try
            {
                if (SelectedItem < 0)
                {
                    return;
                }

                Cursor = Cursors.WaitCursor;
                ListViewItem item = lvAccounts.Items[lvAccounts.SelectedIndices[0]];

                CurrentSettingsProfile =
                    string.IsNullOrEmpty(item.SubItems[3].Text)
                        ? ""
                        : item.SubItems[3].Text;

                // fire event to load settings before logging in so we log into user's project/wiki
                if (CurrentSettingsProfile.Length > 0 && UserDefaultSettingsLoadRequired != null)
                {
                    UserDefaultSettingsLoadRequired(null, null);
                }

                if (item.SubItems[2].Text == "Yes")
                {
                    //Get 'Saved' Password
                    PerformLogin(AWBProfiles.GetPassword(int.Parse(item.Text)));
                }
                else
                {
                    //Get Password from User
                    UserPassword password = new UserPassword
                    {
                        Username = item.SubItems[1].Text
                    };

                    if (password.ShowDialog(this) == DialogResult.OK)
                    {
                        PerformLogin(password.GetPassword);
                    }
                }

                AWBProfiles.LastUsedAccount = item.Text;

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                ErrorHandler.HandleException(ex);
            }
        }
        /// <summary>
        /// Publically accessible login, to allow calling of login via AWB startup parameters
        /// </summary>
        /// <param name="profileID">Profile ID to login to</param>
        public void login(string profileIdOrName)
        {
            if (profileIdOrName.Length == 0)
            {
                return;
            }

            try
            {
                int        profileID = -1;
                AWBProfile startupProfile;

                if (int.TryParse(profileIdOrName, out profileID))
                {
                    startupProfile = AWBProfiles.GetProfile(profileID);
                }
                else
                {
                    startupProfile = AWBProfiles.GetProfile(profileIdOrName);
                }

                if (startupProfile == null)
                {
                    MessageBox.Show(this.Parent, "Can't find user '" + profileIdOrName + "'.", "Command line error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (!string.IsNullOrEmpty(startupProfile.Password))
                {//Get 'Saved' Password
                    browserLogin(startupProfile.Username, startupProfile.Password);
                }
                else
                {//Get Password from User
                    UserPassword password = new UserPassword();
                    password.SetText = "Enter password for " + startupProfile.Username;

                    if (password.ShowDialog() == DialogResult.OK)
                    {
                        browserLogin(startupProfile.Username, password.GetPassword);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
        private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                UserPassword password = new UserPassword();
                password.SetText = "Set password for: " + lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[1].Text;

                if (password.ShowDialog() == DialogResult.OK)
                {
                    AWBProfiles.SetPassword(int.Parse(lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text), password.GetPassword);
                }
            }
            finally
            {
                loadProfiles();
            }
        }
示例#6
0
        /// <summary>
        /// Publically accessible login, to allow calling of login via AWB startup parameters
        /// </summary>
        /// <param name="profileIdOrName">Profile ID to login to</param>
        public void Login(string profileIdOrName)
        {
            if (profileIdOrName.Length == 0)
            {
                return;
            }

            try
            {
                int        profileID;
                AWBProfile startupProfile = int.TryParse(profileIdOrName, out profileID)
                    ? AWBProfiles.GetProfile(profileID)
                    : AWBProfiles.GetProfile(profileIdOrName);

                if (startupProfile == null)
                {
                    MessageBox.Show(Parent, "Can't find user '" + profileIdOrName + "'.", "Command line error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (!string.IsNullOrEmpty(startupProfile.Password))
                {
                    //Get 'Saved' Password
                    PerformLogin(startupProfile.Username, startupProfile.Password);
                }
                else
                {
                    //Get Password from User
                    UserPassword password = new UserPassword
                    {
                        Username = startupProfile.Username
                    };

                    if (password.ShowDialog(this) == DialogResult.OK)
                    {
                        PerformLogin(startupProfile.Username, password.GetPassword);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
            }
        }
示例#7
0
        /// <summary>
        /// Login based on selected item on the form
        /// </summary>
        private void Login()
        {
            try
            {
                if (SelectedItem < 0)
                {
                    return;
                }

                Cursor = Cursors.WaitCursor;
                CurrentSettingsProfile =
                    string.IsNullOrEmpty(lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text)
                        ? ""
                        : lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text;

                if (lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[2].Text == "Yes")
                {
                    //Get 'Saved' Password
                    PerformLogin(AWBProfiles.GetPassword(int.Parse(lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text)));
                }
                else
                {
                    //Get Password from User
                    UserPassword password = new UserPassword
                    {
                        Username = lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[1].Text
                    };

                    if (password.ShowDialog(this) == DialogResult.OK)
                    {
                        PerformLogin(password.GetPassword);
                    }
                }

                AWBProfiles.LastUsedAccount = lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text;

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                ErrorHandler.Handle(ex);
            }
        }
        /// <summary>
        /// Return (or create and return) an AWBProfile for the account used for log uploading
        /// </summary>
        /// <returns>The Profile. Throw an error or return null if the user declines to create a profile?</returns>
        public static AWBProfile GetProfileForLogUploading(IWin32Window owner)
        {
            int        idOfUploadAccount = GetIDOfUploadAccount();
            AWBProfile retval;
            AWBLogUploadProfilesForm profiles;

            if (idOfUploadAccount == -1)
            {
                if (MessageBox.Show("Please select or add a Profile to use for log uploading",
                                    "Log uploading", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
                    == DialogResult.OK)
                {
                    profiles = new AWBLogUploadProfilesForm();
                    profiles.ShowDialog(owner);
                    retval = GetProfileForLogUploading(owner);
                }
                else
                {
                    throw new System.Configuration.ConfigurationErrorsException("Log upload profile: User cancelled");
                }
            }
            else
            {
                retval = GetProfile(idOfUploadAccount);
            }

            if (string.IsNullOrEmpty(retval.Password) && string.IsNullOrEmpty(TempPassword))
            {
                UserPassword password = new UserPassword();
                password.SetText = "Enter password for " + retval.Username;
                if (password.ShowDialog() == DialogResult.OK)
                {
                    retval.Password = TempPassword = password.GetPassword;
                }
            }
            else if (!string.IsNullOrEmpty(TempPassword))
            {
                retval.Password = TempPassword;
            }
            return(retval);
        }
示例#9
0
        /// <summary>
        /// Login based on selected item on the form
        /// </summary>
        private void login()
        {
            try
            {
                if (SelectedItem < 0)
                {
                    return;
                }

                Cursor = Cursors.WaitCursor;
                if (!string.IsNullOrEmpty(lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text))
                {
                    CurrentSettingsProfile = lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text;
                }
                else
                {
                    CurrentSettingsProfile = "";
                }

                if (lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[2].Text == "Yes")
                {//Get 'Saved' Password
                    browserLogin(AWBProfiles.GetPassword(int.Parse(lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text)));
                }
                else
                {//Get Password from User
                    UserPassword password = new UserPassword();
                    password.SetText = "Enter password for " + lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[1].Text;

                    if (password.ShowDialog() == DialogResult.OK)
                    {
                        browserLogin(password.GetPassword);
                    }
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
        /// <summary>
        /// Publically accessible login, to allow calling of login via AWB startup parameters
        /// </summary>
        /// <param name="profileID">Profile ID to login to</param>
        public void login(string profileIdOrName)
        {
            if (profileIdOrName.Length == 0)
                return;

            try
            {
                int profileID = -1;
                AWBProfile startupProfile;

                if (int.TryParse(profileIdOrName, out profileID))
                    startupProfile = AWBProfiles.GetProfile(profileID);
                else
                    startupProfile = AWBProfiles.GetProfile(profileIdOrName);

                if (startupProfile == null)
                {
                    MessageBox.Show(this.Parent, "Can't find user '" + profileIdOrName + "'.", "Command line error",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (!string.IsNullOrEmpty(startupProfile.Password))
                {//Get 'Saved' Password
                    browserLogin(startupProfile.Username, startupProfile.Password);
                }
                else
                {//Get Password from User
                    UserPassword password = new UserPassword();
                    password.SetText = "Enter password for " + startupProfile.Username;

                    if (password.ShowDialog() == DialogResult.OK)
                        browserLogin(startupProfile.Username, password.GetPassword);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
        private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
        {
			try
			{
	            UserPassword password = new UserPassword
	                                        {
	                                            SetText =
	                                                "Set password for: " +
	                                                lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[1].Text
	                                        };

			    if (password.ShowDialog() == DialogResult.OK)
	                AWBProfiles.SetPassword(int.Parse(lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text), password.GetPassword);
			}
			finally
			{
				LoadProfiles();
			}
        }
        /// <summary>
        /// Publically accessible login, to allow calling of login via AWB startup parameters
        /// </summary>
        /// <param name="profileIdOrName">Profile ID to login to</param>
        public void Login(string profileIdOrName)
        {
            if (profileIdOrName.Length == 0)
                return;

            try
            {
                int profileID;
                AWBProfile startupProfile = int.TryParse(profileIdOrName, out profileID) ? AWBProfiles.GetProfile(profileID) : AWBProfiles.GetProfile(profileIdOrName);

                if (startupProfile == null)
                {
                    MessageBox.Show(Parent, "Can't find user '" + profileIdOrName + "'.", "Command line error",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (!string.IsNullOrEmpty(startupProfile.Password))
                {//Get 'Saved' Password
                    PerformLogin(startupProfile.Username, startupProfile.Password);
                }
                else
                {//Get Password from User
                    UserPassword password = new UserPassword
                                                {
                                                    Username = startupProfile.Username
                                                };

                    if (password.ShowDialog(this) == DialogResult.OK)
                        PerformLogin(startupProfile.Username, password.GetPassword);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
        /// <summary>
        /// Login based on selected item on the form
        /// </summary>
        private void Login()
        {
            try
            {
                if (SelectedItem < 0) return;

                Cursor = Cursors.WaitCursor;
                CurrentSettingsProfile =
                    string.IsNullOrEmpty(lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text)
                        ? ""
                        : lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text;

                // fire event to load settings before logging in so we log into user's project/wiki
                if(CurrentSettingsProfile.Length > 0)
                    UserDefaultSettingsLoadRequired(null, null);

                if (lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[2].Text == "Yes")
                {
                    //Get 'Saved' Password
                    PerformLogin(AWBProfiles.GetPassword(int.Parse(lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text)));
                }
                else
                {
                    //Get Password from User
                    UserPassword password = new UserPassword
                    {
                        Username = lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[1].Text
                    };

                    if (password.ShowDialog(this) == DialogResult.OK)
                        PerformLogin(password.GetPassword);
                }

                AWBProfiles.LastUsedAccount = lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text;

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                ErrorHandler.Handle(ex);
            }
        }
示例#14
0
        /// <summary>
        /// Return (or create and return) an AWBProfile for the account used for log uploading
        /// </summary>
        /// <returns>The Profile. Throw an error or return null if the user declines to create a profile?</returns>
        public static AWBProfile GetProfileForLogUploading(IWin32Window owner)
        {
            int idOfUploadAccount = GetIDOfUploadAccount();
            AWBProfile retval;

            if (idOfUploadAccount == -1)
            {
                if (MessageBox.Show("Please select or add a Profile to use for log uploading",
                    "Log uploading", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
                    == DialogResult.OK)
                {
                    AWBLogUploadProfilesForm profiles = new AWBLogUploadProfilesForm();
                    profiles.ShowDialog(owner);
                    retval = GetProfileForLogUploading(owner);
                }
                else
                    throw new System.Configuration.ConfigurationErrorsException("Log upload profile: User cancelled");
            }
            else
                retval = GetProfile(idOfUploadAccount);

            if (string.IsNullOrEmpty(retval.Password) && string.IsNullOrEmpty(TempPassword))
            {
                UserPassword password = new UserPassword {Username = retval.Username};
                if (password.ShowDialog() == DialogResult.OK)
                {
                    retval.Password = TempPassword = password.GetPassword;
                }
            }
            else if (!string.IsNullOrEmpty(TempPassword))
                retval.Password = TempPassword;
            return retval;
        }
        /// <summary>
        /// Publically accessible login, to allow calling of login via AWB startup parameters
        /// </summary>
        /// <param name="profileID">Profile ID to login to</param>
        public void login(int profileID)
        {
            if (profileID == -1)
                return;

            try
            {
                AWBProfile startupProfile = AWBProfiles.GetProfile(profileID);

                if (!string.IsNullOrEmpty(startupProfile.Password))
                {//Get 'Saved' Password
                    browserLogin(startupProfile.Username, startupProfile.Password);
                }
                else
                {//Get Password from User
                    UserPassword password = new UserPassword();
                    password.SetText = "Enter password for " + startupProfile.Username;

                    if (password.ShowDialog() == DialogResult.OK)
                        browserLogin(startupProfile.Username, password.GetPassword);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }