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


C# UINavigationController.DismissViewController方法代码示例

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


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

示例1: FinishedLaunching

        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            StampInstallDate();

            RxApp.DefaultExceptionHandler = Observer.Create((Exception e) =>
            {
                Locator.Current.GetService<IAlertDialogService>().Alert("Error", e.Message);
                Console.WriteLine("Exception occured: " + e.Message + " at " + e.StackTrace);
            });

            // Load the IoC
            Services.Registrations.InitializeServices(Locator.CurrentMutable);

            var viewModelViewService = Locator.Current.GetService<IViewModelViewService>();
            viewModelViewService.RegisterViewModels(typeof(IApplicationService).Assembly);
            viewModelViewService.RegisterViewModels(GetType().Assembly);

            // Install the theme
            SetupTheme();

            var startupViewController = new StartupViewController { ViewModel = new StartupViewModel(Locator.Current.GetService<IApplicationService>()) };
            startupViewController.ViewModel.View = startupViewController;

            var mainNavigationController = new UINavigationController(startupViewController) { NavigationBarHidden = true };
            MessageBus.Current.Listen<LogoutMessage>().Subscribe(_ =>
            {
                mainNavigationController.PopToRootViewController(false);
                mainNavigationController.DismissViewController(true, null);
            });

            Window = new UIWindow(UIScreen.MainScreen.Bounds) {RootViewController = mainNavigationController};
            Window.MakeKeyAndVisible ();
            return true;
        }
开发者ID:memopower,项目名称:RepoStumble,代码行数:41,代码来源:AppDelegate.cs

示例2: RegisterButtonClicked

		partial void RegisterButtonClicked(Foundation.NSObject sender)
		{

			if (!ShowedEULA)
			{
				UINavigationController nc = new UINavigationController();
				nc.NavigationBar.BackgroundColor = UIColor.White;
				nc.NavigationBar.TintColor = UIColor.Blue;
				nc.NavigationBar.BarTintColor = UIColor.White;

				WebViewController vc = new WebViewController();

				vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(Strings.accept, UIBarButtonItemStyle.Plain, delegate
				{
					nc.DismissViewController(true, delegate
					{
						ShowedEULA = true;
						PerformSegue("Landing2Register", this);
					});
				});



				vc.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Strings.cancel, UIBarButtonItemStyle.Plain, delegate
				{
					nc.DismissViewController(true, null);
				});



				vc.NavigationItem.RightBarButtonItem.Enabled = false;
				vc.NavigationItem.LeftBarButtonItem.Enabled = false;


				vc.URL = Strings.web_url_base + Strings.web_url_privacy_policy;
				nc.SetViewControllers(new UIViewController[] { vc }, false);
				this.PresentViewController(nc, true, null);
			}
			else {
				PerformSegue("Landing2Register", this);
			}

		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:43,代码来源:LandingViewController.cs

示例3: FinishedLaunching

        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
//			var iRate = MTiRate.iRate.SharedInstance;
//			iRate.AppStoreID = 707173885;


            // Stamp the date this was installed (first run)
            StampInstallDate();

            // Load the IoC
            IoC.RegisterAssemblyServicesAsSingletons(typeof(Xamarin.Utilities.Core.Services.IDefaultValueService).Assembly);
            IoC.RegisterAssemblyServicesAsSingletons(typeof(Xamarin.Utilities.Services.DefaultValueService).Assembly);
            IoC.RegisterAssemblyServicesAsSingletons(typeof(CodeFramework.Core.Services.IAccountsService).Assembly);
            IoC.RegisterAssemblyServicesAsSingletons(typeof(CodeFramework.iOS.Theme).Assembly);
            IoC.RegisterAssemblyServicesAsSingletons(typeof(Core.Services.IApplicationService).Assembly);
            IoC.RegisterAssemblyServicesAsSingletons(GetType().Assembly);

            var viewModelViewService = IoC.Resolve<IViewModelViewService>();
            viewModelViewService.RegisterViewModels(typeof(Xamarin.Utilities.Services.DefaultValueService).Assembly);
            viewModelViewService.RegisterViewModels(typeof(CodeFramework.iOS.Theme).Assembly);
            viewModelViewService.RegisterViewModels(GetType().Assembly);

            IoC.Resolve<IErrorService>().Init("http://sentry.dillonbuchanan.com/api/5/store/", "17e8a650e8cc44678d1bf40c9d86529b ", "9498e93bcdd046d8bb85d4755ca9d330");
            CodeHub.Core.Bootstrap.Init();


            Theme.Setup();
            SetupPushNotifications();
            HandleNotificationOptions(options);

            var startupViewController = new StartupView { ViewModel = IoC.Resolve<StartupViewModel>() };
            startupViewController.ViewModel.View = startupViewController;

            var mainNavigationController = new UINavigationController(startupViewController) { NavigationBarHidden = true };
            MessageBus.Current.Listen<LogoutMessage>().Subscribe(_ =>
            {
                mainNavigationController.PopToRootViewController(false);
                mainNavigationController.DismissViewController(true, null);
            });

            Window = new UIWindow(UIScreen.MainScreen.Bounds) {RootViewController = mainNavigationController};
            Window.MakeKeyAndVisible();
            return true;
        }
