Exemplo n.º 1
0
        private void Main_Load(object sender, EventArgs e)
        {
            IsMdiContainer = true;
            Refresh();

            SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            FillBackgroundImage(false);

            ServidorToolStripStatus.Text = gtiCore.ServerName;

            Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            VersaoToolStripStatus.Text = $"{version.Major}" + "." + $"{version.Minor}" + "." + $"{version.Build}";
            Text += VersaoToolStripStatus.Text;
            //Exception ex = gtiCore.LoadSettings();
            //if (ex != null) {
            //    ErrorBox eBox = new ErrorBox("Atenção", "Erro ao carregar as configurações do sistema.", ex);
            //    eBox.ShowDialog();
            //    Application.Exit();
            //} else {
            ServidorToolStripStatus.Text = gtiCore.ServerName;
            LockForm(true);
            Forms.Login login = new Forms.Login();
            login.ShowDialog();
            //}
        }
Exemplo n.º 2
0
 private void BtSair_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Deseja fechar todas as janelas e retornar a tela de login?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Form[] charr = this.MdiChildren;
         foreach (Form chform in charr)
         {
             chform.Close();
         }
         LockForm(true);
         Forms.Login login = new Forms.Login();
         login.ShowDialog();
     }
 }
Exemplo n.º 3
0
        private void Main_Load(object sender, EventArgs e)
        {
            FillBackgroundColor(false);

            //typeof(Panel).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, DrawingPanel, new object[] { true });

            ServidorToolStripStatus.Text = Properties.Settings.Default.ServerName;

            Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            VersaoToolStripStatus.Text = $"{version.Major}" + "." + $"{version.Minor}" + "." + $"{version.Build}";
//            this.Text += VersaoToolStripStatus.Text;

            LockForm(true);
            Forms.Login login = new Forms.Login();
            login.ShowDialog();
        }
Exemplo n.º 4
0
        static public bool Login()
        {
            Forms.Login  login = new Forms.Login();
            DialogResult dr    = login.ShowDialog();

            if (dr == DialogResult.Cancel)
            {
                Application.Exit();
                return(false);
            }

            Config.user_NameMain = login.UserName;
            Config.user_Pass     = login.Password;

            Config.WriteConfig();

            return(true);
        }
Exemplo n.º 5
0
        /*
         * BOOK VIEW FUNCTIONS
         */


        private void CheckLogin()
        {
            if (db_handler.GetAdminCount() > 0)
            {
                Forms.Login dlg = new Forms.Login();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    string uname = dlg.username.Text;
                    string pw    = dlg.pw.Text;

                    List <Admin> admins = db_handler.GetAdminsByUsername(uname);

                    bool successful = false;

                    foreach (Admin a in admins)
                    {
                        if (CryptoHelper.CheckPassword(pw, a.Hash, a.Salt))
                        {
                            successful = true;
                            break;
                        }
                    }

                    if (!successful)
                    {
                        MessageBox.Show("Wrong credentials!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        CheckLogin();
                    }
                }
                else
                {
                    this.Backup = false;
                    Application.Exit();
                }
            }
        }
Exemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataBase.DataBase db = new DataBase.DataBase();
            //if selected to import a txt- file containg TLE data
            if (radioButton1.Checked)
            {
                this.Cursor = Cursors.WaitCursor;
                List <One_Sgp4.Tle> satTleData = new List <One_Sgp4.Tle>();
                satTleData = One_Sgp4.ParserTLE.ParseFile(tleFilePath);
                for (int i = 0; i < satTleData.Count(); i++)
                {
                    db.writeTleData(satTleData[i]);
                }
            }
            //if selected to add TLE - Data Manuely
            if (radioButton3.Checked)
            {
                this.Cursor = Cursors.WaitCursor;
                One_Sgp4.Tle satTleData = new One_Sgp4.Tle();
                satTleData = One_Sgp4.ParserTLE.parseTle(textTleLine1.Text, textTleLine2.Text, textNameID.Text);
                db.writeTleData(satTleData);
            }
            //if selected to load TLE - Data from Internet
            if (radioButton2.Checked)
            {
                string[]    searchIDs = textBox1.Text.Split(',');
                Forms.Login loginForm = new Forms.Login(this);
                loginForm.ShowDialog();
                if (userName != null && password != null)
                {
                    this.Cursor = Cursors.WaitCursor;
                    string res = One_Sgp4.SpaceTrack.GetSpaceTrack(searchIDs, userName, password);
                    if (res.Count() > 0)
                    {
                        string[] tleLines = res.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);

                        if (tleLines.Count() >= 3)
                        {
                            for (int i = 0; i < tleLines.Count() - 1; i += 3)
                            {
                                One_Sgp4.Tle satTleData = new One_Sgp4.Tle();
                                satTleData = One_Sgp4.ParserTLE.parseTle(tleLines[i + 1], tleLines[i + 2], tleLines[i]);
                                db.writeTleData(satTleData);
                            }
                        }
                        else
                        {
                            errorCode = 1;
                            //error parsing information
                        }
                    }
                }
                else
                {
                    errorCode = 2;
                    //No UserName or Password were given
                }
            }
            if (radioButton4.Checked)
            {
                List <string> tleList   = db.getAllNoradID();
                string[]      searchIDs = new string[tleList.Count];

                for (int i = 0; i < tleList.Count; i++)
                {
                    searchIDs[i] = tleList[i];
                }

                Forms.Login loginForm = new Forms.Login(this);
                loginForm.ShowDialog();
                if (userName != null && password != null)
                {
                    this.Cursor = Cursors.WaitCursor;
                    string res = One_Sgp4.SpaceTrack.GetSpaceTrack(searchIDs, userName, password);
                    if (res.Count() > 0)
                    {
                        string[] tleLines = res.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);

                        if (tleLines.Count() >= 3)
                        {
                            for (int i = 0; i < tleLines.Count() - 1; i += 3)
                            {
                                One_Sgp4.Tle satTleData = new One_Sgp4.Tle();
                                satTleData = One_Sgp4.ParserTLE.parseTle(tleLines[i + 1], tleLines[i + 2], tleLines[i]);
                                db.writeTleData(satTleData);
                            }
                        }
                        else
                        {
                            errorCode = 1;
                            //error parsing information
                        }
                    }
                }
                else
                {
                    errorCode = 2;
                    //No UserName or Password were given
                }
            }
            db.closeDB();
            db = null;
            switch (errorCode)
            {
            case 1:
                MessageBox.Show("Unable to Update from Server.\n Login information could be wrong or server is not reachable", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case 2:
                //MessageBox.Show("No Login information given", "Error",
                //    MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                this.Cursor = Cursors.Default;
                break;

            default:
                this.Close();
                this.Cursor = Cursors.Default;
                break;
            }
        }