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


C# UIViewController.DismissViewController方法代码示例

本文整理汇总了C#中UIViewController.DismissViewController方法的典型用法代码示例。如果您正苦于以下问题:C# UIViewController.DismissViewController方法的具体用法?C# UIViewController.DismissViewController怎么用?C# UIViewController.DismissViewController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIViewController的用法示例。


在下文中一共展示了UIViewController.DismissViewController方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Show

 public static GistCreateView Show(UIViewController parent)
 {
     var ctrl = new GistCreateView();
     var weakVm = new WeakReference<GistCreateViewModel>(ctrl.ViewModel);
     ctrl.ViewModel.SaveCommand.Subscribe(_ => parent.DismissViewController(true, null));
     ctrl.NavigationItem.LeftBarButtonItem = new UIBarButtonItem { Image = Images.Buttons.CancelButton };
     ctrl.NavigationItem.LeftBarButtonItem.GetClickedObservable().Subscribe(_ => {
         weakVm.Get()?.CancelCommand.Execute(null);
         parent.DismissViewController(true, null);
     });
     parent.PresentViewController(new ThemedNavigationController(ctrl), true, null);
     return ctrl;
 }
开发者ID:GitWatcher,项目名称:CodeHub,代码行数:13,代码来源:GistCreateView.cs

示例2: DoTransition

        private static void DoTransition(UIViewController fromViewController, IBaseViewModel fromViewModel,
            UIViewController toViewController, IBaseViewModel toViewModel)
        {
            var toViewDismissCommand = toViewModel.DismissCommand;

            if (toViewController is LoginViewController)
            {
                toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
                fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
            }
            else if (toViewController is MainViewController)
            {
                var nav = ((UINavigationController)UIApplication.SharedApplication.Delegate.GetWindow().RootViewController);
                UIView.Transition(nav.View, 0.6f,
                    UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve,
                    () => nav.PushViewController(toViewController, false), null);
            }
            else if (toViewController is AddInterestViewController)
            {
                toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (s, e) => toViewDismissCommand.ExecuteIfCan());
                fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
            }
            else if (toViewController is StumbleViewController || toViewController is RepositoryViewController ||
                     toViewController is StumbledRepositoryViewController || toViewController is SettingsViewController)
            {
                toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
                fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
            }
            else if (toViewController is LanguagesViewController && fromViewController is TrendingViewController)
            {
                toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
                var ctrlToPresent = new UINavigationController(toViewController);
                ctrlToPresent.TransitioningDelegate = new SlideDownTransition();
                fromViewController.PresentViewController(ctrlToPresent, true, null);
            }
            else if (toViewController is PurchaseProViewController)
            {
                toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
                fromViewController.PresentViewController(toViewController, true, null);
            }
            else
            {
                toViewDismissCommand.Subscribe(
                    _ => toViewController.NavigationController.PopToViewController(fromViewController, true));
                fromViewController.NavigationController.PushViewController(toViewController, true);
            }
        }
开发者ID:memopower,项目名称:RepoStumble,代码行数:51,代码来源:TransitionOrchestrationService.cs

示例3: DoTransition

        private void DoTransition(UIViewController fromViewController, IBaseViewModel fromViewModel, UIViewController toViewController, IBaseViewModel toViewModel)
        {
            var toViewDismissCommand = toViewModel.DismissCommand;

//            if (toViewController is SettingsViewController)
//            {
//                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(CodeFramework.iOS.Images.Cancel, UIBarButtonItemStyle.Plain, (s, e) => toViewDismissCommand.ExecuteIfCan());
//                toViewDismissCommand.Subscribe(__ => toViewController.DismissViewController(true, null));
//                fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
//            }
            if (toViewController is AccountsView)
            {
                var rootNav = (UINavigationController)UIApplication.SharedApplication.Delegate.Window.RootViewController;
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Plain, (s, e) => toViewDismissCommand.ExecuteIfCan());
                toViewDismissCommand.Subscribe(_ => rootNav.DismissViewController(true, null));
                rootNav.PresentViewController(new UINavigationController(toViewController), true, null);
            }
