Example #1
0
 public void Present(string storyboard, bool replace = false, bool animated = true) {
     UIViewController vctl = UIStoryboard.FromName(storyboard, null).InstantiateInitialViewController();
     if (replace) {
         List<UIViewController> old = new List<UIViewController>();
         if (UIApplication.SharedApplication.KeyWindow.RootViewController is UINavigationController nav) {
             old.AddRange(nav.ViewControllers);
         } else {
             old.Add(UIApplication.SharedApplication.KeyWindow.RootViewController);
         }
         if (animated) {
             UIView.Transition(
                 UIApplication.SharedApplication.KeyWindow
                 , 0.25
                 , UIViewAnimationOptions.TransitionCrossDissolve
                 , () => UIApplication.SharedApplication.KeyWindow.RootViewController = vctl
                 , () => {
                     old.ForEach(o => (old as BaseViewController)?.Finished());
                 });
         } else {
             UIApplication.SharedApplication.KeyWindow.RootViewController = vctl;
             old.ForEach(o => (old as BaseViewController)?.Finished());
         }
     } else {
         this.PresentViewController(vctl, animated, null));
     }
 }
Example #2
0
        void LoadTermsService()
        {
            UIStoryboard     board = UIStoryboard.FromName("More", null);
            UIViewController ctrl  = (UIViewController)board.InstantiateViewController("TermsServiceViewController");

            ViewController.NavigationController.PushViewController(ctrl, true);
        }
Example #3
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // create a new window instance based on the screen size
            Window = new UIWindow(UIScreen.MainScreen.Bounds);
            UIStoryboard sb = UIStoryboard.FromName("Main", null);

            // If you have defined a root view controller, set it here:
            Window.RootViewController = sb.InstantiateInitialViewController();

            MapServices.ProvideAPIKey(GeneralConstants.MapsApiKey);
            // make the window visible
            Window.MakeKeyAndVisible();

            PushNotificationManager pushmanager = PushNotificationManager.PushManager;

            pushmanager.Delegate = this;
            UNUserNotificationCenter.Current.Delegate = pushmanager.notificationCenterDelegate;

            if (launchOptions != null)
            {
                if (launchOptions.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    pushmanager.HandlePushReceived(launchOptions);
                }
            }

            pushmanager.RegisterForPushNotifications();

            return(true);
        }
Example #4
0
        public void GoRegistrationPage()
        {
            var dest = UIStoryboard.FromName("Main", NSBundle.MainBundle).InstantiateViewController("RegistrationViewController") as RegistrationViewController;

            //dest.Id = id;
            _navigationController.PushViewController(dest, true);
        }
Example #5
0
        void LoadSettings()
        {
            UIStoryboard     board = UIStoryboard.FromName("More", null);
            UIViewController ctrl  = (UIViewController)board.InstantiateViewController("SettingsViewController");

            ViewController.NavigationController.PushViewController(ctrl, true);
        }
        private void Start_button_TouchUpInside(object sender, EventArgs eventArgs)
        {
            var storyboard          = UIStoryboard.FromName("ImageUpload", null);
            var imageViewController = storyboard.InstantiateInitialViewController() as UIViewController;

            NavigationController.PushViewController(imageViewController, true);
        }
