//Login Panel algin to center of the screen
        private void FormSetup()
        {
            lblTime.Text = WindowHandler.PresentTime();
            lblTime.Top  = Screen.PrimaryScreen.WorkingArea.Height - 5;
            lblBeta.Top  = lblTime.Top;
            lblBeta.Left = Screen.PrimaryScreen.WorkingArea.Width - 80;

            pnlLogin.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - (pnlLogin.Width / 2);
            pnlLogin.Top  = Screen.PrimaryScreen.WorkingArea.Height / 2 - (pnlLogin.Top / 2);

            pnlSetup.Left = pnlLogin.Left;
            pnlSetup.Top  = pnlLogin.Top + pnlLogin.Height + 30;

            lblClose.Left = Screen.PrimaryScreen.WorkingArea.Width - 25;

            connection = SystemRegistryHandler.ReadRegistry(ProjectConstants.ProjectName, "Connection", EncryptionOptions.NoEncryption);
            if (connection == null)
            {
                txtServerAndSQL.Text = Environment.MachineName + "\\SQLEXPRESS";
                pnlSetup.Visible     = true;
                HeadingVisibility(false);
            }
            else
            {
                HeadingVisibility(true);
            }
        }
        private void FirstStartUp()
        {
            if (txtServerAndSQL.Text != "")
            {
                if (connection == null)
                {
                    if (DataLayer.TestConnection(txtServerAndSQL.Text.Trim() + DatabaseConstants.MSSQLConnectionString))
                    {
                        SystemRegistryHandler.SaveRegistry(ProjectConstants.ProjectName, "Connection", txtServerAndSQL.Text.Trim(), EncryptionOptions.NoEncryption);
                        MessageBox.Show(Messages.ConnectionOK, ProjectConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Information);

                        pnlLogin.Visible = true;
                        pnlSetup.Visible = false;
                    }
                    else
                    {
                        MessageBox.Show(Messages.ConnectionError, ProjectConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    pnlLogin.Visible = true;
                }
            }
            else
            {
                MessageBox.Show(Messages.Invalid, ProjectConstants.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
 public static void ReadWindowPosition(Form form, string root)
 {
     form.Top  = Convert.ToInt32(SystemRegistryHandler.ReadRegistry(root, "Top", EncryptionOptions.NoEncryption));
     form.Left = Convert.ToInt32(SystemRegistryHandler.ReadRegistry(root, "Left", EncryptionOptions.NoEncryption));
 }
Beispiel #4
0
 public static void SaveWindowPosition(Form form, string root)
 {
     SystemRegistryHandler.SaveRegistry(root, "Top", form.Top.ToString(), EncryptionOptions.NoEncryption);
     SystemRegistryHandler.SaveRegistry(root, "Left", form.Left.ToString(), EncryptionOptions.NoEncryption);
 }
Beispiel #5
0
 public static string GetServer()
 {
     return("Data Source=" + SystemRegistryHandler.ReadRegistry(ProjectConstants.ProjectName, "Connection", EncryptionOptions.NoEncryption));
 }