Esempio n. 1
0
        /// <param name="ShowLoginHistory">Allow user to select from list of previous usernames and databases</param>
        /// <param name="HistoryLength">Number of items to store in the history</param>
        /// <param name="SettingsDir">Settings directory (location to store list of logins)</param>
        /// <param name="SchemaPath">Full path to directory where XML Schemas are stored</param>
        /// <param name="Databases">List of databases to allow the user to choose from</param>
        public Login(
            bool ShowLoginHistory,
            int HistoryLength,
            string SettingsDir,
            string SchemaPath,
            StringCollection Servers)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            //Clears text boxes
            UserName = "";
            Password = "";
            Server   = "";

            //In case they didn't pass a trailing backslash
            if (SettingsDir[SettingsDir.Length - 1] != '\\')
            {
                SettingsDir += "\\";
            }

            if (SchemaPath[SchemaPath.Length - 1] != '\\')
            {
                SchemaPath += "\\";
            }

            //Create the settings directory, in case it doesn't exist
            if (!System.IO.Directory.Exists(SettingsDir))
            {
                System.IO.Directory.CreateDirectory(SettingsDir);
            }

            userListXmlFile = SettingsDir + "DBLoginHistory.xml";

            //Create the login history list
            history = new LoginHistory(SchemaPath, userListXmlFile);
            //Just in case the HistoryLength passed is negative
            history.HistoryLength = Math.Abs(HistoryLength);               //safeguard against negative input

            //This is how you disable the Login History, if ShowLoginHistory is false
            userName.Properties.Buttons[0].Visible = ShowLoginHistory;

            //Load databases into the combo box's dropdown
            DBList.Clear();
            foreach (string db in Servers)
            {
                DBList.Add(db);
            }

            SetWindowText();
        }
Esempio n. 2
0
		/// <param name="ShowLoginHistory">Allow user to select from list of previous usernames and databases</param>
		/// <param name="HistoryLength">Number of items to store in the history</param>
		/// <param name="SettingsDir">Settings directory (location to store list of logins)</param>
		/// <param name="SchemaPath">Full path to directory where XML Schemas are stored</param>
		/// <param name="Databases">List of databases to allow the user to choose from</param>
		public Login(
			bool ShowLoginHistory,
			int HistoryLength,
			string SettingsDir,
			string SchemaPath,
			StringCollection Servers )
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			//Clears text boxes
			UserName = "";
			Password = "";
			Server   = "";

			//In case they didn't pass a trailing backslash
			if( SettingsDir[SettingsDir.Length-1] != '\\' )
				SettingsDir += "\\";

			if( SchemaPath[SchemaPath.Length-1] != '\\' )
				SchemaPath += "\\";

			//Create the settings directory, in case it doesn't exist
			if( !System.IO.Directory.Exists( SettingsDir ) )
				System.IO.Directory.CreateDirectory( SettingsDir );

			userListXmlFile = SettingsDir + "DBLoginHistory.xml";

			//Create the login history list
			history = new LoginHistory( SchemaPath, userListXmlFile );
			//Just in case the HistoryLength passed is negative
			history.HistoryLength = Math.Abs( HistoryLength ); //safeguard against negative input

			//This is how you disable the Login History, if ShowLoginHistory is false
			userName.Properties.Buttons[0].Visible = ShowLoginHistory;
				
			//Load databases into the combo box's dropdown
			DBList.Clear();
			foreach( string db in Servers )
				DBList.Add( db );

			SetWindowText();
		}
