Exemplo n.º 1
0
 private void Grid_DragEnter(object sender, System.Windows.DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         e.Effects = DragDropEffects.Link;
     }
     else
     {
         e.Effects = DragDropEffects.None;
     }
 }
 private void ListBox_DragOver(object sender, System.Windows.DragEventArgs e)
 {
     if (e.Data.GetDataPresent("ProjectBlockInfo"))
     {
         e.Effects = DragDropEffects.All;
     }
     else
     {
         e.Effects = DragDropEffects.None;
     }
     e.Handled = true;
 }
Exemplo n.º 3
0
        private void Grid_Drop(object sender, System.Windows.DragEventArgs e)
        {
            string fileName = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();

            string[] path   = fileName.Split('.');
            string   suffix = path[path.Length - 1];

            if (suffix == "png" || suffix == "jpg" || suffix == "webm" || suffix == "jpeg" || suffix == "tiff")
            {
                Show.Text = null;
                DateTime startTime = DateTime.Now;
                string   text      = OCRApi.GetWords(fileName);
                OCRApi.Str2Json(text, WordsNum, Show);
                DateTime endTime  = DateTime.Now;
                TimeSpan duration = endTime - startTime;
                NeedTime.Text = string.Format("{0:N3}", duration.TotalSeconds) + " S";
            }
            else
            {
                MessageBox.Show("文件格式错误");
            }
        }