Example #7
0
            public override IMvxIosView CreateViewOfType(Type viewType, MvxViewModelRequest request)
            {
                UIStoryboard storyboard = UIStoryboard.FromName("Main", null);
                var          view       = storyboard.InstantiateViewController(viewType.Name);

                return((IMvxIosView)view);
            }
        partial void NoteButton_TouchUpInside(UIButton sender)
        {
            IndividualSongLyricPage_NotePageVC sectionNotes = UIStoryboard.FromName("Main", null).InstantiateViewController("IndivdualSongLyricPage_NotePageSBID") as IndividualSongLyricPage_NotePageVC;

            sectionNotes.SetSection(lyrics);
            tableView.NavigationController.ShowViewController(sectionNotes, this);
        }
        partial void RecordingButton_TouchUpInside(UIButton sender)
        {
            RecordingsTableViewController recordings = UIStoryboard.FromName("Main", null).InstantiateViewController("RecordingsTableViewController") as RecordingsTableViewController;

            recordings.SetSection(lyrics);
            tableView.NavigationController.ShowViewController(recordings, this);
        }
        public override IMvxIosView CreateViewOfType(Type viewType, MvxViewModelRequest request)
        {
            var attribute = viewType.GetCustomAttribute <MvxFromStoryboardAttribute>();

            if (attribute == null || string.IsNullOrWhiteSpace(attribute.StoryboardName))
            {
                return(base.CreateViewOfType(viewType, request));
            }

            try
            {
                var isPad              = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad;
                var postfix            = isPad ? PadPostfix : PhonePostfix;
                var realStoryboardName = attribute.StoryboardName + postfix;
                var path           = NSBundle.MainBundle.PathForResource(realStoryboardName, StoryboardResourceType);
                var storyboardName = path == null ? attribute.StoryboardName : realStoryboardName;
                var storyboard     = UIStoryboard.FromName(storyboardName, null);
                var viewController = storyboard.InstantiateViewController(viewType.Name);

                return((IMvxIosView)viewController);
            }
            catch (Exception exception)
            {
                throw new MvxException(
                          "Loading view of type {0} from storyboard {1} failed: {2}",
                          viewType.Name,
                          attribute.StoryboardName,
                          exception.Message
                          );
            }
        }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            if (this.TableView.Editing == true)
            {
                this.selectedCellsToRemove.Add(indexPath.Row);
                Console.WriteLine("Remove cells list count is: " + this.selectedCellsToRemove.Count);
            }
            else
            {
                this.applicationDelegate.passwordChosenSelected = 1;

                var documents_2       = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                var passwordDirectory = Path.Combine(documents_2, "Passwords");
                var fileName_2        = Path.Combine(passwordDirectory, tableView.CellAt(indexPath).TextLabel.Text);

                this.applicationDelegate.textfieldPasswordDescription = tableView.CellAt(indexPath).TextLabel.Text;
                this.applicationDelegate.textfieldPassword            = File.ReadAllText(fileName_2);

                UIStoryboard story = UIStoryboard.FromName("Main", NSBundle.MainBundle);
                //pushes the password reader controller which allows the user to enter
                PasswordReader password = story.InstantiateViewController("PasswordReader") as PasswordReader;

                this.NavigationController.PushViewController(password, true);
            }
        }
Example #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Enable back navigation using swipe.
            if (databaseMethods.userExists())
            {
                NavigationController.InteractivePopGestureRecognizer.Delegate = null;
            }
            else
            {
                NavigationController.InteractivePopGestureRecognizer.Enabled = false;
            }
            new AppDelegate().disableAllOrientation = true;
            SidebarController = ((AppDelegate)UIApplication.SharedApplication.Delegate).SideBarController;
            UIStoryboard           sb        = UIStoryboard.FromName("Main", NSBundle.MainBundle);
            SideMenuViewController menuVC    = (SideMenuViewController)sb.InstantiateViewController(nameof(SideMenuViewController));
            MyCardViewController   contentVC = (MyCardViewController)sb.InstantiateViewController(nameof(MyCardViewController));

            View.BackgroundColor           = UIColor.FromRGB(36, 43, 52);
            SidebarController              = new SidebarController(this, contentVC, menuVC);
            SidebarController.MenuLocation = MenuLocations.Left;
            SidebarController.MenuWidth    = Convert.ToInt32(View.Frame.Width - Convert.ToInt32(View.Frame.Width) / 6);
            SidebarController.Sidebar.GestureActiveArea = SidebarController.MenuWidth;
            contentVC.SideBarController = SidebarController;
            contentVC.holderVC          = this;
        }
        private async Task LoginAsync()
        {
            var loginResult = await _auth0Client.LoginAsync();

            if (!loginResult.IsError)
            {
                var name  = loginResult.User.FindFirst(c => c.Type == "name")?.Value;
                var email = loginResult.User.FindFirst(c => c.Type == "email")?.Value;
                var image = loginResult.User.FindFirst(c => c.Type == "picture")?.Value;

                var userProfile = new UserProfile
                {
                    Email             = email,
                    Name              = name,
                    ProfilePictureUrl = image
                };

                UIStoryboard board = UIStoryboard.FromName("Main", null);
                UserProfileViewController userProfileViewController = (UserProfileViewController)board.InstantiateViewController("UserProfileViewController");

                userProfileViewController.UserProfile = userProfile;
                this.PresentViewController(userProfileViewController, true, null);
            }

            else
            {
                Console.WriteLine($"An error occurred during login: {loginResult.Error}");
            }
        }