//            else if (fromViewController is RepositoriesViewController)
//            {
//                fromViewController.NavigationController.PresentViewController(toViewController, true, null);
//            }
            else if (toViewController is MenuView)
            {
                var nav = ((UINavigationController)UIApplication.SharedApplication.Delegate.Window.RootViewController);
                var slideout = new SlideoutNavigationController();
                slideout.MenuViewController = new MenuNavigationController(toViewController, slideout);
                UIView.Transition(nav.View, 0.1, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve,
                    () => nav.PushViewController(slideout, false), null);
            }
            else if (toViewController is NewAccountView && fromViewController is StartupView)
            {
                toViewDismissCommand.Subscribe(_ => toViewController.DismissViewController(true, null));
                fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
            }
            else if (fromViewController is MenuView)
            {
                fromViewController.NavigationController.PushViewController(toViewController, true);
            }
            else if (toViewController is LanguagesView && fromViewController is RepositoriesTrendingView)
            {
                toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
                var ctrlToPresent = new UINavigationController(toViewController);
                ctrlToPresent.TransitioningDelegate = new SlideDownTransition();
                fromViewController.PresentViewController(ctrlToPresent, true, null);
            }
            else
            {
                toViewDismissCommand.Subscribe(_ => toViewController.NavigationController.PopToViewController(fromViewController, true));
                fromViewController.NavigationController.PushViewController(toViewController, true);
            }
        }
开发者ID:nelsonnan,项目名称:CodeHub,代码行数:52,代码来源:TransitionOrchestrationService.cs

示例4: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// Wireup Show button
			ShowButton.TouchUpInside += (sender, e) => {
				// Create a UIImage view to show in the popover
				UIImageView  monkeyIcon = new UIImageView(new CGRect(0,0,256,256));
				monkeyIcon.Image = UIImage.FromFile("MonkeyIcon.png");
				monkeyIcon.UserInteractionEnabled = true;

				// Create a view controller to act as the popover
				UIViewController popover = new UIViewController();
				popover.View = monkeyIcon;
				popover.ModalPresentationStyle = UIModalPresentationStyle.Popover;

				// Grab Image
				var image = UIImage.FromFile("298-circlex.png");

				// Add a close button
				var closeButton = new ImageButton(new CGRect(popover.View.Frame.Size.Width,20,image.Size.Width,image.Size.Height));
				closeButton.UserInteractionEnabled = true;
				closeButton.Image = image;
				monkeyIcon.AddSubview(closeButton);

				// Wireup the close button
				closeButton.Touched += (button) => {
					popover.DismissViewController(true,null);
				};

				// Present the popover
				PresentViewController(popover,true,null);

				// Configure the popover for the iPad, the popover displays as a modal view on the
				// iPhone
				UIPopoverPresentationController presentationPopover = popover.PopoverPresentationController;
				if (presentationPopover!=null) {
					presentationPopover.SourceView = this.View;
					presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
					presentationPopover.SourceRect = ShowButton.Frame;
				}

			};
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:44,代码来源:PopoverViewController.cs

示例5: showSplash

		public void showSplash (RootViewController rootController)
		{
			var splashView = new UIImageView (UIScreen.MainScreen.Bounds);// (new RectangleF (0f, 0f, 320f, 480f));
			splashView.Image = UIImage.FromFile ("Default.png");
			
			UIViewController modalViewController = new UIViewController ();
			modalViewController.View = splashView;
			modalViewController.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;
			rootController.PresentViewController (modalViewController, false, null);
			NSTimer.CreateScheduledTimer (new TimeSpan (0, 0, 3), 
	                                delegate { 
				modalViewController.DismissViewController(true, null);
				UIApplication.SharedApplication.SetStatusBarHidden (false, false);
					
			});
		}
开发者ID:bpug,项目名称:LbkIos,代码行数:16,代码来源:AppDelegate.cs

