Example #1
0
        private void buttonGrabpic_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(m_currentRecord.OriginalPicURL))
            {
                Image OriginalPicURL = Common.GetImage(m_currentRecord.OriginalPicURL);

                string time     = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                string type     = "目标截图";
                string camid    = m_baseViewModel.GetTaskInfo(m_taskId).ToString().Replace(".", "_").Replace(":", "_");
                string id       = "[" + m_currentRecord.ObjKey.ToString().Replace(".", "_").Replace(":", "_") + "]";
                string fileName = camid + id + type + time + ".jpg";
                bool   needSave = true;

                System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
                sfd.RestoreDirectory = true;
                sfd.Filter           = "图片文件|*.jpg;*.bmp;*.png|全部文件|*.*";
                sfd.FileName         = fileName;
                sfd.InitialDirectory = Framework.Environment.PictureSavePath;
                if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    fileName = sfd.FileName;
                }
                else
                {
                    needSave = false;
                }

                if (needSave)
                {
                    OriginalPicURL.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
                    OriginalPicURL.Dispose();
                }
            }
        }
Example #2
0
 public void Init(SingleSearchResultPanelViewModel basevm, uint taskId)
 {
     if (basevm != null)
     {
         m_baseViewModel           = basevm;
         m_taskId                  = taskId;
         buttonReviewVideo.Visible = m_baseViewModel.GetTaskInfo(m_taskId).TaskType == TaskType.History;
         if (basevm.SearchResult != null)
         {
             m_allrecords = basevm.SearchResult;
             pageNavigatorEx1.MaxCount = m_allrecords.Count;
             pageNavigatorEx1.Index    = 1;
         }
     }
 }