예제 #1
0
        public void ShowFolders()
        {
            this.AllHide();

            //this.Height = 0;
            path = 20;//文件夹
            Bitmap bmp    = ScreenCapture.captureScreen(0, 0);
            string base64 = Util.ImgToBase64String(bmp);

            int imgHeight = bmp.Height;
            int imgWidth  = bmp.Width;

            string imgName = DateTime.Now.ToString("yyyyMMdd") + "-" + Global.getSchoolID() + "-" + Global.getClassID() + "-" + DateTime.Now.ToString("HHmmss") + ".png";
            string imgDir  = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd");

            if (!Directory.Exists(imgDir))
            {
                Directory.CreateDirectory(imgDir);
            }

            string imgPath = imgDir + "\\" + imgName;

            bmp.Save(imgPath);

            Common.uploadPicture(imgPath);

            this.AllShow();
            this.TopMost = false;

            string imgPathEncoded = System.Web.HttpUtility.UrlEncode(imgPath, Encoding.UTF8);
            string url            = Application.StartupPath + @"\html\xiti.html?#" + imgName;

            Form1.formWeb = new FormWebBrowser();
            Form1.formWeb.navigate(url);
        }
예제 #2
0
        public FormInter(string numberstr, string classid, string lessonid, string stuName)
        {
            Log.Info("FormPPTPractise.create,  classid=" + classid + ", lessonid=" + lessonid);
            tm_create  = DateTime.Now;
            al         = new ArrayList();
            alText     = new ArrayList();
            clickstate = new ArrayList();
            _classid   = classid;
            _lessonid  = lessonid;

            //No xiti.id
            _xitiId = Global.getSchoolID() + "-" + Global.getClassID() + "-" + DateTime.Now.ToString("yyyyMMddHHmmss");

            //TODO: 截屏上传
            if (EService.myppt != null || EService.bShowPicture)
            {
                _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 = "出题[" + _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();

            t           = new System.Timers.Timer(200);
            t.Elapsed  += new System.Timers.ElapsedEventHandler(Theout);
            t.Enabled   = true;
            t.AutoReset = true;
        }
예제 #3
0
        public FormTimer(string numberstr)
        {
            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();
            this.Text = "提问[" + _xitiId + "]";

            this.Height = screenHeight;
            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...");

            //t = new System.Timers.Timer(200);
            //t.Elapsed += new System.Timers.ElapsedEventHandler(Theout);
            //t.Enabled = true;
            //t.AutoReset = true;

            IntelligentRecommend.InitQuestion();
        }
예제 #4
0
        //截屏移动重新封装
        public static void screenshot()
        {
            string xitiID = Global.getSchoolID() + "-" + Global.getClassID() + "-" + DateTime.Now.ToString("yyyyMMddHHmmss");

            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);
        }
예제 #5
0
        public string UpdateImages()
        {
            DateTime tmnow   = DateTime.Now;
            string   result  = "";
            int      nsec    = Util.getTimeDiff_Second(tm_create);
            int      nUpload = 0;

            for (int i = 0; i < RECORD.Length; i++)
            {
                RobotPenImages img = RECORD[i];
                if (img != null)
                {
                    int    seat  = i + 1;
                    int    uid   = Global.getUidBySeat(seat);
                    string names = "";
                    foreach (RobotPenImageGroup group in img.grouplist)
                    {
                        if (group.status == 0)
                        {
                            //TODO: upload
                            foreach (RobotPenImageItem item in group.imglist)
                            {
                                names += (names.Length > 0 ? "|" : "") + item.imgName;
                                string imgPath = m_ImgDir + "\\" + item.imgName;
                                Common.uploadPicture(imgPath);
                                group.status = 1;
                                nUpload++;
                            }
                        }
                    }
                    if (names.Length > 0)
                    {
                        string result_item = uid + ":" + names;
                        result += (result.Length > 0 ? ";" : "") + result_item;
                    }
                }
            }

            if (nUpload > 0)
            {
                Common.uploadRobortPenEvent(rid, createtime, result, nsec);//同步到本地服务和云服务器
            }
            return("");
        }
        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();
        }
예제 #7
0
        private void pictureBox_home_Click(object sender, EventArgs e)
        {
            //批注截屏上传
            Bitmap bmp       = ScreenCapture.captureScreen(0, 0);
            string base64    = Util.ImgToBase64String(bmp);
            int    imgHeight = bmp.Height;
            int    imgWidth  = bmp.Width;
            string imgName   = Global.getSchoolID() + "-" + Global.getClassID() + "-" + DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.ToString("HHmmss") + ".jpg";
            string imgDir    = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd");

            if (!Directory.Exists(imgDir))
            {
                Directory.CreateDirectory(imgDir);
            }
            string imgPath = imgDir + "\\" + imgName;

            bmp.Save(imgPath);
            Common.uploadPicture(imgPath);
            Common.doPost("addDrawViewEvent", "filename=" + imgName);

            this.ShowMainPage();
        }
예제 #8
0
        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.Show();
                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);
        }
        /// <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);
                Bitmap fullScreen = ScreenCapture.captureScreen(0, 0);
                m_bmp    = this.CaptureImage(fullScreen, 0, 0, screenWidth, SystemInformation.WorkingArea.Height - 80);
                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;
                this.pictureBox1.Height = SystemInformation.WorkingArea.Height - 80;

                //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;
            //}
        }
예제 #10
0
        /// <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;
            //}
        }
예제 #11
0
        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);
        }