Esempio n. 3
0
		/// <param name="ShowLoginHistory">Allow user to select from list of previous usernames and databases</param>
		/// <param name="HistoryLength">Number of items to store in the history</param>
		/// <param name="SettingsDir">Settings directory (location to store list of logins)</param>
		/// <param name="SchemaPath">Full path to directory where XML Schemas are stored</param>
		/// <param name="Servers">List of databases to allow the user to choose from</param>
		public frmLogin(
			bool ShowLoginHistory,
			int HistoryLength,
			string SettingsDir,
			string SchemaPath,
			StringCollection Servers )
		{
			InitializeComponent();            

			//Clears text boxes
			UserName = "";
			Password = "";
			Server = "";
            Database = "";

            settingsDir = SettingsDir;

			//In case they didn't pass a trailing backslash
			if( SettingsDir[SettingsDir.Length - 1] != '\\' )
				SettingsDir += "\\";

			if( SchemaPath[SchemaPath.Length - 1] != '\\' )
				SchemaPath += "\\";

			//Create the settings directory, in case it doesn't exist
			if( !System.IO.Directory.Exists( SettingsDir ) )
				System.IO.Directory.CreateDirectory( SettingsDir );

            userListXmlFile = Path.Combine(SettingsDir, "DBLoginHistory.xml");
            string userListXmdFile = Path.Combine(SettingsDir, "LoginHistory.xsd");
            string xsdDistLocation = Path.Combine(System.Environment.CurrentDirectory, "LoginHistory.xsd");

            if (!File.Exists(userListXmdFile))
            {
                File.Copy(xsdDistLocation, userListXmdFile);
            }

            ReadUserSettings();

			//Create the login history list
			history = new LoginHistory( SchemaPath, userListXmlFile );
			//Just in case the HistoryLength passed is negative
			history.HistoryLength = Math.Abs( HistoryLength ); //safeguard against negative input

			//This is how you disable the Login History, if ShowLoginHistory is false
			userName.Properties.Buttons[0].Visible = ShowLoginHistory;

			//Load databases into the combo box's dropdown
			DBList.Clear();
			foreach( string db in Servers )
				DBList.Add( db );

			SetWindowText();
		}
Esempio n. 4
0
        /// <param name="ShowLoginHistory">Allow user to select from list of previous usernames and databases</param>
        /// <param name="HistoryLength">Number of items to store in the history</param>
        /// <param name="SettingsDir">Settings directory (location to store list of logins)</param>
        /// <param name="SchemaPath">Full path to directory where XML Schemas are stored</param>
        /// <param name="Servers">List of databases to allow the user to choose from</param>
        public frmLogin(
            bool ShowLoginHistory,
            int HistoryLength,
            string SettingsDir,
            string SchemaPath,
            StringCollection Servers)
        {
            InitializeComponent();

            //Clears text boxes
            UserName = "";
            Password = "";
            Server   = "";
            Database = "";

            settingsDir = SettingsDir;

            //In case they didn't pass a trailing backslash
            if (SettingsDir[SettingsDir.Length - 1] != '\\')
            {
                SettingsDir += "\\";
            }

            if (SchemaPath[SchemaPath.Length - 1] != '\\')
            {
                SchemaPath += "\\";
            }

            //Create the settings directory, in case it doesn't exist
            if (!System.IO.Directory.Exists(SettingsDir))
            {
                System.IO.Directory.CreateDirectory(SettingsDir);
            }

            userListXmlFile = Path.Combine(SettingsDir, "DBLoginHistory.xml");
            string userListXmdFile = Path.Combine(SettingsDir, "LoginHistory.xsd");
            string xsdDistLocation = Path.Combine(System.Environment.CurrentDirectory, "LoginHistory.xsd");

            if (!File.Exists(userListXmdFile))
            {
                File.Copy(xsdDistLocation, userListXmdFile);
            }

            ReadUserSettings();

            //Create the login history list
            history = new LoginHistory(SchemaPath, userListXmlFile);
            //Just in case the HistoryLength passed is negative
            history.HistoryLength = Math.Abs(HistoryLength);               //safeguard against negative input

            //This is how you disable the Login History, if ShowLoginHistory is false
            userName.Properties.Buttons[0].Visible = ShowLoginHistory;

            //Load databases into the combo box's dropdown
            DBList.Clear();
            foreach (string db in Servers)
            {
                DBList.Add(db);
            }

            SetWindowText();
        }