Beispiel #1
0
 private void DraggableIcon_ItemDrag(object sender, ItemDragEventArgs e)
 {
     try
     {
         using (var tsf = new TemporarySaveFile(this))
         {
             DataObject obj = new DataObject();
             if (DraggableIcon.Items[0].Text.StartsWith("text/"))
             {
                 string data_ = new StreamReader(tsf.data).ReadToEnd();
                 obj.SetText(data_, DraggableIcon.Items[0].Text == "text/html" ? TextDataFormat.Html : TextDataFormat.UnicodeText);
             }
             else if (DraggableIcon.Items[0].Text.StartsWith("image/"))
             {
                 var data_ = new Bitmap(tsf.data);
                 obj.SetImage(data_);
             }
             else
                 obj.SetData(tsf.data);
             tsf.data.Close();
             obj.SetData(DataFormats.FileDrop, true, new String[] { tsf.tempfilename });
             disable_scrolling = true;
             try
             {
                 DraggableIcon.DoDragDrop(obj, DragDropEffects.All);
             }
             finally
             {
                 disable_scrolling = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, "Error when dragging file: " + ex.ToString(), "Error from BEurtle", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
 private void DraggableIcon_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         using (var tsf = new TemporarySaveFile(this))
         {
             tsf.data.Close();
             try
             {
                 this.UseWaitCursor = true;
                 var result = System.Diagnostics.Process.Start(tsf.tempfilename);
                 result.WaitForInputIdle();
             }
             finally
             {
                 this.UseWaitCursor = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, "Error when launching file: " + ex.ToString(), "Error from BEurtle", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }