Example #1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Theme.Apply();

            //
            // Create the service
            //

            // Local CSV file
            service = MemoryDirectoryService.FromCsv("Data/XamarinDirectory.csv");

            // LDAP service - uncomment to try it out.
            //service = new LdapDirectoryService {
            //	Host = "ldap.mit.edu",
            //	SearchBase = "dc=mit,dc=edu",
            //};

            //
            // Load the favorites
            //
            var favoritesRepository = XmlFavoritesRepository.OpenIsolatedStorage("Favorites.xml");

            if (favoritesRepository.GetAll().Count() == 0)
            {
                favoritesRepository = XmlFavoritesRepository.OpenFile("Data/XamarinFavorites.xml");
                favoritesRepository.IsolatedStorageName = "Favorites.xml";
            }

            //
            // Load the last search
            //
            Search search = null;

            try {
                search = Search.Open("Search.xml");
            }
            catch (Exception) {
                search = new Search("Search.xml");
            }

            //
            // Build the UI
            //
            favoritesViewController = new FavoritesViewController(favoritesRepository, service, search);

            window = new UIWindow(UIScreen.MainScreen.Bounds);
            window.RootViewController = new UINavigationController(favoritesViewController);
            window.MakeKeyAndVisible();

            //
            // Show the login screen at startup
            //
            var login = new LoginViewController(service);

            favoritesViewController.PresentViewController(login, false, null);

            return(true);
        }
Example #2
0
        public static Page GetMainPage()
        {
            var task = Task.Run(async() => {
                Service = await MemoryDirectoryService.FromCsv("XamarinDirectory.csv");
            });

            task.Wait();

            var employeeList = new ContentPage();

            if (uiImplementation == UIImplementation.CSharp)
            {
                employeeList = new EmployeeListView();
            }
            else if (uiImplementation == UIImplementation.Xaml)
            {
                employeeList = new EmployeeListXaml();
            }

            return(new NavigationPage(employeeList));
        }