Exemple #1
0
 public override DragDropEffects GetDropEffects(IDataObject data)
 {
     if (VmcStudioUtil.DragDropObject == this)
     {
         return(DragDropEffects.None);
     }
     if (data.GetDataPresent(DataFormats.FileDrop))
     {
         string[] strArray = data.GetData(DataFormats.FileDrop, true) as string[];
         if (strArray != null && strArray.Length == 1 && ImageResourceModel.IsImageFile(strArray[0]))
         {
             return(DragDropEffects.Copy);
         }
     }
     VirtualFile[] virtualFiles = DataObjectExtensions.GetVirtualFiles(data, false);
     return(virtualFiles != null && virtualFiles.Length == 1 && ImageResourceModel.IsImageFile(virtualFiles[0].Name) ? DragDropEffects.Copy : DragDropEffects.None);
 }
Exemple #2
0
 public override void AcceptData(IDataObject data)
 {
     if (this.GetDropEffects(data) == DragDropEffects.None)
     {
         return;
     }
     if (data.GetDataPresent(DataFormats.FileDrop))
     {
         string[] strArray = data.GetData(DataFormats.FileDrop, true) as string[];
         if (strArray != null && strArray.Length == 1 && ImageResourceModel.IsImageFile(strArray[0]))
         {
             ((ImageResourceThemeItem)this.ThemeItem).Image = (BitmapSource)BitmapDecoder.Create(new Uri(strArray[0]), BitmapCreateOptions.None, BitmapCacheOption.Default).Frames[0];
         }
     }
     VirtualFile[] virtualFiles = DataObjectExtensions.GetVirtualFiles(data);
     if (virtualFiles == null || virtualFiles.Length != 1 || !ImageResourceModel.IsImageFile(virtualFiles[0].Name))
     {
         return;
     }
     ((ImageResourceThemeItem)this.ThemeItem).Image = (BitmapSource)BitmapDecoder.Create((Stream) new MemoryStream(virtualFiles[0].Contents), BitmapCreateOptions.None, BitmapCacheOption.Default).Frames[0];
 }