Example #14
0
        private void OpenUserInfoView(AGCUser user)
        {
            var storyboard           = UIStoryboard.FromName("Main", null);
            var secondViewController = storyboard.InstantiateViewController("InfoVC");

            this.NavigationController?.PushViewController(secondViewController, true);
        }
        public UIViewController ViewControllerAtIndex(int index)
        {
            PointsBaseViewController vc;

            UIStoryboard board = UIStoryboard.FromName("Main", null);

            //switch (index)
            //{
            //    //case 0:
            //    //break;
            //    case 1:
            //        vc = LeaderboardVcInstance ?? (LeaderboardVcInstance = board.InstantiateViewController("LeaderboardViewController") as LeaderboardViewController);
            //        break;
            //    case 2:
            //        vc = TransactionsVcInstance ?? (TransactionsVcInstance = board.InstantiateViewController("TransactionsViewController") as TransactionsViewController);
            //        break;
            //    default:
            //        vc = PointsVcInstance ?? (PointsVcInstance = board.InstantiateViewController("PointsViewController") as PointsViewController);
            //        break;
            //}

            //CGRect frame = vc.View.Frame;



            //vc.PageIndex = index;
            //vc.PointsContainerViewController = this;
            //return vc;
            return(new UIViewController());
        }
        partial void DifferentProjectButtonAction(Foundation.NSObject sender)
        {
            var sb   = UIStoryboard.FromName("Storyboard", null);
            var ctlr = sb.InstantiateInitialViewController();

            this.PresentViewController(ctlr, true, null);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SeparatelyShouldRefreshEndpoints = new List <bool> {
                true, true, true
            };

            PointsAndStatsButton.SetTitle("Points & Stats");
            LeaderboardButton.SetTitle("Leaderboard");
            TransactionsButton.SetTitle("Transactions");
            PointsAndStatsButton.SetSelected();

            UIStoryboard board = UIStoryboard.FromName("Main", null);

            pageViewController = board.InstantiateViewController("PointsPageViewController") as UIPageViewController;
            pageSource         = new PointsPageViewControllerDataSource(this);

            pageViewController.DataSource = pageSource;

            var startVC         = this.ViewControllerAtIndex(1) as PointsBaseViewController; //start on second page for glitch (should start on page index 0 without glitch)
            var viewControllers = new UIViewController[] { startVC };

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
            pageViewController.View.Frame = mainView.Bounds;
            AddChildViewController(this.pageViewController);
            mainView.AddSubview(this.pageViewController.View);
            pageViewController.DidMoveToParentViewController(this);

            CGRect frame = View.Frame;
        }
Example #18
0
        void IsBusy_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            var propertyName = e.PropertyName;

            switch (propertyName)
            {
            case nameof(ViewModel.IsBusy):
            {
                InvokeOnMainThread(() =>
                    {
                        if (ViewModel.IsBusy && !refreshControl.Refreshing)
                        {
                            refreshControl.BeginRefreshing();
                        }
                        else if (!ViewModel.IsBusy)
                        {
                            refreshControl.EndRefreshing();
                            if (ViewModel.ReminderLists.Count == 0)
                            {
                                UIStoryboard storyboard = UIStoryboard.FromName("Main", null);
                                var createVc            = storyboard.InstantiateViewController("CreateReminderListViewController") as CreateReminderListViewController;
                                createVc.ViewModel      = ViewModel;
                                this.NavigationController.PresentModalViewController(createVc, true);
                            }
                        }
                    });
            }
            break;
            }
        }
Example #19
0
        public void OpenTorrentFromFile(NSUrl url)
        {
            Console.WriteLine(url.Path);

            if (!File.Exists(url.Path))
            {
                Console.WriteLine("NOT EXIST!");
                return;
            }
            Torrent torrent = Torrent.Load(url.Path);

            foreach (var m in managers)
            {
                if (m.Torrent.InfoHash.Equals(torrent.InfoHash))
                {
                    var alert = UIAlertController.Create("This torrent already exists", "Torrent with name: \"" + torrent.Name + "\" already exists in download queue", UIAlertControllerStyle.Alert);
                    var close = UIAlertAction.Create("Close", UIAlertActionStyle.Cancel, null);
                    alert.AddAction(close);
                    UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alert, true, null);
                    return;
                }
                if (m.Torrent.Name.Equals(torrent.Name))
                {
                    //TODO: Unregister old one
                }
            }
            UIViewController controller = UIStoryboard.FromName("Main", NSBundle.MainBundle).InstantiateViewController("AddTorrent");

            ((AddTorrentController)((UINavigationController)controller).ChildViewControllers[0]).torrent = torrent;
            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(controller, true, null);
        }
        private void LoadFeedByUrl(string url)
        {
            UIStoryboard storyboard = UIStoryboard.FromName("Main", null);

            UIViewController parentController = Platform.RootViewController;

            if (parentController?.GetType() == typeof(SLNavigationController))
            {
                var child = parentController.ChildViewControllers[0];
                (child as MainViewController).SelectedIndex = (int)ENavigationTabs.FEED;
                PopToViewControllerIfNeeded(child as MainViewController);
                ((FeedViewController)((child as MainViewController).SelectedViewController)).RefreshFeedByUrl(url);
                //Platform.PreselectedFeedUrl = null;
                return;
            }

            parentController = Platform.TopViewController;
            if (parentController?.GetType() == typeof(SLNavigationController))
            {
                var child = parentController.ChildViewControllers[0];
                (child as MainViewController).SelectedIndex = (int)ENavigationTabs.FEED;
                PopToViewControllerIfNeeded(child as MainViewController);
                ((FeedViewController)((child as MainViewController).SelectedViewController)).RefreshFeedByUrl(url);
                return;
            }
        }
