本文整理匯總了C#中Windows.UI.StartScreen.SecondaryTile.RequestDeleteAsync方法的典型用法代碼示例。如果您正苦於以下問題:C# SecondaryTile.RequestDeleteAsync方法的具體用法?C# SecondaryTile.RequestDeleteAsync怎麽用?C# SecondaryTile.RequestDeleteAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.UI.StartScreen.SecondaryTile
的用法示例。
在下文中一共展示了SecondaryTile.RequestDeleteAsync方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UnpinAsync
public async Task<bool> UnpinAsync(string tileId)
{
System.Diagnostics.Contracts.Contract.Requires(tileId != null, "TileId");
if (!SecondaryTile.Exists(tileId))
return true;
var tile = new SecondaryTile(tileId);
return await tile.RequestDeleteAsync();
}
示例2: UnpinTile
public async Task<bool> UnpinTile(string tileId) {
if (SecondaryTileExists(tileId)) {
var secondaryTile = new SecondaryTile(tileId);
bool isUnpinned = await secondaryTile.RequestDeleteAsync();
return isUnpinned;
}
return true;
}
示例3: DeleteSecondaryTileAsync
/// <summary>
/// 移除輔助磁貼
/// </summary>
/// <param name="tileId">磁貼的唯一 ID</param>
public async static Task DeleteSecondaryTileAsync(string tileId)
{
if (Windows.UI.StartScreen.SecondaryTile.Exists(tileId))
{
// First prepare the tile to be unpinned
SecondaryTile secondaryTile = new SecondaryTile(tileId);
// Now make the delete request.
await secondaryTile.RequestDeleteAsync();
}
}
示例4: UnPin
public async Task<bool> UnPin(string pinnedItemId)
{
if (IsPinned(pinnedItemId))
{
var tile = new SecondaryTile(pinnedItemId);
var result = await tile.RequestDeleteAsync();
return result;
}
return false;
}
示例5: UnpinTile
public async Task<bool> UnpinTile(string tileId)
{
if (SecondaryTileExists(tileId))
{
// <snippet810>
var secondaryTile = new SecondaryTile(tileId);
// </snippet810>
// <snippet811>
bool isUnpinned = await secondaryTile.RequestDeleteAsync();
// </snippet811>
return isUnpinned;
}
return true;
}
示例6: UnpinTile
/// <summary>
/// UnPin a existed Tile.
/// </summary>
/// <param name="tileId"></param>
/// <returns></returns>
public async Task<bool> UnpinTile(string tileId)
{
// Create the unique tileId
var id = Regex.Replace(tileId, @"[^\d\w\s]", "-").
Replace(" ", string.Empty) + ".LiveTile";
//Check first if tile exists
if (SecondaryTileExists(id))
{
var secondaryTile = new SecondaryTile(id);
bool isUnpinned = await secondaryTile.RequestDeleteAsync();
return isUnpinned;
}
return true;
}
示例7: UnPinAsync
public async Task<bool> UnPinAsync(ViewModels.DetailPageViewModel vm)
{
if (vm == null)
throw new ArgumentNullException(nameof(vm));
// already unpinned?
if (!await IsPinned(vm))
return true;
try
{
var tile = new SecondaryTile(nameof(ViewModels.DetailPageViewModel));
return await tile.RequestDeleteAsync();
}
catch (Exception)
{
System.Diagnostics.Debugger.Break();
return false;
}
}
示例8: DeleteSecondaryTile
public static async void DeleteSecondaryTile(string guid)
{
if (Windows.UI.StartScreen.SecondaryTile.Exists(guid))
{
SecondaryTile secondaryTile = new SecondaryTile(guid);
await secondaryTile.RequestDeleteAsync();
}
}
示例9: PinButton_Click
private async void PinButton_Click(object sender, RoutedEventArgs e)
{
var button = sender as AppBarToggleButton;
var transform = button.TransformToVisual(pageRoot);
Point location = transform.TransformPoint(new Point(0, 0));
if (!SecondaryTile.Exists(ViewModel.SeriesId.ToString()))
{
Size size = new Size(150, 150);
var bookmark = ViewModel.CreateBookmark();
//ViewModel.IsLoading = true;
var imageUri = await AppGlobal.CreateTileImageAsync(new Uri(bookmark.DescriptionImageUri));
//ViewModel.IsLoading = false;
string args = bookmark.Position.ToString();
var tile = new SecondaryTile(ViewModel.SeriesId.ToString(), ViewModel.SeriesData.Title, args, imageUri, TileSize.Default);
//var tile = new SecondaryTile(ViewModel.SeriesId.ToString(), "LightNovel", ViewModel.SeriesData.Title, args, TileOptions.ShowNameOnLogo, imageUri);
try
{
button.IsChecked = await tile.RequestCreateAsync(location);
}
catch (Exception)
{
}
SyncPinButtonView();
}
else
{
var tile = new SecondaryTile(ViewModel.SeriesId.ToString());
button.IsChecked = !await tile.RequestDeleteAsync(location);
SyncPinButtonView();
}
}
示例10: PinToggleAsync
public static async Task<bool> PinToggleAsync(Album album)
{
bool created;
var id = "album." + album.Id;
if (!SecondaryTile.Exists(id))
{
Insights.Track(
"Pin To Start",
new Dictionary<string, string>
{
{"DisplayName", album.Name},
{"ProviderId", album.ProviderId},
{"Type", "Album"}
});
created =
await
CreatePin(
id,
album.Name,
"albums/" + album.Id,
string.Format(AppConstant.ArtworkPath, album.Id));
}
else
{
var secondaryTile = new SecondaryTile(id);
created = !await secondaryTile.RequestDeleteAsync();
}
return created;
}
示例11: DeleteMenuFlyout_Click
private async void DeleteMenuFlyout_Click(object sender, RoutedEventArgs e)
{
EventManage selectedEventManage = ((MenuFlyoutItem)sender).DataContext as EventManage;
string EventFileTitle = selectedEventManage.EventFileTitle;
StorageFile file = await applicationFolder.GetFileAsync(EventFileTitle);
await file.DeleteAsync();
refreshList();
if (SecondaryTile.Exists(EventFileTitle))
{
SecondaryTile secondaryTile = new SecondaryTile(EventFileTitle);
await secondaryTile.RequestDeleteAsync();
}
}
示例12: RemoveSecondaryTile
public async void RemoveSecondaryTile(string name)
{
if (TileExists(name))
{
var tile = new SecondaryTile("r" + name);
await tile.RequestDeleteAsync();
}
}
示例13: PinUnpin
/// <summary>
/// Create/Remove Secondary Tile
/// </summary>
public async Task PinUnpin()
{
// If SecondaryTile already exists, then remove it.
if (SecondaryTile.Exists(appbarTileId + CurrentContact.Id))
{
// Unpin
SecondaryTile secondaryTile = new SecondaryTile(appbarTileId + CurrentContact.Id);
bool isUnpinned = await secondaryTile.RequestDeleteAsync();
// Delete data from local folder if exists.
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
try
{
StorageFile File = await localFolder.GetFileAsync(CurrentContact.Id + ".png");
await File.DeleteAsync();
}
catch
{
// If no file, do nothing
}
}
else
{
Uri square150x150Logo;
// If Contact has its own picture, then ues it for SecondayTile.
if (CurrentContact.EntityImage != null)
{
// Store the data to local Folder.
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
// Create file
StorageFile File = await localFolder.CreateFileAsync(CurrentContact.Id + ".png", CreationCollisionOption.ReplaceExisting);
// Write data to file
using (Stream stream = await File.OpenStreamForWriteAsync())
{
var fs = new BinaryWriter(stream);
fs.Write(CurrentContact.EntityImage);
}
// Specify the saved file as SecondaryTile Icon.
square150x150Logo = new Uri("ms-appdata:///local/" + CurrentContact.Id + ".png");
}
else
// If Contact doesn't have picture, then use existing icon.
square150x150Logo = new Uri("ms-appx:///Assets/icon-contact.png");
// Set record Id as Activation Argument.
string tileActivationArguments = CurrentContact.Id.ToString();
// Set Contact FullName as display
string displayName = CurrentContact.FullName;
TileSize newTileDesiredSize = TileSize.Square150x150;
// Instantiate Secondary tile by specifying above information.
SecondaryTile secondaryTile = new SecondaryTile(appbarTileId + CurrentContact.Id,
displayName,
tileActivationArguments,
square150x150Logo,
newTileDesiredSize);
// Display FullName to the tile.
secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true;
// Create SecondaryTile
bool isPinned = await secondaryTile.RequestCreateAsync();
}
}
示例14: btnUnpin_Click
async private void btnUnpin_Click(object sender, RoutedEventArgs e)
{
int uniqueId = 1;
SecondaryTile secondaryTile = new SecondaryTile("Pin_" + uniqueId.ToString());
await secondaryTile.RequestDeleteAsync();
this.btnPin.Visibility = Windows.UI.Xaml.Visibility.Visible;
this.btnUnpin.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
示例15: Remove
protected async Task Remove(SecondaryTile secondTile)
{
await secondTile.RequestDeleteAsync();
}