public void loadCfg() { Log.Info(Global.toString()); textBox_wifi.Text = Global.getWiFi(); textBox_wifi.Enabled = false; textBox_schoolname.Text = Global.getSchoolname(); classid = Global.getClassID(); classname = Global.getClassname(); //get Class list { m_classlist.Clear(); comboBox_classlist.Text = ""; comboBox_classlist.Items.Clear(); m_classlist = m_db.getClassBySchoolid(Global.getSchoolID()); if (Global.IsPublicClassroom()) { comboBox_classlist.Items.Add("公共教室"); comboBox_classlist.SelectedIndex = comboBox_classlist.Items.Count - 1; button_reloadClasses.Visible = false; } else { foreach (Classes c in m_classlist) { if (c.name == "" || c.orderid == 0) { continue; } comboBox_classlist.Items.Add(c.name); if (classid == c.id) { comboBox_classlist.SelectedIndex = comboBox_classlist.Items.Count - 1; } } } } if (Global.getClassname() == "") { Classes c = m_db.getClassById(Global.getClassID()); if (c != null) { Global.setClassname(c.name); Global.setClassID(c.id); } } }
private void button_modify_Click(object sender, EventArgs e) { //从配置文件中获取 int schoolid = 0; try { schoolid = Int32.Parse(textBox_schoolid.Text); } catch (Exception e1) { MessageBox.Show("学校ID参数设置错误,请重试!", "警告"); return; } Log.Info("Config.1 schoolid=" + schoolid); int nSchoolid = Int32.Parse(textBox_schoolid.Text); string authcode = textBox_schoolauthcode.Text; if (Global.loadSchoolInfo(nSchoolid, authcode) == 1) { //重置默认第一个班级 Classes[] classlist = Global.g_szClasses; if (classlist.Length == 0) { MessageBox.Show("学校更新成功.\r\n未获取到班级信息,请联系管理员!", "提示"); Classes c = new Classes(); c.id = 0; c.name = ""; Global.saveClassConfig(c.id, c.name); } else { Classes c = classlist[0]; Global.saveClassConfig(c.id, c.name); Global.loadClassInfo(); MessageBox.Show("学校更新成功!", "提示"); } Form1.updateFormConfig(); textBox_schoolname.Text = Global.getSchoolname(); this.Close(); } else { MessageBox.Show("设置失败,请检查学校ID是否正确,或网络是否正常!", "提示"); } }
public void loadNofityForm(string msg, int bHide, int seconds) { if (this.InvokeRequired) { InvokeLoadNofityForm cb = new InvokeLoadNofityForm(loadNofityForm); this.Invoke(cb, new object[] { msg, bHide, seconds }); return; } string classname = Global.getClassname(); if (Global.IsPublicClassroom()) { classname = "公共教室"; } string title = Global.getSchoolname() + " - " + classname + ""; }
public void loadNofityForm(string msg, int bHide, int seconds) { if (this.InvokeRequired) { InvokeLoadNofityForm cb = new InvokeLoadNofityForm(loadNofityForm); this.Invoke(cb, new object[] { msg, bHide, seconds }); return; } string classname = Global.getClassname(); if (Global.IsPublicClassroom()) { classname = "公共教室"; } string title = Global.getSchoolname() + " - " + classname + ""; if (fNotify != null) { if (bHide == 1) { fNotify.Hide(); } else { fNotify.updateForm(title, msg); if (!FormNotify.m_PPTImgExporting) { fNotify.Show(); } } } else { fNotify = new FormNotify(title, msg, seconds); if (!FormNotify.m_PPTImgExporting) { fNotify.Show(); } } }
private void ReadFilePath(string diskPath, int field, bool bNotify = false) { currentdir = diskPath; if (diskPath.LastIndexOf("\\") == diskPath.Length - 1) { diskPath = diskPath.Substring(0, diskPath.Length - 1); } ArrayList autoAddedFileList = new ArrayList(); ArrayList al = Disk.MergrObj(diskPath.Replace("\r\n", "")); btnList = new ArrayList(); if (field == 1) { Button backBtn = CreateBackBtn(); btnList.Add(backBtn); } bool bAutoSync = false; string[] szType = { "ppt", "pptx", "doc", "docx", "pdf", "mp3", "wma", "wmv", "mp4", "swf" }; ArrayList filelist0 = Disk.getFilelist(diskPath.Replace("\r\n", ""), szType); if (filelist0.Count <= 5) { bAutoSync = true; } else { Httpd.pushFilelistTips("U盘课件文件超过5个!\r\n请手动选择课件文件,并使用鼠标\"右键\"选择\"添加到如e小助手\""); } bAutoSync = false; for (int k = 0; k < al.Count; k++) { string value = al[k].ToString(); Button btn = new Button(); btn.Size = new System.Drawing.Size(70, 70); btn.BackColor = System.Drawing.Color.FromArgb(255, 255, 255); btn.FlatStyle = FlatStyle.Flat; btn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(153, 209, 255); btn.FlatAppearance.BorderSize = 0; btn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(204, 232, 255); btn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(229, 243, 255); btn.TextAlign = ContentAlignment.BottomCenter; btn.MouseMove += new System.Windows.Forms.MouseEventHandler(btn_MouseMove); btn.MouseDown += new System.Windows.Forms.MouseEventHandler(btn_MouseDown); btn.AllowDrop = true; if (value.Split('|')[0].ToString() == "0") { btn.BackgroundImage = global::RueHelper.Properties.Resources.wenjianjia; btn.Name = "0|" + diskPath + "|" + value.Split('|')[2].ToString(); } else { string filename = value.Split('|')[2].ToString(); string extName = filename.Substring(filename.LastIndexOf(".") + 1, (filename.Length - filename.LastIndexOf(".") - 1)); btn.BackgroundImage = FileICON(extName);//load if (btn.BackgroundImage == null) { continue; } btn.Name = "1|" + diskPath + "|" + value.Split('|')[2].ToString(); if (filename.StartsWith("~$")) { continue; } if (field == 0 && bAutoSync) { //仅仅在插上U盘时自动加载 string _filepath = diskPath + "\\" + filename; autoAddedFileList.Add(_filepath); continue; } } this.label6.Text = diskPath + "\\" + value.Split('|')[2].ToString(); btn.Text = value.Split('|')[1].ToString(); string tooltipStr = value.Split('|')[2].ToString() + "\r\n类型:" + value.Split('|')[3].ToString() + "\r\n修改日期:" + value.Split('|')[5].ToString() + "\r\n大小:" + value.Split('|')[4].ToString() + ""; this.toolTip1.SetToolTip(btn, tooltipStr); addButtonlist_Left(btn); } try { for (int i = 0; i < autoAddedFileList.Count; i++) { string _path = (string)autoAddedFileList.ToArray()[i]; string _name = Path.GetFileName(_path); EService.selectFile(_name, _path); this.AddFile(_path, false); } }catch (Exception e1) { ;// } Thread thread = new Thread(delegate() { if (autoAddedFileList.Count == 0) { return; } bExporting = true; try { string title = Global.getSchoolname() + " - " + Global.getClassname() + ""; if (bNotify) { if (fNotify == null) { fNotify = new FormNotify(title, "\r\n 课件导入中,请稍后!", 30); } this.Invoke(new System.EventHandler(this.showForm), new object[] { fNotify, null }); fNotify.InvokeUpdate(title, "\r\n 课件导入中,请稍后!"); } for (int i = 0; i < autoAddedFileList.Count; i++) { string filepathSrc = (string)autoAddedFileList.ToArray()[i]; Log.Info("copy ppt......0:" + filepathSrc); string _fname = Path.GetFileName(filepathSrc); if (_fname.IndexOf("ppt") > 0 || _fname.IndexOf("PPT") > 0) { Log.Info("copy ppt......3"); MyPPT.exportImg(filepathSrc); Log.Info("copy ppt......4"); } Log.Info("copy ppt......5"); } bExporting = false; if (bNotify && fNotify != null) { fNotify.InvokeUpdate(title, "\r\n 课件导入完毕!"); Thread.Sleep(5000); fNotify.InvokeClose(); fNotify = null; } }catch (Exception e1) { Log.Error("Err!!! " + e1.Message); bExporting = false; try { if (fNotify != null) { fNotify.InvokeClose(); fNotify = null; } } catch (Exception e2) { Log.Error("Err!!! " + e2.Message); } } }); thread.Start(); RefreshControls(); }
public void loadCfg() { Log.Info(Global.toString()); textBox_wifi.Text = Global.getWiFi(); textBox_wifi.Enabled = false; textBox_schoolname.Text = Global.getSchoolname(); classid = Global.getClassID(); classname = Global.getClassname(); //get Class list { m_classlist.Clear(); comboBox_classlist.Text = ""; comboBox_classlist.Items.Clear(); m_classlist = m_db.getClassBySchoolid(Global.getSchoolID()); if (Global.IsPublicClassroom()) { comboBox_classlist.Items.Add("公共教室"); comboBox_classlist.SelectedIndex = comboBox_classlist.Items.Count - 1; button_reloadClasses.Visible = false; } else { foreach (Classes c in m_classlist) { if (c.name == "" || c.orderid == 0) { continue; } comboBox_classlist.Items.Add(c.name); if (classid == c.id) { comboBox_classlist.SelectedIndex = comboBox_classlist.Items.Count - 1; } } } } if (Global.getClassname() == "") { Classes c = m_db.getClassById(Global.getClassID()); if (c != null) { Global.setClassname(c.name); Global.setClassID(c.id); } } textBox_hdip.Text = Global.getHDIP(); //////////////////////////////// ArrayList iplist = Util.GetInternalIPList(); if (iplist.Count == 1) { textBox_360ip.Text = (string)iplist[0]; } else { foreach (string ip in iplist) { string ip_4 = ip.Substring(ip.LastIndexOf(".") + 1); if (ip == "172.18.201.3") { textBox_360ip.Text = ip; break; } } } }
public void loadSchoolConfig() { textBox_schoolid.Text = Global.getSchoolID() + ""; textBox_schoolname.Text = Global.getSchoolname(); }