Example #21
0
        public void WillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions)
        {
            // Use this method to optionally configure and attach the UIWindow `Window` to the provided UIWindowScene `scene`.
            // If using a storyboard, the `Window` property will automatically be initialized and attached to the scene.
            // This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate `GetConfiguration` instead).


            //  UIApplication.shared.connectedScenes.first
            UIWindowScene WindowScene = new UIWindowScene(session, connectionOptions);

            Window = new UIWindow(WindowScene);
            var storyboard = UIStoryboard.FromName("Main", null);


            if (Auth.DefaultInstance.CurrentUser != null)
            {
                var mainViewController = storyboard.InstantiateViewController("MainViewController") as MainViewController;
                Window.RootViewController = mainViewController;
                Window?.MakeKeyAndVisible();
                this.SetWindow(Window);
            }
            else
            {
                var loginViewController = storyboard.InstantiateViewController("LoginViewController") as LoginViewController;
                Window.RootViewController = loginViewController;
                this.SetWindow(Window);
                Window?.MakeKeyAndVisible();
            }
        }
        private void NavigateByAction(string storyboardName, string viewControllerName, ENavigationTabs tabToNavigate)
        {
            UIStoryboard storyboard = UIStoryboard.FromName(storyboardName, null);

            Platform.PreselectedMainViewTab = tabToNavigate;

            SLNavigationController parentController = Platform.RootViewController as SLNavigationController;

            if (parentController != null)
            //if (parentController?.GetType() == typeof(SLNavigationController))
            {
                var child = parentController.ChildViewControllers[0];
                (child as MainViewController).SelectedIndex = (int)tabToNavigate;
                PopToViewControllerIfNeeded(child as MainViewController);
                return;
            }

            parentController = Platform.TopViewController as SLNavigationController;
            if (parentController != null)
            //if (parentController?.GetType() == typeof(SLNavigationController))
            {
                var child = parentController.ChildViewControllers[0];
                (child as MainViewController).SelectedIndex = (int)tabToNavigate;
                PopToViewControllerIfNeeded(child as MainViewController);
                return;
            }

            SLNavigationController viewController = storyboard.InstantiateViewController(viewControllerName) as SLNavigationController;

            parentController.PresentViewController(viewController, false, null);
        }
Example #23
0
        void PushViewController(CompanyLogo companyLogo)
        {
            var imageViewController = UIStoryboard.FromName("Main", NSBundle.MainBundle).InstantiateViewController("ImageViewControllerId") as ImageViewController;

            imageViewController.CompanyLogo = companyLogo;
            NavigationController.PushViewController(imageViewController, true);
        }
        private void GetRewardByUrlComplete(RewardItemModel rewardItem)
        {
            var          rootViewController = UIApplication.SharedApplication.KeyWindow.RootViewController as UINavigationController;
            UIStoryboard board = UIStoryboard.FromName("Rewards", null);

            if (rewardItem.Type == "REWARD")
            {
                var vc = (RewardDetailViewController)board.InstantiateViewController("RewardDetailViewController");
                vc.Reward = rewardItem;
                rootViewController.PushViewController(vc, true);
                return;
            }

            if (rewardItem.Type == "CATEGORY")
            {
                RewardsViewController ctrl = (RewardsViewController)board.InstantiateViewController("RewardsViewController") as RewardsViewController;
                ctrl.RewardsCategoryName = rewardItem.Name;
                if (rewardItem.ChildList != null)
                {
                    ctrl.RewardList = rewardItem.ChildList;
                }
                else
                {
                    ctrl.CategoryID = rewardItem.ID;
                    SL.RewardList   = null;
                }

                rootViewController.PushViewController(ctrl, true);
            }
        }
