本文整理汇总了C#中UIActionSheet.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# UIActionSheet.Dispose方法的具体用法?C# UIActionSheet.Dispose怎么用?C# UIActionSheet.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIActionSheet
的用法示例。
在下文中一共展示了UIActionSheet.Dispose方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: ShowExtraMenu
private void ShowExtraMenu(UIBarButtonItem item)
{
if (ViewModel.Issue == null)
return;
var sheet = new UIActionSheet();
var editButton = ViewModel.IsCollaborator ? sheet.AddButton("Edit") : -1;
var openButton = ViewModel.IsCollaborator ? sheet.AddButton(ViewModel.Issue.State == "open" ? "Close" : "Open") : -1;
var commentButton = sheet.AddButton("Comment");
var shareButton = sheet.AddButton("Share");
var showButton = sheet.AddButton("Show in GitHub");
var cancelButton = sheet.AddButton("Cancel");
sheet.CancelButtonIndex = cancelButton;
sheet.Dismissed += (s, e) =>
{
BeginInvokeOnMainThread(() =>
{
if (e.ButtonIndex == editButton)
ViewModel.GoToEditCommand.Execute(null);
else if (e.ButtonIndex == openButton)
ViewModel.ToggleStateCommand.Execute(null);
else if (e.ButtonIndex == shareButton)
AlertDialogService.ShareUrl(ViewModel.Issue?.HtmlUrl, NavigationItem.RightBarButtonItem);
else if (e.ButtonIndex == showButton)
ViewModel.GoToUrlCommand.Execute(ViewModel.Issue.HtmlUrl);
else if (e.ButtonIndex == commentButton)
AddCommentTapped();
});
sheet.Dispose();
};
sheet.ShowFrom(item, true);
}
示例4: OnActionSheetDismissed
void OnActionSheetDismissed(UIActionSheet sheet, int buttonIndex)
{
sheet.Dispose ();
picker = null;
if (buttonIndex == -1)
return;
CancelPhotoTask ();
switch (buttons[buttonIndex]) {
case PhotoResponse.ChoosePhoto:
picker = new AircraftPhotoPickerController ();
picker.Delegate = new AircraftPhotoPickerDelegate (this);
picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
picker.AllowsEditing = true;
break;
case PhotoResponse.CapturePhoto:
picker = new AircraftPhotoPickerController ();
picker.Delegate = new AircraftPhotoPickerDelegate (this);
picker.SourceType = UIImagePickerControllerSourceType.Camera;
picker.CameraDevice = UIImagePickerControllerCameraDevice.Rear;
picker.CameraCaptureMode = UIImagePickerControllerCameraCaptureMode.Photo;
picker.CameraFlashMode = UIImagePickerControllerCameraFlashMode.Auto;
picker.ShowsCameraControls = true;
picker.AllowsEditing = true;
break;
case PhotoResponse.FlightAware:
FetchPhotograph (true);
break;
case PhotoResponse.UnsetPhoto:
Photograph = null;
break;
}
if (picker != null) {
popover = new UIPopoverController (picker);
popover.DidDismiss += OnPopoverDismissed;
popover.PresentFromRect (PhotoRect, this, UIPopoverArrowDirection.Any, 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: PromptForComment
private void PromptForComment(JavascriptCommentModel model)
{
var title = "Line " + model.FileLine;
var sheet = new UIActionSheet(title);
var addButton = sheet.AddButton("Add Comment");
var cancelButton = sheet.AddButton("Cancel");
sheet.CancelButtonIndex = cancelButton;
sheet.Dismissed += (sender, e) =>
{
BeginInvokeOnMainThread(() =>
{
if (e.ButtonIndex == addButton)
ShowCommentComposer(model.PatchLine);
});
sheet.Dispose();
};
sheet.ShowInView(this.View);
}
示例8: Settings
/// <summary>
/// Event when the settings toolbar item is clicked
/// </summary>
partial void Settings (NSObject sender)
{
if (actionSheet == null) {
actionSheet = new UIActionSheet();
actionSheet.AddButton ("Logout");
actionSheet.Dismissed += (s, e) => {
if (e.ButtonIndex == 0) {
var loginController = Storyboard.InstantiateViewController<LoginController>();
Theme.TransitionController(loginController);
}
actionSheet.Dispose ();
actionSheet = null;
};
actionSheet.ShowFrom (sender as UIBarButtonItem, true);
} else {
actionSheet.DismissWithClickedButtonIndex (-1, true);
}
}
示例9: 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;
}
示例10: 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);
}
示例11: CreateActionSheet
protected virtual UIActionSheet CreateActionSheet(string title)
{
var sheet = new UIActionSheet();
sheet.Dismissed += (sender, e) => sheet.Dispose();
return sheet;
}
示例12: ShowExtraMenu
private void ShowExtraMenu()
{
var sheet = new UIActionSheet();
var followButton = sheet.AddButton(ViewModel.IsFollowing ? "Unfollow" : "Follow");
var cancelButton = sheet.AddButton("Cancel");
sheet.CancelButtonIndex = cancelButton;
sheet.Dismissed += (s, e) => {
BeginInvokeOnMainThread(() =>
{
if (e.ButtonIndex == followButton)
{
ViewModel.ToggleFollowingCommand.Execute(null);
}
});
sheet.Dispose();
};
sheet.ShowInView(this.View);
}