Ejemplo n.º 1
0
        private void QuitApp()
        {
            if (Manager.GetInstance().User.Mode == "shixun")
            {
                LoadFlash.FSCommand -= FlashFlashCommand;

                SetGZForm form = new SetGZForm();
                form.ShowDialog(this);

                LoadFlash.FSCommand += new _IShockwaveFlashEvents_FSCommandEventHandler(FlashFlashCommand);
            }
            else
            {
                Exit();
            }
        }
Ejemplo n.º 2
0
        private void Login(string argv)
        {
            //参数p
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            string[] sArray = Regex.Split(argv, ",", RegexOptions.IgnoreCase);
            parameters.Add("stuId", sArray[0]);
            parameters.Add("password", sArray[1]);

            //http请求
            string json = JsonConvert.SerializeObject(parameters);

            System.Net.HttpWebResponse res = Manager.CreatePostHttpResponse(Manager.GetInstance().Config.Http + "/user/stuLogin", json, "POST", 3000, null, null);
            string msg = "";

            if (res == null)
            {
                Console.WriteLine("网络服务异常");
            }
            else
            {
                //获取返回数据转为字符串
                msg = Manager.GetResponseString(res);
                Manager.GetInstance().User.HttpStudent = JsonConvert.DeserializeObject <HttpStudent>(msg);
            }

            if (msg.Length == 0 || Manager.GetInstance().User.HttpStudent.Code == 0)
            {
                MessageBox.Show("用户名或密码错误", "虚拟仿真教学-卡罗拉", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                return;
            }

            Manager.GetInstance().CleanSubject();

            if (Manager.GetInstance().User.Mode == "kaohe")
            {
                res = Manager.CreatePostHttpResponse(Manager.GetInstance().Config.Http + "/external/gzList?stuId=" + Manager.GetInstance().User.HttpStudent.Data.Id, "", "GET", 3000, null, null);
                msg = Manager.GetResponseString(res);

                if (msg.Length == 0)
                {
                    MessageBox.Show("你还不能考试哦!", "虚拟仿真教学-卡罗拉", MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    return;
                }

                Manager.GetInstance().User.HttpExam = JsonConvert.DeserializeObject <HttpExam>(msg);

                Manager.GetInstance().InitSubject(Manager.GetInstance().User.HttpExam.TestContent);
            }

            Manager.GetInstance().UpdateSubject();

            LoadFlash.SetVariable("Temp", Manager.GetInstance().Config.Temp);
            LoadFlash.SetVariable("Pressure", Manager.GetInstance().Config.Pressure);

            if (Manager.GetInstance().User.Mode == "kaohe")
            {
                LoadFlash.LoadMovie(0, System.IO.Directory.GetCurrentDirectory() + "\\Data\\Surface\\index.swf");

                TimeSpan timeSpan = Manager.GetInstance().User.HttpExam.TEndTime - DateTime.Now.ToLocalTime();
                LoadFlash.SetVariable("LoginInf", Manager.GetInstance().User.HttpStudent.Data.StuId
                                      + "," + Manager.GetInstance().User.HttpStudent.Data.StuName
                                      + "," + timeSpan.TotalMinutes
                                      + "," + Manager.GetInstance().SubjectRows.Length
                                      + "," + Manager.GetInstance().User.HttpStudent.Data.ClassNum
                                      );

                Manager.GetInstance().User.PracticID = Manager.GetInstance().User.HttpExam.TId + "-" + Manager.GetInstance().User.HttpStudent.Data.StuId;
            }
            else
            {
                Manager.GetInstance().User.PracticID = Manager.GetInstance().User.HttpStudent.Data.StuId + DateTime.Now.ToFileTimeUtc().ToString();

                SetGZForm form = new SetGZForm();
                form.IsLogin = true;
                form.ShowDialog(this);
            }
        }