开发者ID:GSerjo,项目名称:CodeHub,代码行数:50,代码来源:AppDelegate.cs

示例4: FinishedLaunching

        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            var welcomeView = new WelcomeView(UIScreen.MainScreen.ApplicationFrame);
            _window.AddSubview(welcomeView);

            welcomeView.Done += () => {
                var rootController = new UINavigationController();
                _window.RootViewController = rootController;

                var gettingStarted = new GettingStartedViewController();
                gettingStarted.Done += () => _locationService.GetCurrentLocation(coordinate => {
                    var me = new Ninja {
                        GroupName = gettingStarted.GroupName,
                        Latitude = coordinate.Latitude,
                        Longitude = coordinate.Longitude,
                        NickName = gettingStarted.Nickname
                    };

                    NinjaClient = new ServiceClient(gettingStarted) {
                        AuthenticationProvider = gettingStarted.AuthenticationProvider
                    };

                    NinjaClient.LocateNinjas(me, ninjasLocated => InvokeOnMainThread(() => {
                        rootController.DismissViewController(true, null);
                        var mapView = new MapViewController(coordinate, ninjasLocated);
                        mapView.Title = me.GroupName;
                        rootController.PushViewController(mapView, true);
                    }));
                });

                rootController.PresentViewController(gettingStarted, true, null);
            };

            _window.MakeKeyAndVisible();

            return true;
        }
开发者ID:samilamti,项目名称:ninja-locator,代码行数:39,代码来源:AppDelegate.cs

示例5: AddFolder

		void AddFolder ()
		{
			var dir = CurrentDirectory;

			var c = new TextInputController {
				Title = "Create Folder",
				InputText = "",
				Hint = "Enter the name of the new folder.",
				ValidateFunc = n => ValidateNewName (dir, n, null),
			};

			var presenter = docListNav.TopViewController;

			var nc = new UINavigationController (c);
			nc.NavigationBar.BarStyle = Theme.NavigationBarStyle;
			nc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;

			c.Cancelled += (sender, e) => nc.DismissViewController (true, null);
			c.Done += async (sender, e) => {
				nc.DismissViewController (true, null);

				try {
					var newDirName = c.InputText;
					var dl = CurrentDocumentListController;
					var path = Path.Combine (dl.Directory, newDirName);

					if (await FileSystem.CreateDirectory (path)) {
						docListNav.PushViewController (CreateDirectoryViewController (path), false);
					}
					else {
						new UIAlertView (
							"Error",
							FileSystem.Id + " did not allow the directory to be created.",
							null,
							"OK").Show ();
					}

				} catch (Exception ex) {
					Debug.WriteLine (ex);
				}
			};

			presenter.PresentViewController (nc, true, null);
		}
开发者ID:praeclarum,项目名称:Praeclarum,代码行数:44,代码来源:DocumentAppDelegate.cs

