public override void HandleDrop(SourceGrid3.GridVirtual sender, DragEventArgs e)
 {
     /*
      * String filename = String.Empty;
      * Array data = ((IDataObject)e.Data).GetData("FileName") as Array;
      * if (data != null)
      * {
      *  if ((data.Length == 1) && (data.GetValue(0) is String))
      *  {
      *      filename = ((string[])data)[0];
      *      string ext = Path.GetExtension(filename).ToLower();
      *      if ((ext == ".jpg") || (ext == ".png") || (ext == ".bmp"))
      *      {
      *          // load image from disk
      *          Bitmap theImage = new Bitmap(filename);
      *
      *          // find the instance object in the active test execution
      *          ObjectInstance theObject = Sequence().ActiveTestExecution().GetObject(Name);
      *          if (!(theObject is CameraSnapshotInstance))
      *          {
      *              throw new Exception("Name conflict: snapshot name isn't unique oiioejroiwjer");
      *          }
      *          CameraSnapshotInstance theSnapshotInstance = (CameraSnapshotInstance)theObject;
      *
      *          // set result image of instance in active test execution
      *          theSnapshotInstance.SetResultantImage(theImage);
      *
      *          // set trigger of active test execution
      *          Sequence().ActiveTestExecution().TriggerFired = true;
      *          Sequence().ActiveTestExecution().Name = "Drag & drop test at " + DateTime.Now;
      *      }
      *  }
      * }
      */
 }
Ejemplo n.º 2
0
        public override void HandleDrop(SourceGrid3.GridVirtual sender, DragEventArgs e)
        {
            // only handle this if we have an active
            if (TestSequence().ActiveTestExecution() == null)
            {
                MessageBox.Show("Test Sequence isn't active. Is it enabled?");
                return;
            }

            // http://www.jonasjohn.de/snippets/csharp/drag-and-drop-example.htm
            // Extract the data from the DataObject-Container into a string list
            string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            if (FileList != null)
            {
                foreach (string File in FileList)
                {
                    DragAndDropFileNames.Enqueue(File);
                }

                /*
                 * if ((data.Length == 1) && (data.GetValue(0) is String))
                 * {
                 *  filename = ((string[])data)[0];
                 *  string ext = Path.GetExtension(filename).ToLower();
                 *  if ((ext == ".jpg") || (ext == ".png") || (ext == ".bmp"))
                 *  {
                 *      // load image from disk
                 *      Bitmap theImage = new Bitmap(filename);
                 *
                 *      // find the instance object in the active test execution
                 *      ObjectInstance theObject = Sequence().ActiveTestExecution().GetObject(Name);
                 *      if (!(theObject is CameraSnapshotInstance))
                 *      {
                 *          throw new Exception("Name conflict: snapshot name isn't unique oiioejroiwjer");
                 *      }
                 *      CameraSnapshotInstance theSnapshotInstance = (CameraSnapshotInstance)theObject;
                 *
                 *      // set result image of instance in active test execution
                 *      theSnapshotInstance.ProcessNewImage(theImage, filename);
                 *
                 *      // set trigger of active test execution; WARNING! WE ARE OPERATING IN THE GUI THREAD AND trigger is watched from Test Sequence thread
                 *      Sequence().ActiveTestExecution().Name = "Drag & drop test at " + DateTime.Now;
                 *      if (Sequence().HasUnusedChanges)
                 *      {
                 *          Sequence().ActiveTestExecution().MarkNeedToRecreateExecution();
                 *      }
                 *      else
                 *      {
                 *          Sequence().ActiveTestExecution().TriggerFired = true;
                 *      }
                 *  }
                 * }*/
            }
        }
 public override void VerifyValidItemsForDrop(SourceGrid3.GridVirtual sender, DragEventArgs e)
 {
     e.Effect = DragDropEffects.Copy;
 }
Ejemplo n.º 4
0
 public virtual void HandleDrop(SourceGrid3.GridVirtual sender, DragEventArgs e)
 {
     return;
 }
Ejemplo n.º 5
0
 public virtual void VerifyValidItemsForDrop(SourceGrid3.GridVirtual sender, DragEventArgs e)
 {
     e.Effect = DragDropEffects.None;
 }