本文整理匯總了C#中Windows.UI.Xaml.DragEventArgs.GetDeferral方法的典型用法代碼示例。如果您正苦於以下問題:C# DragEventArgs.GetDeferral方法的具體用法?C# DragEventArgs.GetDeferral怎麽用?C# DragEventArgs.GetDeferral使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.UI.Xaml.DragEventArgs
的用法示例。
在下文中一共展示了DragEventArgs.GetDeferral方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TargetListView_Drop
private async void TargetListView_Drop(object sender, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.Text))
{
var def = e.GetDeferral();
var s = await e.DataView.GetTextAsync();
string[] items = s.Split('\n');
View.MonsterSoloView msv = new MonsterSoloView();
msv.DataContext = monsterList.GetMonsterByID(Convert.ToInt32(items[0]));
SelectedMonsterList.Add(monsterList.GetMonsterByID(Convert.ToInt32(items[0])));
msv.SetValue(Grid.HorizontalAlignmentProperty, HorizontalAlignment.Center);
msv.SetValue(Grid.VerticalAlignmentProperty, VerticalAlignment.Center);
Grid grid = sender as Grid;
foreach (var element in grid.Children)
{
View.MonsterSoloView msvelement = element as View.MonsterSoloView;
SelectedMonsterList.monsterList.Remove(msvelement.DataContext as Monster);
grid.Children.Remove(element);
}
grid.Children.Add(msv);
e.AcceptedOperation = DataPackageOperation.Copy;
def.Complete();
selectedMonsterGridView.DataContext = new ObservableCollection<Monster>(SelectedMonsterList.monsterList);
}
}
示例2: Grid_OnDrop
private async void Grid_OnDrop(object sender, DragEventArgs e)
{
Locator.ViewModels.NewThreadVm.IsLoading = true;
var d = e.GetDeferral();
var files = await e.DataView.GetStorageItemsAsync();
foreach (var file in files)
{
await Locator.ViewModels.NewThreadVm.ImgurAddImageCommand.AddImgurImage(file as StorageFile, ReplyText);
}
d.Complete();
Locator.ViewModels.NewThreadVm.IsLoading = false;
}
示例3: TargetListView_Drop
/// <summary>
/// We need to return the effective operation from Drop
/// This is not important for our source ListView, but it might be if the user
/// drags text from another source
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void TargetListView_Drop(object sender, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.Text))
{
var def = e.GetDeferral();
var id = await e.DataView.GetTextAsync();
var itemIdsToMove = id.Split(',');
var destinationListView = sender as ListView;
var listViewItemsSource = destinationListView?.ItemsSource as ObservableCollection<Palestrante>;
if (listViewItemsSource != null)
{
foreach (var itemId in itemIdsToMove)
{
var itemToMove = ListSource.First(i => i.nome.ToString() == itemId);
listViewItemsSource.Add(itemToMove);
//ListSource.Remove(itemToMove);
}
}
e.AcceptedOperation = DataPackageOperation.Copy;
def.Complete();
}
}
示例4: dropimg
public async void dropimg(object sender, DragEventArgs e)
{
DragOperationDeferral defer = e.GetDeferral();
try
{
DataPackageView data_view = e.DataView;
string str = await clipboard(data_view);
clipboard_substitution(str);
}
finally
{
defer.Complete();
}
}
示例5: Dropimg
public async void Dropimg(object sender, DragEventArgs e)
{
if (Writetext)
{
return;
}
DragOperationDeferral defer = e.GetDeferral();
try
{
DataPackageView dataView = e.DataView;
string str = await _m.clipboard(dataView);
Tianjia(str);
}
finally
{
defer.Complete();
}
}
示例6: TargetTextBlock_Drop
/// <summary>
/// Drop on the Trash
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void TargetTextBlock_Drop(object sender, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.Text))
{
// We need to take the deferral as the source will read _deletedItem which
// we cannot set synchronously
var def = e.GetDeferral();
_deletedItem = await e.DataView.GetTextAsync();
e.AcceptedOperation = DataPackageOperation.Move;
def.Complete();
}
}
示例7: TargetListView_Drop
/// <summary>
/// We need to return the effective operation from Drop
/// This is not important for our source ListView, but it might be if the user
/// drags text from another source
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void TargetListView_Drop(object sender, DragEventArgs e)
{
// This test is in theory not needed as we returned DataPackageOperation.None if
// the DataPackage did not contained text. However, it is always better if each
// method is robust by itself
if (e.DataView.Contains(StandardDataFormats.Text))
{
// We need to take a Deferral as we won't be able to confirm the end
// of the operation synchronously
var def = e.GetDeferral();
var s = await e.DataView.GetTextAsync();
var items = s.Split('\n');
foreach (var item in items)
{
_selection.Add(item);
}
e.AcceptedOperation = DataPackageOperation.Copy;
def.Complete();
}
}
示例8: HandleDrop
static async void HandleDrop(DragEventArgs e, Action<StorageFile> handleDroppedFile)
{
if (!e.DataView.Contains(StandardDataFormats.StorageItems))
return;
var deferral = e.GetDeferral();
try
{
var storageItems = await e.DataView.GetStorageItemsAsync();
var file = GetSingleImageFile(storageItems);
if (file != null)
{
handleDroppedFile(file);
e.Handled = true;
}
}
finally
{
deferral.Complete();
}
}
示例9: Image_Drop
private async void Image_Drop(object sender, DragEventArgs e)
{
var def = e.GetDeferral();
var data = await e.DataView.GetTextAsync();
}