示例#1
0
        private static void FirstEntrance()
        {
            if (SystemArgs.FirstEntrance)
            {
                WelcomeFirst_F DialogW = new WelcomeFirst_F();

                if (DialogW.ShowDialog() == DialogResult.OK)
                {
                    SystemArgs.PrintLog($"Инциализация процедуры настройки программы");
                }
                else
                {
                    Application.Exit();
                    return;
                }


                Question_F DialogQ = new Question_F();

                if (DialogQ.ShowDialog() == DialogResult.OK)
                {
                    SystemArgs.PrintLog($"Пути успешно указаны");
                }
                else
                {
                    Application.Exit();
                    return;
                }

                CreatePass_F DialogP = new CreatePass_F();

                if (DialogP.ShowDialog() == DialogResult.OK)
                {
                    SystemPath.SetAnswer(DialogQ.Question_TB.Text.Trim(), DialogQ.Answer_TB.Text.Trim());

                    SystemPath.SetDataRegPath(DialogQ.RegUser_TB.Text.Trim());
                    SystemPath.SetDataUsersPath(DialogQ.DataUser_TB.Text.Trim());
                    SystemPath.SetPasswordApp(DialogP.Password_TB.Text.Trim());
                }
                else
                {
                    Application.Exit();
                    return;
                }

                SystemPath.SetEntrance(false);

                SystemArgs.FirstEntrance = false;

                SystemArgs.PrintLog($"Процедуры настройки программы завершена");
            }
            else
            {
                Autorization_Form Dialog = new Autorization_Form();

                if (Dialog.ShowDialog() == DialogResult.OK)
                {
                }
            }
        }
        private void Reg_B_Click(object sender, EventArgs e)
        {
            Restore_F Dialog = new Restore_F();

            using (StreamReader sr = new StreamReader(File.Open(SystemPath.AnswerPath, FileMode.Open)))
            {
                String[] Temp = sr.ReadLine().Split('_');

                Dialog.Question_TB.Text = Encryption.DecryptRSA(Temp[0], Temp[1]);
            }

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                CreatePass_F DialogP = new CreatePass_F();

                if (DialogP.ShowDialog() == DialogResult.OK)
                {
                    SystemPath.SetPasswordApp(DialogP.Password_TB.Text.Trim());
                }
                else
                {
                    MessageOneButton_F DialogErr = new MessageOneButton_F();

                    DialogErr.Message_L.Text = "Восстановление пароля отменено";

                    if (Dialog.ShowDialog() == DialogResult.OK)
                    {
                    }

                    SystemArgs.PrintLog($"Восстановление пароля отменено");
                }
            }
        }