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); }
private void OnResultComes(PXResult result) { try { Support.MercadoPagoPaymentResponse response = null; if (result != null) { response = new Support.MercadoPagoPaymentResponse { PaymentId = result.PaymentId, PaymentDescription = result.StatusDetail }; switch (result.Status) { case "approved": response.PaymentStatus = Support.PaymentStatus.APPROVED; break; case "in_process": response.PaymentStatus = Support.PaymentStatus.INPROCESS; break; case "rejected": response.PaymentStatus = Support.PaymentStatus.REJECTED; break; case "pending": response.PaymentStatus = Support.PaymentStatus.PENDING; break; case "cancelled": response.PaymentStatus = Support.PaymentStatus.CANCELLED; break; case "expired": response.PaymentStatus = Support.PaymentStatus.EXPIRED; break; } } NavigationController.DismissViewController(true, null); OnPaymentResult?.Invoke(response, EventArgs.Empty); } catch (Exception ex) { Console.Write(ex.Message); } }
// // 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; }
public static void CloseView(this UINavigationController controller) { if (controller == null) { DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => { var window = UIApplication.SharedApplication.KeyWindow; var vc = window.RootViewController; while (vc.PresentedViewController != null) { vc = vc.PresentedViewController; } if (vc is UISplitViewController) { var splitView = vc as UISplitViewController; vc = splitView.ViewControllers [0]; } if (vc is UINavigationController) { var navC = vc as UINavigationController; navC.PopViewController(true); } vc.DismissViewController(true, null); }); } else { controller.PopViewController(true); controller.DismissViewController(true, null); } }
private void Dismiss(UINavigationController picker, NSAction onDismiss) { if (viewController == null) { onDismiss(); tcs = new TaskCompletionSource <List <MediaFile> >(); } else { if (Popover != null) { Popover.Dismiss(animated: true); try { Popover.Dispose(); } catch { } Popover = null; onDismiss(); } else { picker.DismissViewController(true, onDismiss); } } }
// // 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.MainThreadScheduler = new SynchronizationContextScheduler(SynchronizationContext.Current); RxApp.DefaultExceptionHandler = Observer.Create((Exception e) => { IoC.Resolve <IAlertDialogService>().Alert("Error", e.Message); Console.WriteLine("Exception occured: " + e.Message + " at " + e.StackTrace); }); // Load the IoC IoC.RegisterAssemblyServicesAsSingletons(typeof(Xamarin.Utilities.Core.Services.IDefaultValueService).Assembly); IoC.RegisterAssemblyServicesAsSingletons(typeof(Xamarin.Utilities.Services.DefaultValueService).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(Core.Services.IApplicationService).Assembly); viewModelViewService.RegisterViewModels(GetType().Assembly); IoC.Resolve <IErrorService>().Init("http://sentry.dillonbuchanan.com/api/11/store/", "61105666362847a683ea7198ff6a1076 ", "7669a51402494220ab63e959851c19da"); iRate.SharedInstance.AppStoreID = 761416981; iRate.SharedInstance.ApplicationBundleID = "com.dillonbuchanan.repositorystumble"; iRate.SharedInstance.DaysUntilPrompt = 2; iRate.SharedInstance.UsesUntilPrompt = 5; iRate.SharedInstance.OnlyPromptIfLatestVersion = true; // Install the theme SetupTheme(); //GitHubSharp.Client.ClientConstructor = () => new System.Net.Http.HttpClient(new ModernHttpClient.NativeMessageHandler()); var startupViewController = new StartupViewController { 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); }
private void _mapAreaViewModel_MapSelected(object sender, PreplannedMapArea area) { // Dismiss the table view. _tableDisplayController.DismissViewController(true, null); // Download the map area. DownloadMapAreaAsync(area); }
public override void Close(IMvxViewModel toClose) { if (toClose is ModalViewModel) { _modalNavigationController?.DismissViewController(true, null); return; } base.Close(toClose); }
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); } }
/// <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) { #if DEBUG Locator.CurrentMutable.Register(() => new DiagnosticLogger(), typeof(ILogger)); #endif // Stamp the date this was installed (first run) this.StampInstallDate("CodeHub", DateTime.Now.ToString()); System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; Locator.CurrentMutable.InitializeFactories(); Locator.CurrentMutable.InitializeServices(); CodeHub.Core.Bootstrap.Init(); Locator.Current.GetService <IErrorService>().Init("http://sentry.dillonbuchanan.com/api/5/store/", "17e8a650e8cc44678d1bf40c9d86529b ", "9498e93bcdd046d8bb85d4755ca9d330"); SetupPushNotifications(); HandleNotificationOptions(options); var viewModelViews = Locator.Current.GetService <IViewModelViewService>(); viewModelViews.RegisterViewModels(typeof(SettingsView).Assembly); Themes.Theme.Load("Default"); var transitionOrchestration = Locator.Current.GetService <ITransitionOrchestrationService>(); var serviceConstructor = Locator.Current.GetService <IServiceConstructor>(); var vm = serviceConstructor.Construct <StartupViewModel>(); var startupViewController = new StartupView { ViewModel = vm }; ((IRoutingViewModel)vm).RequestNavigation.Subscribe(x => { var toViewType = viewModelViews.GetViewFor(x.GetType()); var toView = serviceConstructor.Construct(toViewType) as IViewFor; toView.ViewModel = x; transitionOrchestration.Transition(startupViewController, toView); }); 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); }
public override Task Close <TViewModel>() { if (typeof(IPresentView).IsAssignableFrom(typeof(TViewModel))) { MasterNavigationController.DismissViewController(true, null); } else { MasterNavigationController.PopViewController(true); } return(Task.CompletedTask); }
/// <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) this.StampInstallDate("CodeHub", DateTime.Now.ToString()); // Load the IoC IoC.RegisterAssemblyServicesAsSingletons(typeof(Xamarin.Utilities.Core.Services.IDefaultValueService).Assembly); IoC.RegisterAssemblyServicesAsSingletons(typeof(Xamarin.Utilities.Services.DefaultValueService).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(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); }
public void ShowLogin() { login = new LoginViewController (); RootController.NavigationBarHidden = true; RootController.ToolbarHidden = true; var nav = new UINavigationController (login); RootController.PresentViewController (nav, true, null); //RootController.AddChildViewController (nav); login.LoginSucceeded += () => { nav.DismissViewController(true,null); ShowResultList(); }; }
public override Task Close <TViewModel>(TViewModel viewModel) { var viewController = MasterNavigationController.VisibleViewController; var presentViewProperty = viewController?.GetType()?.GetProperty("ShowAsPresentView"); if ((bool)presentViewProperty?.GetValue(viewController)) { MasterNavigationController.DismissViewController(true, null); } else { MasterNavigationController.PopViewController(true); } return(Task.CompletedTask); }
// // 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) { AppCenter.Start("394e3d5b-722a-4e2e-b465-24e0e7af82bf", typeof(Analytics), typeof(Crashes)); 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); }
public void PopoverPage(Page page, IView presenter) { if (controller == null) { return; } var vc = page.CreateBoundNativeViewController(); if (isPhone && !(vc is UINavigationController)) { var nav = new UINavigationController(vc); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => { nav.DismissViewController(true, null); }); vc = nav; } vc.ModalPresentationStyle = UIModalPresentationStyle.Popover; var pc = vc.PopoverPresentationController; var toolPresenter = Tools.IndexOf(presenter); if (toolPresenter >= 0) { pc.BarButtonItem = controller.NavigationItem.RightBarButtonItems [toolPresenter]; } else { var addPresenter = presenter == AddButton; if (addPresenter) { pc.BarButtonItem = controller.NavigationItem.LeftBarButtonItem; } else { pc.SourceView = controller.View; } } controller.PresentViewController(vc, true, null); }
/// <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; }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // Need it to startup! CodeStash.Core.Bootstrap.Init(); Theme(); // 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.AccountsService).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); 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); Window.RootViewController = mainNavigationController; Window.MakeKeyAndVisible(); return(true); }
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); }
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; }
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); }
private void ShowConfigurationWindow(GenerateOfflineMapParameterOverrides overrides) { if (_overridesVC == null) { _overridesVC = new ConfigureOverridesViewController(overrides, _myMapView.Map); } // Show the layer list popover. Note: most behavior is managed by the table view & its source. See MapViewModel. var controller = new UINavigationController(_overridesVC); controller.Title = "Override parameters"; // Show a close button in the top right. var closeButton = new UIBarButtonItem("Close", UIBarButtonItemStyle.Plain, (o, ea) => controller.DismissViewController(true, null)); controller.NavigationBar.Items[0].SetRightBarButtonItem(closeButton, false); // Show the table view in a popover. controller.ModalPresentationStyle = UIModalPresentationStyle.Popover; controller.PreferredContentSize = new CGSize(300, 250); UIPopoverPresentationController pc = controller.PopoverPresentationController; if (pc != null) { pc.BarButtonItem = (UIBarButtonItem)_takeMapOfflineButton; pc.PermittedArrowDirections = UIPopoverArrowDirection.Down; pc.Delegate = new ppDelegate(); } PresentViewController(controller, true, null); }
private void ShowLayerOptions_Click(object sender, EventArgs e) { // Show the layer list popover. Note: most behavior is managed by the table view & its source. See LayerViewModel. var controller = new UINavigationController(_layerTableController); var closeButton = new UIBarButtonItem("Close", UIBarButtonItemStyle.Plain, (o, ea) => controller.DismissViewController(true, null)); controller.NavigationBar.Items[0].SetRightBarButtonItem(closeButton, false); controller.ModalPresentationStyle = UIModalPresentationStyle.Popover; controller.PreferredContentSize = new CGSize(300, 250); UIPopoverPresentationController pc = controller.PopoverPresentationController; if (pc != null) { pc.BarButtonItem = (UIBarButtonItem)sender; pc.PermittedArrowDirections = UIPopoverArrowDirection.Down; pc.Delegate = new ppDelegate(); } PresentViewController(controller, true, null); }
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); }
void Dismiss(UINavigationController picker, NSAction onDismiss) { picker.DismissViewController(true, onDismiss); }
//NavigationController needs to have all viewcontrollers inside dismissed in order to go to result page public static void GoToResultPageFromAuthFlow(UINavigationController navigationController) { navigationController?.DismissViewController(true, null); }
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); } } }
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); } } }
public override void ViewDidLoad() { try { UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, Convert.ToSingle(this.View.Frame.Size.Width), 44.0f)); //toolbar.TintColor = UIColor.White; //toolbar.BarStyle = UIBarStyle.Black; //toolbar.Translucent = true; toolbar.Items = toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { this.txtComments.ResignFirstResponder(); }) }; //AboutController1.ViewDidLoad(base); this.View.BackgroundColor = new UIColor(0, 0, 0, 0.8f); nfloat y = 40; var lblProducer = new UILabel(); lblProducer.Frame = new CGRect(4, 180 - y, View.Frame.Width - 8, 30); lblProducer.Text = "My Tasting"; lblProducer.BackgroundColor = UIColor.Purple; lblProducer.TextAlignment = UITextAlignment.Center; lblProducer.TextColor = UIColor.White; this.View.AddSubview(lblProducer); lblTrans = new UILabel(); lblTrans.Frame = new CGRect(0, 0, View.Frame.Width, View.Frame.Height); lblTrans.BackgroundColor = new UIColor(0, 0, 0, 0.0f); this.View.AddSubview(lblTrans); //this.View.Alpha = 0.5f; UIButton btnClose = new UIButton(new CGRect(9, 185 - y, 20, 20)); btnClose.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal); this.View.AddSubview(btnClose); btnClose.TouchUpInside += (sender, e) => { NavController.DismissViewController(true, null); }; imgBtl = new UIImageView(new CGRect(View.Frame.Width - 64, 149 - y, 60, 60)); imgBtl.Image = UIImage.FromFile("wine_review.png"); //imgBtl.BackgroundColor = UIColor.White; this.View.AddSubview(imgBtl); lblWhite = new UILabel(); lblWhite.Frame = new CGRect(4, 210 - y, View.Frame.Width - 8, 200); //200 lblWhite.BackgroundColor = UIColor.White; lblWhite.TextAlignment = UITextAlignment.Center; this.View.AddSubview(lblWhite); var Separator = new UIImageView(new CGRect(14, 225 - y, View.Frame.Width - 28, 2)); Separator.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; Separator.Image = UIImage.FromFile("separator.png"); this.View.AddSubview(Separator); var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"), filledImage: UIImage.FromBundle("Stars/star.png"), chosenImage: UIImage.FromBundle("Stars/star.png")); var lblStarBack = new UILabel(); lblStarBack.Frame = new CGRect(View.Bounds.Width * 3 / 9, 210 - y, View.Bounds.Width / 3, 35f); lblStarBack.BackgroundColor = UIColor.White; lblStarBack.TextAlignment = UITextAlignment.Center; this.View.AddSubview(lblStarBack); // Create the view. decimal averageRating = StartsSelected; PDRatingView ratingView = new PDRatingView(new CGRect(View.Bounds.Width * 3 / 8, 210 - y, View.Bounds.Width / 4, 35f), ratingConfig, averageRating); //ratingView.UserInteractionEnabled = true ratingView.BackgroundColor = UIColor.White; ratingView.RatingChosen += (sender, e) => { StartsSelected = e.Rating; }; this.View.AddSubview(ratingView); txtComments = new UITextView(); txtComments.Frame = new CGRect(14, 250 - y, View.Frame.Width - 28, 130); //txtComments.Text = "Describe your testing"; //txtComments.TextAlignment = UITextAlignment.Justified; //txtComments.BackgroundColor = UIColor.LightGray; txtComments.Text = Comments.Length > 0 ? Comments : "Describe your tasting"; txtComments.InputAccessoryView = toolbar; txtComments.Started += (sender, e) => { if (((UITextView)sender).Text == "Describe your tasting") { ((UITextView)sender).Text = ""; } }; txtComments.BecomeFirstResponder(); this.View.AddSubview(txtComments); UIButton btnSave = new UIButton(new CGRect(14, 370 - y, View.Frame.Width - 28, 20)); //btnSave.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal); btnSave.SetTitle("SAVE", UIControlState.Normal); btnSave.HorizontalAlignment = UIControlContentHorizontalAlignment.Right; btnSave.SetTitleColor(UIColor.Purple, UIControlState.Normal); LoggingClass.LogInfo("Added review to the " + WineId, screen); this.View.AddSubview(btnSave); btnSave.TouchDown += (sender, e) => { if (CurrentUser.RetreiveUserId() == 0) { UIAlertView alert = new UIAlertView() { Title = "This feature is allowed only for VIP Card holders", //Message = "Coming Soon..." }; //LoggingClass.LogInfo("Clicked on seacuces", screenid); alert.AddButton("OK"); alert.AddButton("Know more"); alert.Clicked += (senderalert, buttonArgs) => { if (buttonArgs.ButtonIndex == 1) { UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html")); } }; alert.Show(); } else { BTProgressHUD.Show("Saving review..."); //show spinner + text } }; btnSave.TouchUpInside += (sender, e) => { if (CurrentUser.RetreiveUserId() == 0) { UIAlertView alert = new UIAlertView() { Title = "This feature is allowed only for VIP Card holders", //Message = "Coming Soon..." }; //LoggingClass.LogInfo("Clicked on seacuces", screenid); alert.AddButton("OK"); alert.AddButton("Know more"); alert.Clicked += (senderalert, buttonArgs) => { if (buttonArgs.ButtonIndex == 1) { UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html")); } }; alert.Show(); } else { NavController.DismissViewController(true, null); SaveReview(); } }; DismissKeyboardOnBackgroundTap(); } catch (Exception ex) { LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace); } }
public void showSearchBox() { DialogViewController searchBoxDialog; searchBoxEntry = new EntryElement("Cerca", "Digita parola:", ""); searchBoxDialog = new DialogViewController(new RootElement("iportogruaro") { new Section(sectionHeaderTitle("Digita parola:")) { searchBoxEntry }, }); //flightNumerEntry.KeyboardType = UIKeyboardType.Default; searchBoxDialog.TableView.BackgroundView = null; searchBoxDialog.TableView.BackgroundColor = UIColor.White; UINavigationController nav = new UINavigationController(searchBoxDialog); nav.NavigationBar.TintColor = headerColor; this.PresentViewController(nav, true, null); searchBoxEntry.ReturnKeyType = UIReturnKeyType.Search; searchBoxEntry.ShouldReturn += delegate { starthud(); ThreadPool.QueueUserWorkItem(state => { string key = ""; InvokeOnMainThread(delegate { key = searchBoxEntry.Value; }); var lst = new iportogruaroLibraryShared.mainCategorys().getMainCategorysSearch(key); if (lst != null && lst.Count > 0) { InvokeOnMainThread(delegate { nav.DismissViewController(false, null); this.NavigationController.PushViewController(new UiCategoryList(true) { lstSearch = lst }, true); stophud(); } ); } }); stophud(); return(true); }; searchBoxDialog.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Cerca", UIBarButtonItemStyle.Plain, (s, e) => { starthud(); ThreadPool.QueueUserWorkItem(state => { string key = ""; InvokeOnMainThread(delegate { key = searchBoxEntry.Value; }); var lst = new iportogruaroLibraryShared.mainCategorys().getMainCategorysSearch(key); if (lst != null && lst.Count > 0) { InvokeOnMainThread(delegate { nav.DismissViewController(false, null); this.NavigationController.PushViewController(new UiCategoryList(true) { lstSearch = lst }, true); stophud(); } ); } }); stophud(); }); searchBoxDialog.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Annulla", UIBarButtonItemStyle.Plain, (s, e) => { nav.DismissViewController(true, null); }); }
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); }
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); } 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); } 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); } } }