Ejemplo n.º 1
0
        private void LoadTest(object sender, RoutedEventArgs e)
        {
            if (isLoaded)
            {
                return;
            }
            isLoaded = true;

            //加载测试
            loadFinished(false);
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("id", JsonConvert.SerializeObject(-1));
            Boolean isSuccess = false;
            string  rtext     = HttpRequestHelper.HttpGet(Setting.BASE_URL + "test/loadTest", parameters, ref isSuccess);

            if (isSuccess)
            {
                ListeningTest test = JsonConvert.DeserializeObject <ListeningTest>(rtext);
                TestName.Text += test.title;
                MainWindow mainwin = (MainWindow)Application.Current.MainWindow;
                mainwin.ListeningTest = test;

                if (IsFinished(test))
                {
                    MessageBox.Show("您已完成所有测试!");
                    mainwin.FrameNavigator("funclist");
                    return;
                }

                //开启一个线程加载音频
                Task task = new Task(() => LoadAudios(test));
                task.Start();

                if (test.testno == 1 && (mainwin.User.questionaireBF == "" || mainwin.User.questionaireBF == null))
                {
                    TestQuestionaire testQuestionaire = new TestQuestionaire(test.testno);
                    testQuestionaire.Owner = mainwin;
                    testQuestionaire.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("网络错误请重试!");
                return;
            }
        }
Ejemplo n.º 2
0
        public ReportQRCode(string no, int t, int testno = -1)
        {
            InitializeComponent();
            Type = t;
            No   = no;

            MainWindow mainwin = (MainWindow)Application.Current.MainWindow;

            try
            {
                if (testno == 3 && (mainwin.User.questionaireAF == "" || mainwin.User.questionaireAF == null))
                {
                    TestQuestionaire testQuestionaire = new TestQuestionaire(3);
                    testQuestionaire.Owner = mainwin;
                    testQuestionaire.ShowDialog();
                }
            }
            catch (Exception)
            {
                ;
            }
            Loaded += CreateQRCode;
        }
Ejemplo n.º 3
0
        private void SubmitInspection_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidateInfo())
            {
                MessageBox.Show("请回答所有问题。", "提示");
                return;
            }
            answer.states   = FormatQuestionaire();
            answer.end_time = DateTransform.ConvertDataTimeToLong(DateTime.Now);

            answer.SaveLocal();
            MainWindow mainwin = (MainWindow)Application.Current.MainWindow;

            if (mainwin.ListeningTest.testno == 3 && (mainwin.User.questionaireAF == "" || mainwin.User.questionaireAF == null))
            {
                TestQuestionaire testQuestionaire = new TestQuestionaire(mainwin.ListeningTest.testno);
                testQuestionaire.Owner = mainwin;
                testQuestionaire.ShowDialog();
            }
            MessageBox.Show("恭喜您!已经完成测试!");
            mainwin.FrameNavigator("funclist");
            Close();
            return;
        }