当前位置: 首页>>代码示例>>C#>>正文


C# UIActionSheet.ShowFromToolbar方法代码示例

本文整理汇总了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);
		}
开发者ID:Coolerhino,项目名称:MvvmCross-Tutorials,代码行数:20,代码来源:CustomerView.cs

示例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);
        }
开发者ID:GitWatcher,项目名称:CodeHub,代码行数:41,代码来源:GistView.cs

示例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);
        }
开发者ID:follesoe,项目名称:FacebookBigProfile,代码行数:24,代码来源:MainView.xib.cs


注:本文中的UIActionSheet.ShowFromToolbar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。