我的MouseMove方法
package com.sa.asd.ax
public class VideoProvider {
String DOWNLOAD_URL;
public static List<MediaInfo> buildMedia(String url) throws JSONException {
if (null != mediaList) {
return mediaList;
}
Map<String, String> urlPrefixMap = new HashMap<>();
mediaList = new ArrayList<MediaInfo>();
String VIDEO_URL = null;
String mimeType = null;
for (int k = 0; k < videoSpecs.length(); k++) {
JSONObject videoSpec = videoSpecs.getJSONObject(k);
if(TARGET_FORMAT.equals(videoSpec.getString(TAG_VIDEO_TYPE))){
String youtubeLink = urlPrefixMap.get(TARGET_FORMAT) + videoSpec.getString(TAG_VIDEO_URL);
YouTubeUriExtractor ytEx = new YouTubeUriExtractor(null{
@Override
public void onUrisAvailable(String videoId, String videoTitle, SparseArray<YtFile> ytFiles) {
if(ytFiles!=null){
int itag = 22; // a YouTube format identifier
DOWNLOAD_URL = ytFiles.get(itag).getUrl();
}
}
};
ytEx.execute(youtubeLink);
VIDEO_URL = DOWNLOAD_URL;
mimeType = videoSpec.getString(TAG_VIDEO_MIME);
mediaList.add(buildMediaInfo(VIDEO_URL, mimeType));
}
}
return mediaList;
}
}
和我的拖拉方法
var de = DragDropEffects.Copy;
var df = DataFormats.Text;
string[] dragObject = new string[] {
"#Name#",
_dragStartHitInfo.Node.GetValue("TextDisplay").ToString()
};
data.SetData(df, dragObject);
treeList.DoDragDrop(data, de);
但是,我得到数据的空值。每次我删除对象时,如何正确设置对象类型
答案 0 :(得分:0)
如果您只想要删除的文本,请使用
var data = e.Data.GetData(DataFormats.Text) as string;
答案 1 :(得分:0)
也可以使用
处理var baseObj = (System.Windows.Forms.DataObject)e.Data;
string sFormat = baseObj.GetFormats();
var data = baseObj.GetData("System.String");
var getInnerData = data as System.String[];