本文整理汇总了C#中DragDropInfo类的典型用法代码示例。如果您正苦于以下问题:C# DragDropInfo类的具体用法?C# DragDropInfo怎么用?C# DragDropInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DragDropInfo类属于命名空间,在下文中一共展示了DragDropInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HandleDataDropped
/// <summary>
/// Called when a file is dropped onto the TextView
/// </summary>
/// <param name="dragDropInfo"></param>
/// <returns></returns>
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo)
{
// This function is basically doing three things:
// 1. Detects user drop position and on ambiguity asks user if replace current link.
// 2. Detects if user provided file's valid path (in Documentation/Source hierarchy)
// exists. If it does, then asks user if the file should be overwritten and copy
// the file as needed.
// 3. Replaces or appends a valid link.
try
{
var spanToReplace = GetSpanToReplace(dragDropInfo); // 1.
var referenceText = CreateReference(dragDropInfo); // 2.
using (var editTextView = TextView.TextBuffer.CreateEdit())
{
editTextView.Replace(spanToReplace, referenceText);
editTextView.Apply();
}
}
catch (OperationCanceledException)
{
// ignore as it is just stopping the whole operation
}
return DragDropPointerEffects.Link;
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:33,代码来源:DragDropHandler.cs
示例2: GetNodes
public IEnumerable<Node> GetNodes(DragDropInfo dragDropInfo)
{
try
{
if (!dragDropInfo.Data.GetDataPresent(PROJECTITEMFORMAT))
{
_log.Debug("Data not found");
return null;
}
// create nodes from the projectitems
var data = dragDropInfo.Data.GetData(PROJECTITEMFORMAT);
var nodeIsProject = false;
var droppedData = SolutionExplorerNodeData.DecodeProjectItemData(dragDropInfo.Data, nodeIsProject);
// find the nodes in the solution
var solutionItems = findSolutionItems(droppedData);
if (solutionItems != null) return solutionItems;
_log.Debug("FAiled to find items in IVSHierarchy. Generating items based on filename only");
var nodes = droppedData.Select(x => new Node() {Type = getClassNameFromFileName(x.FileName)});
_log.Debug("Found data");
return nodes;
}
catch (Exception e)
{
throw new Exception("GetNodes failed", e);
}
return null;
}
开发者ID:stickleprojects,项目名称:VSDropAssist,代码行数:32,代码来源:ProjectItemDropInfoHandler.cs
示例3: GetDragDropInfo
private static DragDropInfo GetDragDropInfo(UIElement target, DragEventArgs e,
PokemonDragDropData data)
{
var dragDropInfo = new DragDropInfo();
dragDropInfo.Action = DragDropActions.None;
int folderIndex = DragDropState.GetDraggingOverIndex(target);
var collection = (target as FrameworkElement).DataContext as CollectionViewModel;
if (collection != null && folderIndex != -1)
{
dragDropInfo.TargetFolder = collection.Folders[folderIndex];
if (dragDropInfo.TargetFolder.CanAddPokemon)
{
if (e.KeyStates.HasFlag(DragDropKeyStates.ControlKey))
{
dragDropInfo.Action = DragDropActions.CopyTo;
}
else if (dragDropInfo.TargetFolder != data.SourceFolder)
{
dragDropInfo.Action = DragDropActions.MoveTo;
}
}
}
return dragDropInfo;
}
开发者ID:sunoru,项目名称:PBO,代码行数:25,代码来源:CollectionDragDropTarget.cs
示例4: HandleDataDropped
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo) {
Task.Run(async () => {
var folder = await GetRUserFolder();
_editorShell.DispatchOnUIThread(() => HandleDrop(dragDropInfo, folder));
}).DoNotWait();
return DragDropPointerEffects.None;
}
开发者ID:Microsoft,项目名称:RTVS,代码行数:7,代码来源:DropHandler.cs
示例5: CanUnderstand
public bool CanUnderstand(DragDropInfo dragDropInfo)
{
if (!dragDropInfo.Data.GetDataPresent(PROJECTITEMFORMAT))
{
return false;
}
return true;
}
开发者ID:stickleprojects,项目名称:VSDropAssist,代码行数:8,代码来源:ProjectItemDropInfoHandler.cs
示例6: IsDropEnabled
public bool IsDropEnabled(DragDropInfo dragDropInfo)
{
_filename = FontDropHandler.GetImageFilename(dragDropInfo);
if (string.IsNullOrEmpty(_filename))
return false;
return this._imageExtensions.Contains(Path.GetExtension(_filename));
}
开发者ID:Grepsy,项目名称:WebEssentials2013,代码行数:9,代码来源:StylesheetDrop.cs
示例7: IsDropEnabled
public bool IsDropEnabled(DragDropInfo dragDropInfo)
{
_draggedFileName = GetImageFilename(dragDropInfo);
string ext = Path.GetExtension(_draggedFileName);
if (!_imageExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase))
return false;
return File.Exists(_draggedFileName) || Directory.Exists(_draggedFileName);
}
开发者ID:xoofx,项目名称:MarkdownEditor,代码行数:10,代码来源:MarkdownDropHandler.cs
示例8: Execute
public override IExecuteResult Execute(IEnumerable<Node> nodes, IWpfTextView textView,
DragDropInfo dragDropInfo)
{
var msg = string.Format("You dropped:\n{0}",
string.Join("\n",
nodes.Select(x => string.Format("{0}.{1}.{2}.{3}", x.Assembly, x.Namespace, x.Type, x.Member))));
_log.Debug(msg);
MessageBox.Show(msg);
return ExecuteResult.None;
}
开发者ID:stickleprojects,项目名称:VSDropAssist,代码行数:11,代码来源:MessageBoxDropAction.cs
示例9: HandleDataDropped
/// <summary>
/// See <see cref="IDropHandler.HandleDataDropped"/> for more information.
/// </summary>
/// <param name="dragDropInfo"></param>
/// <returns></returns>
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo)
{
try
{
manager.AddImageAdornment(manager.PreviewImageAdornment.VisualElement);
return DragDropPointerEffects.Copy;
}
finally
{
RemovePreviewImage();
}
}
开发者ID:dangilkerson,项目名称:ApprovalTestsVS2010,代码行数:17,代码来源:ImageInsertionDropHandler.cs
示例10: IsDropEnabled
public bool IsDropEnabled(DragDropInfo dragDropInfo)
{
_imageFilename = dragDropInfo.GetFilePath();
if (string.IsNullOrEmpty(_imageFilename))
return false;
if (_imageExtensions.Contains(Path.GetExtension(_imageFilename)))
return true;
return false;
}
开发者ID:jmorenor,项目名称:WebEssentials2013,代码行数:12,代码来源:HtmlImageDrop.cs
示例11: IsDropEnabled
public bool IsDropEnabled(DragDropInfo dragDropInfo)
{
_fileName = GetImageFilename(dragDropInfo);
if (string.IsNullOrEmpty(_fileName) || !CommandHelpers.IsFileSupported(_fileName) || _dte.ActiveDocument == null)
return false;
string activeFile = Path.GetFileName(_dte.ActiveDocument.FullName);
if (Constants.FILENAME.Equals(activeFile, StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
开发者ID:madskristensen,项目名称:CommandTaskRunner,代码行数:14,代码来源:CommandDropHandler.cs
示例12: IsDropEnabled
public bool IsDropEnabled(DragDropInfo dragDropInfo)
{
_imageFilename = FontDropHandler.GetImageFilename(dragDropInfo);
if (!string.IsNullOrEmpty(_imageFilename))
{
string fileExtension = Path.GetExtension(_imageFilename).ToLowerInvariant();
if (this._imageExtensions.Contains(fileExtension))
{
return true;
}
}
return false;
}
开发者ID:kodybrown,项目名称:WebEssentials2013,代码行数:15,代码来源:TypeScriptDrop.cs
示例13: HandleDataDropped
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo)
{
string reference = FileHelpers.RelativePath(EditorExtensionsPackage.DTE.ActiveDocument.FullName, _imageFilename);
if (reference.Contains("://"))
{
int index = reference.IndexOf('/', 12);
if (index > -1)
reference = reference.Substring(index).ToLowerInvariant();
}
_view.TextBuffer.Insert(dragDropInfo.VirtualBufferPosition.Position.Position, string.Format(_background, reference));
return DragDropPointerEffects.Copy;
}
开发者ID:LogoPhonix,项目名称:WebEssentials2012,代码行数:15,代码来源:ImageDrop.cs
示例14: HandleDataDropped
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo)
{
string reference = FileHelpers.RelativePath(ProjectHelpers.GetRootFolder(), _draggedFilename);
if (reference.StartsWith("http://localhost:"))
{
int index = reference.IndexOf('/', 20);
if (index > -1)
reference = reference.Substring(index + 1).ToLowerInvariant();
}
_view.TextBuffer.Insert(dragDropInfo.VirtualBufferPosition.Position.Position, string.Format(_format, reference));
return DragDropPointerEffects.Copy;
}
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:15,代码来源:BundleDrop.cs
示例15: HandleDraggingOver
public DragDropPointerEffects HandleDraggingOver(DragDropInfo dragDropInfo)
{
try
{
//set the insertion point to follow the drop location
_tgt.Caret.MoveTo(dragDropInfo.VirtualBufferPosition);
return DragDropPointerEffects.Copy;
}
catch (Exception e)
{
_log.Error("HandleDraggingOver", e );
}
return DragDropPointerEffects.Copy;
}
开发者ID:stickleprojects,项目名称:VSDropAssist,代码行数:15,代码来源:DropHandler.cs
示例16: GetDragDropInfo
private static DragDropInfo GetDragDropInfo(UIElement target, DragEventArgs e,
PokemonDragDropData data)
{
var dragDropInfo = new DragDropInfo();
dragDropInfo.Action = DragDropActions.None;
dragDropInfo.Folder = (target as FrameworkElement).DataContext as IFolderViewModel;
if (dragDropInfo.Folder == null)
return dragDropInfo;
dragDropInfo.InsertIndex = DragDropState.GetInsertionIndex(target);
dragDropInfo.PokemonIndex = DragDropState.GetDraggingOverIndex(target);
if (dragDropInfo.PokemonIndex != -1)
{
if (data.SourceFolder != dragDropInfo.Folder ||
data.PokemonIndexInFolder != dragDropInfo.PokemonIndex)
{
if (e.KeyStates.HasFlag(DragDropKeyStates.ControlKey))
{
dragDropInfo.Action = DragDropActions.Replace;
}
else
{
dragDropInfo.Action = DragDropActions.SwapWith;
}
}
}
else if (dragDropInfo.InsertIndex != -1)
{
if (e.KeyStates.HasFlag(DragDropKeyStates.ControlKey))
{
if (dragDropInfo.Folder.CanAddPokemon)
dragDropInfo.Action = DragDropActions.CopyTo;
}
else if (data.SourceFolder != dragDropInfo.Folder)//movement between folders
{
if (dragDropInfo.Folder.CanAddPokemon)
dragDropInfo.Action = DragDropActions.MoveTo;
}
else//movement within folder
{
if (IsValidMovement(data.PokemonIndexInFolder, dragDropInfo.InsertIndex))
dragDropInfo.Action = DragDropActions.MoveTo;
}
}
return dragDropInfo;
}
开发者ID:sunoru,项目名称:PBO,代码行数:48,代码来源:FolderDragDropTarget.cs
示例17: HandleDataDropped
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo)
{
string reference = FileHelpers.RelativePath(EditorExtensionsPackage.DTE.ActiveDocument.FullName, _imageFilename);
if (reference.StartsWith("http://localhost:"))
{
int index = reference.IndexOf('/', 24);
if (index > -1)
reference = reference.Substring(index).ToLowerInvariant();
}
reference = HttpUtility.UrlPathEncode(reference);
_view.TextBuffer.Insert(dragDropInfo.VirtualBufferPosition.Position.Position, string.Format(_import, reference));
return DragDropPointerEffects.Copy;
}
开发者ID:ncl-dmoreira,项目名称:WebEssentials2013,代码行数:16,代码来源:StylesheetDrop.cs
示例18: HandleDataDropped
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo)
{
if (File.Exists(draggedFilename))
{
//var files = GetRelativeFiles(draggedFilename);
//string[] sources = new string[files.Count()];
//for (int i = 0; i < files.Count(); i++)
//{
// string file = files.ElementAt(i);
// string extension = Path.GetExtension(file).ToLowerInvariant();
// string reference = RelativePath(document.FilePath, file);
// if (reference.StartsWith("http://localhost:"))
// {
// int index = reference.IndexOf('/', 24);
// if (index > -1)
// reference = reference.Substring(index + 1).ToLowerInvariant();
// }
// sources[i] = string.Format(fontUrls, reference, formats[extension]);
//}
//string sourceUrls = string.Join(", ", sources);
string fontFamily;
view.TextBuffer.Insert(dragDropInfo.VirtualBufferPosition.Position.Position, GetCodeFromFile(draggedFilename, out fontFamily));
return DragDropPointerEffects.Copy;
}
else if (draggedFilename.StartsWith("http://localhost:", StringComparison.OrdinalIgnoreCase))
{
//int index = draggedFilename.IndexOf('/', 24);
//if (index > -1)
// draggedFilename = draggedFilename.Substring(index).ToLowerInvariant();
//string extension = Path.GetExtension(draggedFilename).ToLowerInvariant();
//string sourceUrl = string.Format(fontUrls, draggedFilename, formats[extension]);
view.TextBuffer.Insert(dragDropInfo.VirtualBufferPosition.Position.Position, GetCodeFromLocalhost());
return DragDropPointerEffects.Copy;
}
else
{
return DragDropPointerEffects.None;
}
}
开发者ID:kodybrown,项目名称:WebEssentials2013,代码行数:47,代码来源:FontDrop.cs
示例19: HandleDataDropped
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo)
{
string reference = FileHelpers.RelativePath(EditorExtensionsPackage.DTE.ActiveDocument.FullName, _filename);
if (reference.StartsWith("http://localhost:"))
{
int index = reference.IndexOf('/', 24);
if (index > -1)
reference = reference.Substring(index).ToLowerInvariant();
}
reference = HttpUtility.UrlPathEncode(reference);
string import = Path.GetExtension(_filename).Equals(".less", StringComparison.OrdinalIgnoreCase) ? _lessImport : _cssImport;
_view.TextBuffer.Insert(dragDropInfo.VirtualBufferPosition.Position.Position, string.Format(import, reference));
return DragDropPointerEffects.Copy;
}
开发者ID:Grepsy,项目名称:WebEssentials2013,代码行数:17,代码来源:StylesheetDrop.cs
示例20: HandleDraggingOver
/// <summary>
/// See <see cref="IDropHandler.HandleDraggingOver"/> for more information.
/// </summary>
/// <param name="dragDropInfo"></param>
/// <returns></returns>
public DragDropPointerEffects HandleDraggingOver(DragDropInfo dragDropInfo)
{
this.manager.PreviewImageAdornment.MoveTo(dragDropInfo.Location);
ITextViewLine targetLine = this.manager.GetTargetTextViewLine(this.manager.PreviewImageAdornment.VisualElement);
if (targetLine != null && targetLine.Length > 0)
{
this.manager.HighlightLineAdornment.Highlight(targetLine);
return DragDropPointerEffects.Copy;
}
else
{
this.manager.HighlightLineAdornment.Clear();
return DragDropPointerEffects.None;
}
}
开发者ID:dangilkerson,项目名称:ApprovalTestsVS2010,代码行数:22,代码来源:ImageInsertionDropHandler.cs
注:本文中的DragDropInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论