Пример #1
0
        void dlgLogin_FormClosing(object sender, FormClosingEventArgs e)
        {
            m_dlgLogin.FormClosing -= dlgLogin_FormClosing;

            if (!m_dlgLogin.IsFilledOut)
            {
                m_pPerson = new Person("unknown", "unknown");
                return;
            }
            if (m_dlgLogin.RememberMe)
            {
                AppSettings.Instance.loginName = m_dlgLogin.UserName;
                AppSettings.Instance.loginPassword = m_dlgLogin.Password;
                AppSettings.Instance.rememberLastLogin = true;
            }
            m_pPerson = new Person(m_dlgLogin.UserName, m_dlgLogin.Password);
            try
            {
                m_pPerson.Load();
            }
            catch (System.Exception)
            {
                m_pPerson = new Person("unknown", "unknown");
            }

            this.Text = "Time Assist [" + m_pPerson.Name + "]";

            UpdateForm(m_pPerson);
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //LoadRecordsBinary("test.xml.bin");
            //LoadRecordsSoap("SoapTest.xml");
            if (AppSettings.Instance.rememberLastLogin)
            {
                m_pPerson = new Person(AppSettings.Instance.loginName, AppSettings.Instance.loginPassword);
                try
                {
                    m_pPerson.Load();
                }
                catch (System.Exception)
                {
                    m_pPerson = new Person("unknown", "unknown");
                }

                this.Text = "Time Assist [" + m_pPerson.Name + "]";

                UpdateForm(m_pPerson);
            }
            else
            {
                ShowLoginDialog();
            }
        }