示例6: DismissModalAndOpen

 public static void DismissModalAndOpen(UIViewController current, UIViewController next)
 {
     current.DismissViewController (true, delegate {
         Deck.CenterController = new UINavigationController (next);
     });
 }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:6,代码来源:Nav.cs

示例7: DismissModal

 public static void DismissModal(UIViewController current)
 {
     current.DismissViewController (true, null);
 }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:4,代码来源:Nav.cs

示例8: HideViewController

        private static void HideViewController(UIViewController viewController)
        {
            if (!UIDevice.CurrentDevice.CheckSystemVersion(6, 0))
            {
#pragma warning disable 618
                // Disable DismissModalViewControllerAnimated warning, still need to support iOS 5 and older
				viewController.DismissModalViewController(true);
#pragma warning restore 618
            }
            else
            {
                // Dismiss view controller for iOS 6+
                viewController.DismissViewController(true, delegate {});
            }

            IsVisible = false;
            TouchPanel.EnabledGestures = prevGestures;
        }
开发者ID:Cardanis,项目名称:MonoGame,代码行数:18,代码来源:Guide.cs

示例9: Present

        protected virtual IDisposable Present(UIViewController controller)
        {
            var app = UIApplication.SharedApplication;
            var top = this.viewControllerFunc();

            app.InvokeOnMainThread(() => top.PresentViewController(controller, true, null));
            return new DisposableAction(() =>
            {
                try
                {
                    app.InvokeOnMainThread(() => controller.DismissViewController(true, null));
                }
                catch { }
            });
        }
开发者ID:philippd,项目名称:userdialogs,代码行数:15,代码来源:UserDialogsImpl.cs

示例10: Present

        /// <summary>
        /// Presents a new color picker.
        /// </summary>
        /// <param name="parent">The parent <see cref="UIViewController"/>.</param>
        /// <param name="title">The picker title.</param>
        /// <param name="initialColor">The initial selected color.</param>
        /// <param name="done">The method invoked when the picker closes.</param>
        /// <param name="colorPicked">The method invoked as colors are picked.</param>
        public static void Present(UIViewController parent, string title, UIColor initialColor, Action<UIColor> done, Action<UIColor> colorPicked)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            var picker = new ColorPickerViewController
            {
                Title = title,
                SelectedColor = initialColor
            };
            picker.ColorPicked += (_, args) =>
            {
                if (colorPicked != null)
                {
                    colorPicked(args.SelectedColor);
                }
            };

            var pickerNav = new UINavigationController(picker);
            pickerNav.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
            pickerNav.NavigationBar.Translucent = false;

            var doneBtn = new UIBarButtonItem(UIBarButtonSystemItem.Done);
            picker.NavigationItem.RightBarButtonItem = doneBtn;
            doneBtn.Clicked += delegate
            {
                if (done != null)
                {
                    done(picker.SelectedColor);
                }

                // hide the picker
                parent.DismissViewController(true, null);
            };

            // show the picker
            parent.PresentViewController(pickerNav, true, null);
        }
开发者ID:mattleibow,项目名称:AdvancedColorPicker,代码行数:48,代码来源:ColorPickerViewController.cs

