本文整理汇总了C#中UIActionSheet.DismissWithClickedButtonIndex方法的典型用法代码示例。如果您正苦于以下问题:C# UIActionSheet.DismissWithClickedButtonIndex方法的具体用法?C# UIActionSheet.DismissWithClickedButtonIndex怎么用?C# UIActionSheet.DismissWithClickedButtonIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIActionSheet
的用法示例。
在下文中一共展示了UIActionSheet.DismissWithClickedButtonIndex方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowPicker
public void ShowPicker(UIView viewForPicker)
{
sheet = new UIActionSheet();
sheet.AddSubview(this);
var toolbarPicker = new UIToolbar (new RectangleF (0, 0, viewForPicker.Frame.Width, 44)) {
Items = new[] {
new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
new UIBarButtonItem (UIBarButtonSystemItem.Done, (sender, args) => sheet.DismissWithClickedButtonIndex (0, true)),
},
BarTintColor = this.BackgroundColor,
};
sheet.AddSubviews(toolbarPicker);
sheet.BackgroundColor = UIColor.Clear;
sheet.ShowInView(viewForPicker);
Animate(.25, () => sheet.Bounds = new RectangleF (0, 0, viewForPicker.Frame.Width, 485));
}
示例2: ActionSheetPicker
/// <summary>
///
/// </summary>
public ActionSheetPicker(UIView owner)
{
// save our uiview owner
this._owner = owner;
// configure the title label
titleLabel.BackgroundColor = UIColor.Clear;
titleLabel.TextColor = UIColor.LightTextColor;
titleLabel.Font = UIFont.BoldSystemFontOfSize (18);
// create + configure the action sheet
_actionSheet = new UIActionSheet () { Style = UIActionSheetStyle.BlackTranslucent };
_actionSheet.Clicked += (s, e) => { Console.WriteLine ("Clicked on item {0}", e.ButtonIndex); };
// add our controls to the action sheet
_actionSheet.AddSubview (picker);
_actionSheet.AddSubview (titleLabel);
//actionSheet.AddSubview (doneButton);
// Add the toolbar
_toolbar = new UIToolbar(new RectangleF(0, 0, _actionSheet.Frame.Width, 10));
_toolbar.BarStyle = UIBarStyle.Black;
_toolbar.Translucent = true;
// Add the done button
_doneButton = new UIBarButtonItem("Aceptar",UIBarButtonItemStyle.Done, null);
_doneButton.Clicked += (object sender, EventArgs e) => {
_actionSheet.DismissWithClickedButtonIndex (0, true);
};
_toolbar.Items = new UIBarButtonItem[] {
new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null, null),
_doneButton
};
_toolbar.SizeToFit();
_actionSheet.Add (_toolbar);
}
示例3: ShareButtonPress
private void ShareButtonPress()
{
var sheet = new UIActionSheet();
var shareButton = sheet.AddButton("Share");
var showButton = sheet.AddButton("Show in Bitbucket");
var cancelButton = sheet.AddButton("Cancel");
sheet.CancelButtonIndex = cancelButton;
sheet.DismissWithClickedButtonIndex(cancelButton, true);
sheet.Dismissed += (s, e) => {
BeginInvokeOnMainThread(() =>
{
if (e.ButtonIndex == showButton)
ViewModel.GoToGitHubCommand.Execute(null);
else if (e.ButtonIndex == shareButton)
ViewModel.ShareCommand.Execute(null);
});
sheet.Dispose();
};
sheet.ShowFrom(NavigationItem.RightBarButtonItem, true);
}
示例4: ShowExtraMenu
private void ShowExtraMenu(object o, EventArgs args)
{
var repoModel = ViewModel.Repository;
if (repoModel == null)
return;
var sheet = new UIActionSheet();
var pinButton = sheet.AddButton(ViewModel.IsPinned ? "Unpin from Slideout Menu" : "Pin to Slideout Menu");
var forkButton = sheet.AddButton("Fork Repository");
var showButton = sheet.AddButton("Show in Bitbucket");
var cancelButton = sheet.AddButton("Cancel");
sheet.CancelButtonIndex = cancelButton;
sheet.DismissWithClickedButtonIndex(cancelButton, true);
sheet.Dismissed += (s, e) => {
BeginInvokeOnMainThread(() => {
// Pin to menu
if (e.ButtonIndex == pinButton)
{
ViewModel.PinCommand.Execute(null);
}
else if (e.ButtonIndex == forkButton)
{
ViewModel.ForkCommand.Execute(null);
}
// Show in Bitbucket
else if (e.ButtonIndex == showButton)
{
ViewModel.GoToUrlCommand.Execute(ViewModel.HtmlUrl);
}
});
sheet.Dispose();
};
sheet.ShowFrom(NavigationItem.RightBarButtonItem, true);
}
示例5: ShowExtraMenu
private void ShowExtraMenu()
{
var changeset = ViewModel.Commits;
if (changeset == null)
return;
var sheet = new UIActionSheet();
var addComment = sheet.AddButton("Add Comment");
var copySha = sheet.AddButton("Copy Sha");
// 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(() =>
{
// Pin to menu
if (e.ButtonIndex == addComment)
{
AddCommentTapped();
}
else if (e.ButtonIndex == copySha)
{
UIPasteboard.General.String = ViewModel.Node;
}
// else if (e.ButtonIndex == shareButton)
// {
// var item = UIActivity.FromObject (ViewModel.Changeset.Url);
// var activityItems = new MonoTouch.Foundation.NSObject[] { item };
// UIActivity[] applicationActivities = null;
// var activityController = new UIActivityViewController (activityItems, applicationActivities);
// PresentViewController (activityController, true, null);
// }
// else if (e.ButtonIndex == showButton)
// {
// ViewModel.GoToHtmlUrlCommand.Execute(null);
// }
});
sheet.Dispose();
};
sheet.ShowFrom(NavigationItem.RightBarButtonItem, true);
}
示例6: PromptForComment
private void PromptForComment(JavascriptCommentModel model)
{
string title = "Line " + (model.LineFrom ?? model.LineTo);
var sheet = new UIActionSheet(title);
var addButton = sheet.AddButton("Add Comment");
var cancelButton = sheet.AddButton("Cancel");
sheet.CancelButtonIndex = cancelButton;
sheet.DismissWithClickedButtonIndex(cancelButton, true);
sheet.Dismissed += (sender, e) => {
BeginInvokeOnMainThread(() =>
{
if (e.ButtonIndex == addButton)
ShowCommentComposer(model.LineFrom, model.LineTo);
});
sheet.Dispose();
};
sheet.ShowInView(this.View);
}
示例7: actionChangeKey
partial void actionChangeKey(NSObject sender)
{
_actionSheet = new UIActionSheet("Title", null, string.Empty, string.Empty, null);
var pickerView = new UIPickerView(new RectangleF(0, 44, 320, 300));
pickerView.ShowSelectionIndicator = true;
pickerView.WeakDelegate = this;
var toolbar = new UIToolbar(new RectangleF(0, 0, 320, 44));
toolbar.BarStyle = UIBarStyle.Black;
UIBarButtonItem flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
var button = new UIButton(UIButtonType.Custom);
button.SetTitle("Done", UIControlState.Normal);
button.Layer.CornerRadius = 8;
button.Layer.BackgroundColor = GlobalTheme.SecondaryColor.CGColor;
button.Font = UIFont.FromName("HelveticaNeue-Bold", 12.0f);
button.Frame = new RectangleF(0, 20, 60, 30);
button.TouchUpInside += (sender2, e) => {
int key = _keys[pickerView.SelectedRowInComponent(0)].Item1;
OnChangeKey(key);
_actionSheet.DismissWithClickedButtonIndex(0, true);
};
var btnDone = new UIBarButtonItem(button);
toolbar.SetItems(new UIBarButtonItem[2] { flexSpace, btnDone }, true);
_actionSheet.AddSubview(toolbar);
_actionSheet.AddSubview(pickerView);
_actionSheet.ShowInView(UIApplication.SharedApplication.KeyWindow);
_actionSheet.Bounds = new RectangleF(0, 0, 320, 344);
int index = _keys.IndexOf(_currentKey);
pickerView.Select(index, 0, false);
}
示例8: CreateExtraMenu
private UIActionSheet CreateExtraMenu()
{
var repoModel = ViewModel.Repository;
if (repoModel == null)
return null;
var page = ViewModel.CurrentWikiPage(Web.Url.AbsoluteString);
var sheet = new UIActionSheet();
var editButton = page != null ? sheet.AddButton("Edit") : -1;
var gotoButton = sheet.AddButton("Goto Wiki Page");
var showButton = page != null ? sheet.AddButton("Show in Bitbucket") : -1;
var cancelButton = sheet.AddButton("Cancel");
sheet.CancelButtonIndex = cancelButton;
sheet.DismissWithClickedButtonIndex(cancelButton, true);
sheet.Dismissed += (s, e) =>
{
BeginInvokeOnMainThread(() =>
{
if (e.ButtonIndex == editButton)
HandleEditButton();
else if (e.ButtonIndex == gotoButton)
PromptForWikiPage();
else if (e.ButtonIndex == showButton)
ViewModel.GoToWebCommand.Execute(page);
});
sheet.Dispose();
};
return sheet;
}
示例9: DeleteButtonPressed
void DeleteButtonPressed(UIActionSheet actionSheet)
{
DeleteVerse ();
actionSheet.DismissWithClickedButtonIndex (1, true);
}
示例10: CancelButtonPressed
void CancelButtonPressed(UIActionSheet actionSheet)
{
actionSheet.DismissWithClickedButtonIndex (2, true);
}
示例11: Clicked
public override void Clicked (UIActionSheet actionSheet, int buttonIndex)
{
switch (buttonIndex) {
case 0:
ShowPicker (UIImagePickerControllerSourceType.PhotoLibrary);
break;
case 1:
ShowPicker (UIImagePickerControllerSourceType.Camera);
break;
}
actionSheet.DismissWithClickedButtonIndex (buttonIndex, true);
}
示例12: 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);
}