Example #25
0
        void LoadPrivacyPolicy()
        {
            UIStoryboard     board = UIStoryboard.FromName("More", null);
            UIViewController ctrl  = (UIViewController)board.InstantiateViewController("PrivacyPolicyViewController");

            ViewController.NavigationController.PushViewController(ctrl, true);
        }
Example #26
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            Constants.Id = TableItems[indexPath.Row].Id;
            var employeeDetailsViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("EditEmployeeController");

            navigationController.PushViewController(employeeDetailsViewController, true);
        }
Example #27
0
        public void IF_CameraSelected(int pos)
        {
            UIStoryboard       storyboard = UIStoryboard.FromName("UtilStoryboard", null);
            XFCameraController controller = (XFCameraController)storyboard.InstantiateViewController("XFCameraController");

            PresentModalViewController(controller, true);
        }
Example #28
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            Window = new UIWindow(UIScreen.MainScreen.Bounds);

            IncludeReferences();

            // Initialize App
            App.Initialize().Wait();
            App.Activated();

            // Check if tutorial has been seen
            if (NSUserDefaults.StandardUserDefaults.BoolForKey(PreferencesSettings.FirstLaunchKey))
            {
                // If you have defined a root view controller, set it here:
                Window.RootViewController = new RootViewController();
            }
            else
            {
                UIStoryboard storyboard = UIStoryboard.FromName("MainStoryboard", null);
                IntroductionPageViewController introductionVC = storyboard.InstantiateViewController("IntroductionPageViewController") as IntroductionPageViewController;
                Window.RootViewController = introductionVC;
                UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
                UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.None);
            }

            // Set background fetch interval
            UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum);

            // make the window visible
            Window.MakeKeyAndVisible();

            return(true);
        }
        public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            MapServices.ProvideAPIKey("AIzaSyAZQBaY-ugQuwCWr4NkD-bybK7urElvNyY");
            PlacesClient.ProvideApiKey("AIzaSyAZQBaY-ugQuwCWr4NkD-bybK7urElvNyY");

            Firebase.Core.App.Configure();
            Firebase.Database.Database.DefaultInstance.PersistenceEnabled = false;

            // Decide First Screen
            Window = new UIWindow(UIScreen.MainScreen.Bounds);
            var storyBoard = UIStoryboard.FromName("Main", null);

            if (Auth.DefaultInstance.CurrentUser != null)
            {
                var mainViewController = storyBoard.InstantiateViewController("MainViewController") as MainViewController;
                this.SetWindow(Window);
                Window.RootViewController = mainViewController;
            }
            else
            {
                var loginViewController = storyBoard.InstantiateViewController("LoginViewController") as LoginViewController;
                this.SetWindow(Window);
                Window.RootViewController = loginViewController;
            }

            return(true);
        }
        protected override IMvxTouchView CreateViewOfType(Type viewType, MvxViewModelRequest request)
        {
            // If View is "SampleViewController", then Storyboard should be "SampleViewController.storyboard"
            // If we can't find storyboard, then proceed to load XIB..
            //
            // NOTE: You must have this ctor defined for Storyboard:
            //
            //   public YourViewController (IntPtr handle) : base (handle)
            //
            // As indicated here: http://developer.xamarin.com/guides/ios/user_interface/introduction_to_storyboards/
            //

            IMvxTouchView viewController = null;

            if (NSBundle.MainBundle.PathForResource(viewType.Name, "storyboardc") != null)
            {
                // If storyboard exists for this view, load it.
                System.Console.WriteLine("Creating view from Storyboard {0}.storyboard", viewType.Name);
                var storyboard = UIStoryboard.FromName(viewType.Name, null);
                viewController = (IMvxTouchView)storyboard.InstantiateInitialViewController();
            }
            else
            {
                System.Console.WriteLine("Storyboard {0}.storyboard does not exist: creating view of type instead", viewType.Name);
                viewController = (IMvxTouchView)base.CreateViewOfType(viewType, request);
            }

            if (viewController == null)
            {
                System.Console.WriteLine("Can't create view for type:" + viewType.Name);
                throw new Exception("Can't create view for type:" + viewType.Name);
            }
            return(viewController);
        }