private void btnRadom_Click(object sender, EventArgs e)
        {
            FormSimulation _simulaForm = FormMain.m_formSimulation;

            //List<Question> list = QuestionManager.GenQuestionBySkill(g_ChapterId);
            //List<Question> list = QuestionManager.GenQuestionFromRelation(g_ChapterInfo, g_Relation_Question_List);
            List <Question> list = new List <Question>();

            if (g_ChapterInfo.ChapterType == 3)
            {
                list = QuestionManager.GetErrorQuestionFromDB(g_ChapterInfo);
            }
            else
            {
                list = QuestionManager.GetQuestionsFromDB(g_ChapterInfo.ID);
            }

            if (g_ChapterInfo.ID != g_FirstChapterId)
            {
                if (!LicenseHelper.IsValid())
                {
                    if (DialogResult.Yes == MessageBox.Show("此章节需要升级为授权用户用方能使用,是否打开授权界面?", "授权提示", MessageBoxButtons.YesNo))
                    {
                        FormLicence form = new FormLicence();
                        form.ShowDialog();
                        if (!LicenseHelper.IsValid())
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }


            int count = list.Count;

            if (count == 0)
            {
                MessageBox.Show("此章节下面没绑定题目,请重新选择!", "提示信息", MessageBoxButtons.OK);
                return;
            }

            _simulaForm.SetQuestions(list);

            _simulaForm.SetShowType(1);
            _simulaForm.ResetControlsInfo(Math.Min(count, 100));


            _simulaForm.Show();
        }
        private void btnAuth_Click(object sender, EventArgs e)
        {
            string errorInfo = "";

            if (true == LicenseHelper.Register(txtBoxLicence.Text, out errorInfo))
            {
                MessageBox.Show(errorInfo, "提示信息", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show(errorInfo, "提示信息", MessageBoxButtons.OK);
            }

            Close();
        }
示例#3
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            //加载题目


            //生成答题框
            m_formSimulation = new FormSimulation();
            Thread FormThread = new Thread(() =>
            {
                m_formSimulation.GenControlsOfQuestions(100);
                // MessageBox.Show("生成控件完成");
            });

            FormThread.Start();

            if (0 == SystemConfig.GetUserType())
            {
                imageButtonMoudle.Visible   = false;
                imageButtonProblems.Visible = false;
                imageButtonSkill.Visible    = false;
            }
            else
            {
                imageButtonMoudle.Visible   = true;
                imageButtonProblems.Visible = true;
                imageButtonSkill.Visible    = true;
            }


            Thread VoiceThread = new Thread(() =>
            {
                VoiceHelper _voiceHelper = VoiceHelper.getVoiceHelper();
                //MessageBox.Show("加载声音组件完成");
            });

            VoiceThread.Start();

            Thread LicenceThread = new Thread(() =>
            {
                LicenseHelper.GetCpuId();
                LicenseHelper.GetLinceseInfo();
                //MessageBox.Show("获取授权信息完成");
            });

            LicenceThread.Start();

            btnHome.PerformClick();
        }
示例#4
0
        private void btnSequence_Click(object sender, EventArgs e)
        {
            FormSimulation  _simulaForm = FormMain.m_formSimulation;
            List <Question> list        = QuestionManager.GenQuestionByBankId(BankId);

            //if (BankId != firstBankId)
            if (true)
            {
                if (!LicenseHelper.IsValid())
                {
                    if (DialogResult.Yes == MessageBox.Show("此套题练习功能需要升级为授权用户用方能使用,是否打开授权界面?", "授权提示", MessageBoxButtons.YesNo))
                    {
                        FormLicence form = new FormLicence();
                        form.ShowDialog();
                        if (!LicenseHelper.IsValid())
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }


            int count = list.Count;

            if (count == 0)
            {
                MessageBox.Show("此套题下面没绑定题目,请重新选择!", "提示信息", MessageBoxButtons.OK);
                return;
            }

            list.Sort();
            _simulaForm.SetQuestions(list, false);

            _simulaForm.SetShowType(2);
            _simulaForm.ResetControlsInfo(Math.Min(count, 100));


            _simulaForm.Show();
        }
        private void FormLicence_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(LicenseHelper.ComputerGUID))
            {
                LicenseHelper.GetCpuId();
            }

            //richTextBoxLicense.Text = FileHelper.ReadTextFile("license.dat");
            textBoxCupId.Text  = LicenseHelper.ComputerGUID;
            txtBoxLicence.Text = FileHelper.ReadTextFile("license.dat");

            if (LicenseHelper.IsValid() == true)
            {
                labelInfo.ForeColor = Color.Green;
                labelInfo.Text      = "授权信息正常";
            }
            else
            {
                labelInfo.ForeColor = Color.DarkRed;
                labelInfo.Text      = "授权信息验证失败";
            }
        }