示例11: TryDismiss

		void TryDismiss(UIViewController controller, Action completionHandler)
		{
			if (controller != null)
				controller.DismissViewController (false, completionHandler);
			else if(completionHandler != null)
				completionHandler ();
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:7,代码来源:DetailViewController.cs

示例12: Show

        public static void Show (UIViewController controller, string email, AuthResult res, Mode mode, bool googleAuth=false)
        {
            switch (res) {
            case AuthResult.InvalidCredentials:
                if (mode == Mode.Login && !googleAuth) {
                    new UIAlertView (
                        "AuthErrorLoginTitle".Tr (),
                        "AuthErrorLoginMessage".Tr (),
                        null, "AuthErrorOk".Tr ()).Show ();
                } else if (mode == Mode.Login && googleAuth) {
                    new UIAlertView (
                        "AuthErrorGoogleLoginTitle".Tr (),
                        "AuthErrorGoogleLoginMessage".Tr (),
                        null, "AuthErrorOk".Tr ()).Show ();
                } else if (mode == Mode.Signup) {
                    new UIAlertView (
                        "AuthErrorSignupTitle".Tr (),
                        "AuthErrorSignupMessage".Tr (),
                        null, "AuthErrorOk".Tr ()).Show ();
                }
                break;
            case AuthResult.NoDefaultWorkspace:
                if (MFMailComposeViewController.CanSendMail) {
                    var dia = new UIAlertView (
                        "AuthErrorNoWorkspaceTitle".Tr (),
                        "AuthErrorNoWorkspaceMessage".Tr (),
                        null, "AuthErrorNoWorkspaceCancel".Tr (),
                        "AuthErrorNoWorkspaceOk".Tr ());
                    dia.Clicked += (sender, e) => {
                        if (e.ButtonIndex == 1) {
                            var mail = new MFMailComposeViewController ();
                            mail.SetToRecipients (new[] { "AuthErrorNoWorkspaceEmail".Tr () });
                            mail.SetSubject ("AuthErrorNoWorkspaceSubject".Tr ());
                            mail.SetMessageBody (String.Format ("AuthErrorNoWorkspaceBody".Tr (), email), false);
                            mail.Finished += delegate {
                                controller.DismissViewController (true, null);
                            };

                            controller.PresentViewController (mail, true, null);
                        }
                    };
                    dia.Show ();
                } else {
                    new UIAlertView (
                        "AuthErrorNoWorkspaceTitle".Tr (),
                        "AuthErrorNoWorkspaceMessage".Tr (),
                        null, "AuthErrorOk".Tr ()).Show();
                }
                break;
            case AuthResult.NetworkError:
                new UIAlertView (
                    "AuthErrorNetworkTitle".Tr (),
                    "AuthErrorNetworkMessage".Tr (),
                    null, "AuthErrorOk".Tr ()).Show ();
                break;
            default:
                new UIAlertView (
                    "AuthErrorSystemTitle".Tr (),
                    "AuthErrorSystemMessage".Tr (),
                    null, "AuthErrorOk".Tr ()).Show ();
                break;
            }
        }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:63,代码来源:AuthErrorAlert.cs

示例13: ResignModelViewController

        public void ResignModelViewController( UIViewController modelViewController, object context )
        {
            // if the image cropper is resigning
            if ( modelViewController == ImageCropViewController )
            {
                // if croppedImage is null, they simply cancelled
                UIImage croppedImage = (UIImage)context;
                if ( croppedImage != null )
                {
                    NSData croppedImageData = croppedImage.AsJPEG( );

                    // if the image converts, we're good.
                    if ( croppedImageData != null )
                    {
                        MemoryStream memStream = new MemoryStream();

                        Stream nsDataStream = croppedImageData.AsStream( );

                        nsDataStream.CopyTo( memStream );
                        memStream.Position = 0;

                        RockMobileUser.Instance.SaveProfilePicture( memStream );
                        RockMobileUser.Instance.UploadSavedProfilePicture( null ); // we don't care about the response. just do it.

                        nsDataStream.Dispose( );
                    }
                    else
                    {
                        // notify them about a problem saving the profile picture
                        DisplayError( SpringboardStrings.ProfilePicture_Error_Title, SpringboardStrings.ProfilePicture_Error_Message );
                    }
                }
            }
            else if ( modelViewController == ProfileViewController )
            {
                // make sure we update the UI if they just finished editing their profile
                View.SetNeedsLayout( );
            }

            modelViewController.DismissViewController( true, delegate
                    {
                        // if this resign is while the OOBE is running, it was the register or login finishing up, 
                        // so wrap up the OOBE
                        if ( IsOOBERunning == true )
                        {
                            CompleteOOBE( );
                        }
                        ModalControllerVisible = false;
                        View.SetNeedsLayout( );
                    } );
        }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:51,代码来源:SpringboardViewController.cs


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