public static bool loadClassInfo() { if (m_classid == -1) { return(false); } Classes c = m_db.getClassById(m_classid); if (c != null) { Global.setClassID(c.id); Global.setClassname(c.name); Global.setGrade(c.grade); } string dir = Application.StartupPath + "\\conf\\"; string filename = m_schoolid + "-" + m_classid + ".conf"; FileOper fo = new FileOper(dir, filename); string strClassInfo = Common.getClassInfo(); if (strClassInfo.Length > 0) { //更新本地缓存 fo.WriteFile(strClassInfo); g_ClassInfoStr = strClassInfo; Log.Info("Global.loadClassInfo() ...2-ok!"); Log.Debug(g_ClassInfoStr); } else { Log.Error("getClassInfo error."); g_ClassInfoStr = fo.ReadFile(); Log.Error("Global.loadClassInfo() ...2-err..." + g_ClassInfoStr); } if (g_ClassInfoStr.Length > 0) { g_ClassInfo = JsonOper.DeserializeJsonToObject <ClassInfo>(g_ClassInfoStr); g_StudentInfoArray = g_ClassInfo.Data.Student; g_TeacherArray = g_ClassInfo.Data.Teacher; int nClassID = g_ClassInfo.Data.ID; int nGrade = g_ClassInfo.Data.Grade; Global.setGrade(nGrade); Global.setClassID(nClassID); Global.setClassname(g_ClassInfo.Data.Name); Global.setUploadInvalidData(g_ClassInfo.Data.UploadInvalidData); g_Studentlist.Clear(); foreach (StudentInfo s in g_StudentInfoArray) { User u = new User(); u.id = Int32.Parse(s.ID); u.name = s.Name; u.cardid = s.cardid; u.seat = s.SEAT.Replace("-", ""); u.type = 2;//student u.schoolid = m_schoolid; u.classid = nClassID; u.imageurl = s.imageurl; string pinying = Util.GetPinyin(s.Name); u.pinying = pinying; s.pinyin = pinying; //u.classname = Global.getClassname(); g_Studentlist.Add(u); } //write to RueSqlite.db { //更新学生信息 if (g_Studentlist.Count > 0) { int nDel = m_db.delUser(nClassID, 2); int nAdd = m_db.addUser(g_Studentlist); int a = nDel; } } } return(true); }
public static int loadSchoolInfo(int schoolid, string authcode) { int ret = 0; string dir = Application.StartupPath + "\\conf\\"; string filename = schoolid + ".conf"; FileOper fo = new FileOper(dir, filename); string strSchoolInfo = Common.getSchoolInfo(schoolid, authcode); if (strSchoolInfo.Length > 0) { SchoolInfo info = JsonOper.DeserializeJsonToObject <SchoolInfo>(strSchoolInfo); if (info.schoolid > 0) { Global.saveSchoolConfig(schoolid, authcode); g_szAwardType = info.awardtypelist; //更新本地缓存 fo.WriteFile(strSchoolInfo); g_SchoolInfoStr = strSchoolInfo; Log.Info("Global.loadSchoolInfo() ...2-ok!"); Log.Debug(g_SchoolInfoStr); ret = 1; } } else { Log.Info("getSchoolInfo error, load from conf now..."); string data = fo.ReadFile(); if (data.Length > 0) { g_SchoolInfoStr = data; ret = 2; } Log.Info("Global.loadSchoolInfo() ...2-err..." + g_SchoolInfoStr); } //if (strSchoolInfo.Length > 0) if (ret == 1) { SchoolInfo info = JsonOper.DeserializeJsonToObject <SchoolInfo>(g_SchoolInfoStr); User[] si = info.teacherlist; List <User> teacherlist = new List <User>(); foreach (User u in si) { teacherlist.Add(u); } int nDel = m_db.delTeachers(m_schoolid); int nAdd = m_db.addUser(teacherlist); int a = nDel; Global.setSchoolID(schoolid); Global.setSchoolname(info.schoolname); m_db.delSchool(info.schoolid); m_db.addSchool(info.schoolid, info.schoolname); g_szClasses = info.classlist; int nClassDel = m_db.delClassBySchoolid(m_schoolid); int nClassAdd = 0; foreach (Classes c in g_szClasses) { nClassAdd += m_db.addClass(c); } Log.Info("Global.loadSchoolInfo() nClassDel=" + nClassDel + ", nClassAdd=" + nClassAdd); string coursetimes = info.coursetime; m_db.delCourseTime(); m_db.addCourseTime(coursetimes); Log.Info("Global.loadSchoolInfo() Over."); g_SchoolInfoStr = strSchoolInfo; } else if (ret == 2) { Log.Info("getSchoolInfo error."); SchoolInfo info = JsonOper.DeserializeJsonToObject <SchoolInfo>(g_SchoolInfoStr); User[] si = info.teacherlist; List <User> teacherlist = new List <User>(); foreach (User u in si) { teacherlist.Add(u); } Global.setSchoolID(schoolid); Global.setSchoolname(info.schoolname); g_szClasses = info.classlist; } if (g_SchoolInfoStr.Length == 0) { return(-1); } else { return(1); } }
public void CloseView() { Log.Info("CloseView over."); if (m_bDraw) { //上传画过的图片 Image img = ScreenCapture.captureScreen(0, 0); string imgName = DateTime.Now.ToString("yyyyMMdd") + "-" + Global.getSchoolID() + "-" + Global.getClassID() + "-" + DateTime.Now.ToString("HHmmss") + ".jpg"; string imgDir = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(imgDir)) { Directory.CreateDirectory(imgDir); } string imgPath = imgDir + "\\" + imgName; img.Save(imgPath); Common.uploadPicture(imgPath);//drawView Common.uploadDrawView(imgName); } m_bDraw = false; this.Close(); }
/// <summary> /// 打开图片 /// </summary> /// <param name="datas"></param> /// <param name="mode">1: 数据流 2:本地文件 3:拍照文件</param> public FormCaptureScreen2() { InitializeComponent(); this.pictureBox1.Size = new System.Drawing.Size(screenWidth, SystemInformation.WorkingArea.Height - 80); this.Size = new System.Drawing.Size(screenWidth, SystemInformation.WorkingArea.Height - 80); this.Top = 0; this.Location = new Point(0, 0); this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; //this.WindowState = FormWindowState.Maximized; this.TopMost = true; #if DEBUG this.TopMost = false;//Form3 ShowView #endif this.pictureBox1.Visible = false; this.pictureBox1.Visible = true; try { m_bmp = ScreenCapture.captureScreen(0, 0); m_base64 = Util.ImgToBase64String(m_bmp); imgHeight = m_bmp.Height; imgWidth = m_bmp.Width; Log.Info("imgHeight=" + imgHeight + " imgWidth=" + imgWidth); Log.Info("screenHeight=" + screenHeight + " screenWidth=" + screenWidth); //m_bmp = new Bitmap(m_bmp, screenWidth, screenHeight);//不能图片缩放,因为破坏了图片的质量 this.pictureBox1.Image = m_bmp; this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; this.pictureBox1.Width = screenWidth; this.pictureBox1.Height = screenHeight; //doUpload if (true) { string imgName = DateTime.Now.ToString("yyyyMMdd") + "-" + Global.getSchoolID() + "-" + Global.getClassID() + "-" + DateTime.Now.ToString("HHmmss") + ".jpg"; string imgDir = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(imgDir)) { Directory.CreateDirectory(imgDir); } string imgPath = imgDir + "\\" + imgName; m_bmp.Save(imgPath); Common.uploadPicture(imgPath); //Common.uploadCameraEvent(imgName);//相机拍照 } } catch (Exception ex) { Log.Error(ex.Message); } ////(图片宽>屏幕宽 && 图片高>屏幕高) //if ((pictureBox1.Width > Screen.PrimaryScreen.WorkingArea.Width && pictureBox1.Height > Screen.PrimaryScreen.WorkingArea.Height) || // (pictureBox1.Width > Screen.PrimaryScreen.WorkingArea.Width && pictureBox1.Height < Screen.PrimaryScreen.WorkingArea.Height)) //{ // MakeThumbnail(pictureBox1.Width, pictureBox1.Height, "W"); //} ////(图片宽<屏幕宽 && 图片高>屏幕高) 高度压缩 //else if (pictureBox1.Width < Screen.PrimaryScreen.WorkingArea.Width && pictureBox1.Height > Screen.PrimaryScreen.WorkingArea.Height) //{ // MakeThumbnail(pictureBox1.Width, pictureBox1.Height, "H"); //} //else //{ // pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; // this.pictureBox1.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - pictureBox1.Width / 2; // this.pictureBox1.Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - pictureBox1.Height / 2; //} }
public bool restart() { Log.Info("FormHandon.clear"); RESULT = ""; for (int i = 0; i < clickstate.Count; i++) { PictureBox lb = (PictureBox)al[i]; PictureBox text = (PictureBox)alText[i]; LabelStateEventClear(lb, text, i + 1); clickstate[i] = 0; } stuPushCount.Clear(); _callnamsStr = ""; _rewardStr = ""; _criticizeStr = ""; _querytimes = 0; tm_create = DateTime.Now; _xitiId = Global.getSchoolID() + "-" + _classid + "-" + DateTime.Now.ToString("yyyyMMddHHmmss"); //TODO: 截屏上传 if ((EService.myppt != null && EService.myppt.isOpen()) || EService.bShowPicture) { _xitiId = "H_" + _xitiId; Image img = ScreenCapture.captureScreen(0, 0); string imgName = _xitiId + ".jpg"; string imgDir = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(imgDir)) { Directory.CreateDirectory(imgDir); } string imgPath = imgDir + "\\" + imgName; img.Save(imgPath); Common.uploadPicture(imgPath); } Log.Info("FormHandon _xitiId=" + _xitiId + ", SetPanel now..."); pictureBox2.Visible = false; pictureBox3.Visible = false; pictureBox4.Visible = false; StartPosition = FormStartPosition.Manual; SetDesktopLocation(0, screenHeight - this.Height); try { this.TopMost = true; this.Hide(); Global.panelshow = 1; this.BringToFront(); } catch (Exception e) { Log.Error("Handon.clear exception."); return(false); } IntelligentRecommend.InitQuestion(); //Common.ClearHandon(); t = new System.Timers.Timer(100); t.Elapsed += new System.Timers.ElapsedEventHandler(Theout); t.Enabled = true; t.AutoReset = true; return(true); }
private void Theout(object sender, System.Timers.ElapsedEventArgs e) { if (Interlocked.Exchange(ref inTimer, 1) == 0) { //string data = Common.GetHandon(); string data = Global.RaiseStu; // Global.RaiseStu = ""; if (data != null && data.Length > 0 && t.Enabled) { //Console.WriteLine(data); //data:2|3 DateTime tm_now = DateTime.Now; TimeSpan createtimespan = new TimeSpan(tm_create.Ticks); TimeSpan nowtimespan = new TimeSpan(tm_now.Ticks); TimeSpan timespan = nowtimespan.Subtract(createtimespan).Duration(); int timeDiff = timespan.Minutes * 60 + timespan.Seconds; Log.Info("Theout. handon=" + data + ", timediff=" + timeDiff); //0-3:56AAA549,H|0-4:56AAA54A,H| string context = ""; string[] szItem = data.Split('|'); for (int i = 0; i < szItem.Length; i++) { string item = szItem[i]; item = Global.getSeatByCardid(item); int num = Util.toInt(item); context = num + ":H:" + timeDiff; //updateTop3(num); int _count = 1; if (stuPushCount.Contains(num)) { _count = (int)stuPushCount[num] + 1; stuPushCount.Remove(num); } else { IntelligentRecommend.addHandon(num); } stuPushCount.Add(num, _count); Log.Info("Theout. num=" + num + ", count=" + _count); for (int j = 0; j < al.Count; j++) { PictureBox lb = (PictureBox)al[j]; PictureBox text = (PictureBox)alText[j]; if ((num - 1) == j) //&& (int)clickstate[j] == 0 { LabelStateEvent(context, lb, text, j + 1); clickstate[j] = 1; Log.Info("Theout.LabelStateEvent id=" + num + ", al.Count=" + al.Count + ", ok."); } } } } else { _querytimes++; if (_querytimes > 10 * 3) { HideEvent(true); } } Interlocked.Exchange(ref inTimer, 0); } }
public FormHandon(string numberstr) { Global.panelshow = 1; Log.Info("FormHandon.create, numberstr=" + numberstr); al = new ArrayList(); alText = new ArrayList(); clickstate = new ArrayList(); _classid = Global.getClassID() + ""; _lessonid = Global.getLessonID() + ""; Log.Info("debug. FormHandon._classid=" + _classid + ", _lessonid=" + _lessonid); _xitiId = Global.getSchoolID() + "-" + _classid + "-" + DateTime.Now.ToString("yyyyMMddHHmmss"); //TODO: 截屏上传 if ((EService.myppt != null && EService.myppt.isOpen()) || EService.bShowPicture) { _xitiId = "H_" + _xitiId; Image img = ScreenCapture.captureScreen(0, 0); string imgName = _xitiId + ".jpg"; string imgDir = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(imgDir)) { Directory.CreateDirectory(imgDir); } string imgPath = imgDir + "\\" + imgName; img.Save(imgPath); Common.uploadPicture(imgPath); } InitializeComponent(); Log.Info("FormHandon _xitiId=" + _xitiId + ", SetPanel now..."); int panelH = SetPanel(numberstr); Log.Info("FormHandon _xitiId=" + _xitiId + ", SetPanel over..."); this.Text = "提问[" + _xitiId + "]"; pictureBox2.Visible = false; pictureBox3.Visible = false; pictureBox4.Visible = false; this.Height = panelH; this.Width = screenWidth; StartPosition = FormStartPosition.Manual; SetDesktopLocation(0, screenHeight - this.Height); this.TopMost = true; #if DEBUG this.TopMost = false;//PPTPractise #endif //this.WindowState = FormWindowState.Maximized; this.Hide(); this.Show(); this.BringToFront(); Log.Info("FormHandon Timer_start(Theout) now..."); //Common.ClearHandon(); t = new System.Timers.Timer(200); t.Elapsed += new System.Timers.ElapsedEventHandler(Theout); t.Enabled = true; t.AutoReset = true; IntelligentRecommend.InitQuestion(); }
/// <summary> /// 打开图片 /// </summary> /// <param name="datas"></param> /// <param name="mode">1: 数据流 2:本地文件 3:拍照文件 4: 截屏文件</param> public Form3(string datas, int mode, int firsttime) { InitializeComponent(); this.mode = mode; //this.pictureBox1.Size = new System.Drawing.Size(screenWidth, screenHeight); this.WindowState = FormWindowState.Maximized; this.TopMost = true; #if DEBUG this.TopMost = false;//Form3 ShowView #endif this.pictureBox1.Visible = false; this.pictureBox1.Visible = true; try { Bitmap bmp = null; if (mode == 1) { m_base64 = datas; m_bmp = Base64StringToImage(datas); } else if (mode == 2) { filepath = datas; string filetype = Path.GetExtension(filepath).ToLower(); if (filetype == ".png") { string filepath2 = Path.GetDirectoryName(filepath) + "\\" + Path.GetFileNameWithoutExtension(filepath) + ".jpg"; try { File.Delete(filepath2); System.Drawing.Bitmap b = (Bitmap)Image.FromFile(filepath); b.Save(filepath2, System.Drawing.Imaging.ImageFormat.Jpeg); } catch (Exception e) { Log.Error(e.Message); } filepath = filepath2; } Log.Info("showPicture2 :" + filepath); m_base64 = Util.ImgToBase64String(filepath); m_bmp = (Bitmap)Image.FromFile(filepath); imgHeight = m_bmp.Height; imgWidth = m_bmp.Width; Log.Info("imgHeight=" + imgHeight + " imgWidth=" + imgWidth); Log.Info("screenHeight=" + screenHeight + " screenWidth=" + screenWidth); //m_bmp = new Bitmap(m_bmp, screenWidth, screenHeight);//不能图片缩放,因为破坏了图片的质量 } else if (mode == 3) { filepath = Application.StartupPath + "\\" + datas; string filetype = Path.GetExtension(filepath).ToLower(); if (filetype == ".png") { string filepath2 = Path.GetDirectoryName(filepath) + "\\" + Path.GetFileNameWithoutExtension(filepath) + ".jpg"; System.Drawing.Bitmap b = (Bitmap)Image.FromFile(filepath); b.Save(filepath2, System.Drawing.Imaging.ImageFormat.Jpeg); filepath = filepath2; } Log.Info("showPicture3 :" + filepath); m_base64 = Util.ImgToBase64String(filepath); m_bmp = (Bitmap)Image.FromFile(filepath); } else if (mode == 4) { m_bmp = ScreenCapture.captureScreen(0, 0); m_base64 = Util.ImgToBase64String(m_bmp); } imgHeight = m_bmp.Height; imgWidth = m_bmp.Width; Log.Info("imgHeight=" + imgHeight + " imgWidth=" + imgWidth); Log.Info("screenHeight=" + screenHeight + " screenWidth=" + screenWidth); //m_bmp = new Bitmap(m_bmp, screenWidth, screenHeight);//不能图片缩放,因为破坏了图片的质量 this.pictureBox1.Image = m_bmp; this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; this.pictureBox1.Width = screenWidth; this.pictureBox1.Height = screenHeight; //doUpload if (mode == 1 && firsttime == 1) { string imgName = DateTime.Now.ToString("yyyyMMdd") + "-" + Global.getSchoolID() + "-" + Global.getClassID() + "-" + DateTime.Now.ToString("HHmmss") + ".jpg"; string imgDir = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(imgDir)) { Directory.CreateDirectory(imgDir); } string imgPath = imgDir + "\\" + imgName; m_bmp.Save(imgPath); Common.uploadPicture(imgPath); Common.uploadCameraEvent(imgName);//相机拍照 } } catch (Exception ex) { Log.Error(ex.Message); } ////(图片宽>屏幕宽 && 图片高>屏幕高) //if ((pictureBox1.Width > Screen.PrimaryScreen.WorkingArea.Width && pictureBox1.Height > Screen.PrimaryScreen.WorkingArea.Height) || // (pictureBox1.Width > Screen.PrimaryScreen.WorkingArea.Width && pictureBox1.Height < Screen.PrimaryScreen.WorkingArea.Height)) //{ // MakeThumbnail(pictureBox1.Width, pictureBox1.Height, "W"); //} ////(图片宽<屏幕宽 && 图片高>屏幕高) 高度压缩 //else if (pictureBox1.Width < Screen.PrimaryScreen.WorkingArea.Width && pictureBox1.Height > Screen.PrimaryScreen.WorkingArea.Height) //{ // MakeThumbnail(pictureBox1.Width, pictureBox1.Height, "H"); //} //else //{ // pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; // this.pictureBox1.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - pictureBox1.Width / 2; // this.pictureBox1.Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - pictureBox1.Height / 2; //} }
private static AnswerCard answer_card;//全局答题卡对象 public Form1() { InitializeComponent(); //启动初始化接收机 if (answer_card == null) { answer_card = new AnswerCard(); answer_card.Message(); string date = DateTime.Now.ToString("yyyyMMdd"); int schoolID = Global.getSchoolID(); Global.g_roommsg = Common.getClassroomCourseTable(schoolID, AnswerCard.Reader, date); //Common.getClassroomCourseTable(93,23,""); } else { answer_card.Message(); } Log.Info("F1_1 set notifyIcon"); //show in taskbar { this.ShowInTaskbar = false; this.notifyIcon1.Visible = true;//在通知区显示Form的Icon this.WindowState = FormWindowState.Minimized; } //if (Global.isWithCamera()) //{ // this.toolStripMenuItem5.Visible = true; //} //else //{ // this.toolStripMenuItem5.Visible = false; //} FileInfo fi = new FileInfo(Application.StartupPath + "\\如e小助手.exe"); string lasttime = fi.LastWriteTime.ToString("yyyyMMdd HHmmss"); string MMdd = fi.LastWriteTime.ToString("MMdd"); string version = GetAssembly(typeof(System.Reflection.AssemblyVersionAttribute)); string[] szV = version.Split('.'); string version_1 = szV[0] + "." + szV[1] + "." + szV[2] + "." + MMdd; this.Text = "如e小助手 v" + version; this.labelAbout.Text = "关于 如e小助手(v" + version_1 + ")"; //设置自启动 Log.Info("F1_2 set autorun"); SetAutoRun(Global.getAutorun()); //清除历史文件夹 Log.Info("F1_3 remove historyDir"); RemoveHistoryDir(); //获取学校和班级的参数 int schoolid = Global.getSchoolID(); int classid = Global.getClassID(); Log.Info("F1_4 get parameters: schoolid=" + schoolid + ", classid=" + classid); string assistanturl = Global.url_assistant; Log.Info("F1_5 get class"); Classes c = m_db.getClassById(classid); if (c != null) { Global.setClassID(c.id); Global.setClassname(c.name); Global.setGrade(c.grade); } //更新班级的接收机ID Thread th = new Thread(delegate() { Log.Info("F1_6 setPCIP/syncHDId"); Thread.Sleep(3000); setHD_PcIp(); string hdid = Common.getHDID(); if (hdid.Length > 0) { Common.uploadHDBind(); } }); th.Start(); //上传历史数据 Thread thOfflineProcess = new Thread(delegate() { Log.Info("F1_7 syncOfflineData"); OfflineProcessor.UploadHistoryData(); }); thOfflineProcess.Start(); }
private void Thread_CheckDeviceStatus() { int lastCode = 0; int nOK = 0; while (true) { bool bOK_360 = false; bool bOK_HD = false; string hdip = Global.getHDIP(); string localip = GetInternalIPList(); string[] szIP = localip.Split(','); if (szIP.Length == 1) { string ip = szIP[0]; Log.Debug("Thread_CheckDeviceStatus1 ip=" + ip); //string ip_4 = ip.Substring(ip.LastIndexOf(".") + 1); if (ip == "172.18.201.3") { bOK_360 = true; } } else { foreach (string ip in szIP) { //string ip_4 = ip.Substring(ip.LastIndexOf(".") + 1); if (ip == "172.18.201.3") { bOK_360 = true; break; } } } //check答题卡 { if (AnswerCard.Card_Test() == 1) { bOK_HD = true; if (fNotify != null) { fNotify.showImg(); fNotify.setImgUrl(Global.startPath + "myCode.jpg"); } else { fNotify = new FormNotify("", "", 10); } //当检测到答题卡接收机断开重新上电后,做下初始化 if (offNum > 0) { if (answer_card == null) { answer_card = new AnswerCard(); answer_card.Message(); } else { answer_card.Message(); } offNum = 0; } } else { offNum++; if (AnswerCard.Card_Test() == 1) { bOK_HD = true; if (fNotify != null) { fNotify.showImg(); } else { fNotify = new FormNotify("", "", 10); } } else { if (fNotify != null) { fNotify.hideImg(); } else { fNotify = new FormNotify("", "", 10); } } } } int code = 0; int Sec = 3 * 1000; if (!bOK_360) { if (bOK_HD) { code = -1; } else { code = -3; } } else { if (bOK_HD) { code = 0; } else { code = -2; } } //Log.Debug("Thread_CheckDeviceStatus code=" + code); int bHide = 0; if (code != lastCode) { bFormNotifyClosed = false; } if (code == 0 && lastCode == 0 && nOK >= 3) { bHide = 1; } else { bHide = 0; } if (!bFormNotifyClosed) { if (code == -1) { //loadNofityForm("很抱歉,本机IP地址配置错误!\r\n请检查360wifi或无线路由是否正常!", bHide, 1000); //loadNofityForm("很抱歉,本机IP地址配置错误!", bHide, 1000);//\r\n请检查360wifi或无线路由是否正常! if (Global.isNetOk) { loadNofityForm("\r亲爱的老师\r\n可以开始上课啦!", 0, 10); } else { loadNofityForm("\r很抱歉,\r\n网络连接异常。", 0, 10); } nOK = 0; } else if (code == -2) { //应付演示 //loadNofityForm("很抱歉, 连接采集器失败!\r\n请检查采集器的参数是否正常!\r\n接收机IP:" + Global.getHDIP() + "\r\n本机IP:" + GetLocalIP_1(), bHide, 1000); loadNofityForm("\r\n请检查接收器是否插好?", 0, 10); nOK = 0; } else if (code == -3) { //loadNofityForm("很抱歉,本机IP地址配置错误!", bHide, 1000);//\r\n采集器参数或网络异常! loadNofityForm("\r\n请检查接收器是否插好?", 0, 10); nOK = 0; } else { if (Global.isNetOk) { loadNofityForm("\r亲爱的老师\r\n可以开始上课啦!", 0, 10); } else { loadNofityForm("\r很抱歉,\r\n网络连接异常。", 0, 10); } nOK++; } } lastCode = code; Thread.Sleep(Sec); } }
public FormPPTXiTi(string numberstr, int m) { mode = m; al = new ArrayList(); alText = new ArrayList(); clickstate = new ArrayList(); //创建习题ID _xitiId = Global.getSchoolID() + "-" + Global.getClassID() + "-" + DateTime.Now.ToString("yyyyMMddHHmmss"); //TODO: 截屏上传 if (m == 1) { _xitiId = "T_" + _xitiId; Image img = ScreenCapture.captureScreen(0, 0); string imgName = _xitiId + ".jpg"; string imgDir = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(imgDir)) { Directory.CreateDirectory(imgDir); } string imgPath = imgDir + "\\" + imgName; img.Save(imgPath); Common.uploadPicture(imgPath); } InitializeComponent(); int panelH = SetPanel(numberstr); this.Text = "抢答"; if (mode == 1)//PPT 抢答 { this.Height = panelH; this.Width = screenWidth; StartPosition = FormStartPosition.Manual; SetDesktopLocation(0, screenHeight - this.Height); label1.Visible = false; label3.Visible = false; lbltime.Visible = false; } else if (mode == 0) { this.WindowState = FormWindowState.Maximized; pictureBox1.Visible = true; //-------- int posY_timer = (screenHeight - lbltime.Height) / 2;//居中 label1.Location = new Point((screenWidth - label1.Width) / 2, posY_timer - lbltime.Height); lbltime.Location = new Point((screenWidth - lbltime.Width) / 2, posY_timer); label3.Location = new Point((screenWidth + lbltime.Width + label3.Width) / 2, posY_timer + lbltime.Height - label3.Height); //todo tlbl = new System.Timers.Timer(1000); tlbl.Elapsed += new System.Timers.ElapsedEventHandler(lblstart); tlbl.Enabled = true; tlbl.AutoReset = true; } this.TopMost = true; #if DEBUG this.TopMost = false;//PPTXiti,zzz #endif //this.WindowState = FormWindowState.Maximized; this.Hide(); this.Show(); this.BringToFront(); t = new System.Timers.Timer(200); t.Elapsed += new System.Timers.ElapsedEventHandler(Theout); t.Enabled = true; t.AutoReset = true; pictureBox2.Visible = false; pictureBox3.Visible = false; pictureBox4.Visible = false; //pictureBox3.Location = new System.Drawing.Point(screenWidth - 60, 0); //pictureBox4.Location = new System.Drawing.Point(screenWidth - 30, 0); }