示例6: Show

        public override void Show(MvxViewModelRequest request)
        {
            var viewCreator = Mvx.Resolve<IMvxTouchViewCreator>();
            var view = viewCreator.CreateView(request);
            var uiView = view as UIViewController;

            if (uiView == null)
                throw new InvalidOperationException("Asking to show a view which is not a UIViewController!");

            if (uiView is IMvxModalTouchView)
            {
                _currentModal = (IMvxModalTouchView)uiView;
                var modalNavigationController = new UINavigationController(uiView);
                modalNavigationController.NavigationBar.Translucent = false;
                modalNavigationController.Toolbar.Translucent = false;
                uiView.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.CancelButton, UIBarButtonItemStyle.Plain, (s, e) =>
                {
                    var vm = ((IMvxModalTouchView)uiView).ViewModel;
                    Mvx.Resolve<Cirrious.MvvmCross.Plugins.Messenger.IMvxMessenger>().Publish(new CodeFramework.Core.Messages.CancelationMessage(vm));
                    modalNavigationController.DismissViewController(true, null);
                    _currentModal = null;
                });
                PresentModalViewController(modalNavigationController, true);
            }
            else if (uiView is StartupView)
            {
                _window.RootViewController = uiView;
            }
            else if (uiView is AccountsView)
            {
                _slideoutController = null;
                _generalNavigationController = new UINavigationController(uiView);
                _generalNavigationController.NavigationBar.Translucent = false;
                _generalNavigationController.Toolbar.Translucent = false;

                Transition(_generalNavigationController, UIViewAnimationTransition.FlipFromRight);
            }
            else if (uiView is MenuBaseViewController)
            {
                _slideoutController = new SimpleSlideoutNavigationController();
                _slideoutController.MenuViewController = new MenuNavigationController(uiView, _slideoutController);
                uiView.NavigationController.NavigationBar.Translucent = false;
                uiView.NavigationController.Toolbar.Translucent = false;
                uiView.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(50, 50, 50);
                Transition(_slideoutController, UIViewAnimationTransition.FlipFromLeft);
            }
            else
            {
                if (request.PresentationValues != null && request.PresentationValues.ContainsKey(PresentationValues.SlideoutRootPresentation))
                {
                    var mainNavigationController = new MainNavigationController(uiView, _slideoutController, new UIBarButtonItem(Theme.CurrentTheme.ThreeLinesButton, UIBarButtonItemStyle.Plain, (s, e) => _slideoutController.Open(true)));
                    _generalNavigationController = mainNavigationController;
                    _slideoutController.SetMainViewController(mainNavigationController, true);

                    //_generalNavigationController.NavigationBar.BarTintColor = Theme.CurrentTheme.ApplicationNavigationBarTint;
                    _generalNavigationController.NavigationBar.Translucent = false;
                    _generalNavigationController.Toolbar.Translucent = false;
                }
                else
                {
                    _generalNavigationController.PushViewController(uiView, true);
                }
            }
        }
开发者ID:Bazzinga,项目名称:CodeFramework,代码行数:64,代码来源:TouchViewPresenter.cs

示例7: GoToStartupView

        private void GoToStartupView()
        {
            var serviceConstructor = Locator.Current.GetService<IServiceConstructor>();
            var vm = serviceConstructor.Construct<StartupViewModel>();
            var startupViewController = new StartupViewController {ViewModel = vm};

            var mainNavigationController = new UINavigationController(startupViewController) { NavigationBarHidden = true };
            MessageBus.Current.Listen<LogoutMessage>().Subscribe(_ => {
                mainNavigationController.PopToRootViewController(false);
                mainNavigationController.DismissViewController(true, null);
            });

            TransitionToViewController(mainNavigationController);
        }
开发者ID:vbassini,项目名称:CodeHub,代码行数:14,代码来源:AppDelegate.cs

