本文整理汇总了C#中UIActionSheet.ShowFromToolbar方法的典型用法代码示例。如果您正苦于以下问题:C# UIActionSheet.ShowFromToolbar方法的具体用法?C# UIActionSheet.ShowFromToolbar怎么用?C# UIActionSheet.ShowFromToolbar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIActionSheet
的用法示例。
在下文中一共展示了UIActionSheet.ShowFromToolbar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActionMenu
void ActionMenu()
{
//_actionSheet = new UIActionSheet("");
UIActionSheet actionSheet = new UIActionSheet (
"Customer Actions", null, "Cancel", "Delete Customer",
new string[] {"Change Customer"});
actionSheet.Style = UIActionSheetStyle.Default;
actionSheet.Clicked += delegate(object sender, UIButtonEventArgs args) {
switch (args.ButtonIndex)
{
case 0: DeleteCustomer(); break;
case 1: ChangeCustomer(); break;
}
};
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
actionSheet.ShowFromToolbar(NavigationController.Toolbar);
else
actionSheet.ShowFrom(NavigationItem.RightBarButtonItem, true);
}
示例2: ShareButtonTap
void ShareButtonTap (object sender)
{
if (ViewModel.Gist == null)
return;
var app = Mvx.Resolve<IApplicationService>();
var isOwner = string.Equals(app.Account.Username, ViewModel.Gist?.Owner?.Login, StringComparison.OrdinalIgnoreCase);
var sheet = new UIActionSheet();
var editButton = sheet.AddButton(isOwner ? "Edit" : "Fork");
var starButton = sheet.AddButton(ViewModel.IsStarred ? "Unstar" : "Star");
var shareButton = sheet.AddButton("Share");
var showButton = sheet.AddButton("Show in GitHub");
var cancelButton = sheet.AddButton("Cancel");
sheet.CancelButtonIndex = cancelButton;
sheet.DismissWithClickedButtonIndex(cancelButton, true);
sheet.Dismissed += (s, e) =>
{
BeginInvokeOnMainThread(() =>
{
try
{
if (e.ButtonIndex == shareButton)
AlertDialogService.ShareUrl(ViewModel.Gist?.HtmlUrl, sender as UIBarButtonItem);
else if (e.ButtonIndex == showButton)
ViewModel.GoToHtmlUrlCommand.Execute(null);
else if (e.ButtonIndex == starButton)
ViewModel.ToggleStarCommand.Execute(null);
else if (e.ButtonIndex == editButton)
Compose().ToBackground();
}
catch
{
}
});
sheet.Dispose();
};
sheet.ShowFromToolbar(NavigationController.Toolbar);
}
示例3: InitializePhotoButton
private void InitializePhotoButton()
{
bool hasCamera = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera);
photoFromWhere = new UIActionSheet("Select an option", new ActionDel(this, hasCamera));
if(hasCamera)
{
photoFromWhere.AddButton("Take a photo");
}
photoFromWhere.AddButton("Choose from library");
photoFromWhere.AddButton("Choose from Facebook");
photoFromWhere.AddButton("Cancel");
if(hasCamera)
{
photoFromWhere.CancelButtonIndex = 3;
}
else
{
photoFromWhere.CancelButtonIndex = 2;
}
photoButton.Clicked += (o, e) => photoFromWhere.ShowFromToolbar(toolbar);
}