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


C# UIActionSheet.DismissWithClickedButtonIndex方法代码示例

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

示例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);
        }
开发者ID:saedaes,项目名称:gestion2013,代码行数:42,代码来源:ActionSheetPicker.cs

示例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);
        }
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:22,代码来源:ReadmeView.cs

示例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);
        }
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:36,代码来源:RepositoryView.cs

示例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);
		}
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:46,代码来源:CommitView.cs

示例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);
        }
开发者ID:Mikoj,项目名称:CodeBucket,代码行数:21,代码来源:ChangesetDiffView.cs

示例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);
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:35,代码来源:PitchShiftingViewController.cs

示例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;
        }
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:31,代码来源:WikiView.cs

示例9: DeleteButtonPressed

 void DeleteButtonPressed(UIActionSheet actionSheet)
 {
     DeleteVerse ();
     actionSheet.DismissWithClickedButtonIndex (1, true);
 }
开发者ID:pierceboggan,项目名称:Verses,代码行数:5,代码来源:VerseEditActionSheetDelegate.cs

示例10: CancelButtonPressed

 void CancelButtonPressed(UIActionSheet actionSheet)
 {
     actionSheet.DismissWithClickedButtonIndex (2, true);
 }
开发者ID:pierceboggan,项目名称:Verses,代码行数:4,代码来源:VerseEditActionSheetDelegate.cs

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

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


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