示例8: HandleTitleTap

		void HandleTitleTap (object sender, EventArgs e)
		{
			if (IsRoot)
				return;

			var name = DirectoryName;
			var dir = Path.GetDirectoryName (this.Directory);

			var c = new TextInputController {
				Title = "Rename",
				InputText = name,
				ValidateFunc = n => DocumentAppDelegate.ValidateNewName (dir, n, name),
			};

			var nc = new UINavigationController (c);
			nc.NavigationBar.BarStyle = DocumentAppDelegate.Shared.Theme.NavigationBarStyle;
			nc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;

			c.Cancelled += (ss, ee) => nc.DismissViewController (true, null);
			c.Done += async (ss, ee) => {
				nc.DismissViewController (true, null);

				if (c.InputText != name) {

					try {
						var FileSystem = FileSystemManager.Shared.ActiveFileSystem;

						var newDir = Path.Combine (Path.GetDirectoryName (Directory), c.InputText);

						if (await FileSystem.Move (Directory, newDir)) {
							Directory = newDir;
							SetTitle ();
							DocumentAppDelegate.Shared.Settings.SetWorkingDirectory (FileSystem, Directory);
						}
						else {
							var alert = new UIAlertView ("Rename Error", FileSystem.Id + " did not allow the folder to be renamed.", null, "OK");
							alert.Show ();
						}

					} catch (Exception ex) {
						Debug.WriteLine (ex);

					}
				}
			};

			PresentViewController (nc, true, null);
		}
开发者ID:praeclarum,项目名称:Praeclarum,代码行数:48,代码来源:DocumentsViewController.cs

示例9: Show

        public override void Show(MvxViewModelRequest request)
        {
            var uiView = this.CreateViewControllerFor(request) as UIViewController;

            if (uiView == null)
                throw new InvalidOperationException("Asking to show a view which is not a UIViewController!");

            if (uiView is IMvxModalIosView)
            {
                if (_currentModal != null)
                    throw new InvalidOperationException("Cannot have multiple modals");

                _currentModal = (IMvxModalIosView)uiView;
                var modalNavigationController = new UINavigationController(uiView);
                modalNavigationController.NavigationBar.Translucent = false;
                modalNavigationController.Toolbar.Translucent = false;
                uiView.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.CancelButton, UIBarButtonItemStyle.Plain, (s, e) =>
                {
                    var vm = ((IMvxModalIosView)uiView).ViewModel;
                    Mvx.Resolve<MvvmCross.Plugins.Messenger.IMvxMessenger>().Publish(new CodeFramework.Core.Messages.CancelationMessage(vm));
                    modalNavigationController.DismissViewController(true, null);
                    _currentModal = null;
                });
                PresentModalViewController(modalNavigationController, true);
            }
            else if (uiView is StartupView)
            {
                Transition(uiView);
            }
            else if (uiView is LoginView && _slideoutController == null)
            {
                var nav = new UINavigationController(uiView);
                _window.RootViewController.PresentViewController(nav, true, null);
            }
            else if (uiView is MenuBaseViewController)
            {
                _slideoutController = new SlideoutNavigationController();
                _slideoutController.MenuViewController = new MenuNavigationController(uiView, _slideoutController);
                uiView.NavigationController.NavigationBar.SetBackgroundImage(null, UIBarMetrics.Default);
                uiView.NavigationController.NavigationBar.Translucent = false;
                uiView.NavigationController.Toolbar.Translucent = false;
                uiView.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(50, 50, 50);
                Transition(_slideoutController);
            }
            else
            {
                if (request.PresentationValues != null && request.PresentationValues.ContainsKey(PresentationValues.SlideoutRootPresentation))
                {
                    var mainNavigationController = new MainNavigationController(uiView, _slideoutController, new UIBarButtonItem(Theme.CurrentTheme.ThreeLinesButton, UIBarButtonItemStyle.Plain, (s, e) => _slideoutController.Open(true)));
                    _generalNavigationController = mainNavigationController;
                    _slideoutController.SetMainViewController(mainNavigationController, true);


                    //_generalNavigationController.NavigationBar.BarTintColor = Theme.CurrentTheme.ApplicationNavigationBarTint;
                    _generalNavigationController.NavigationBar.Translucent = false;
                    _generalNavigationController.Toolbar.Translucent = false;
                }
                else
                {
                    _generalNavigationController.PushViewController(uiView, true);
                }
            }
        }
开发者ID:Mikoj,项目名称:CodeBucket,代码行数:63,代码来源:TouchViewPresenter.cs


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