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

            // create a UIPageViewController that pages horizontally (min puts the spine on the left
            pageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);

            // size the view controller so it fills the containing View (context is this.View.Bounds)
            pageViewController.View.Frame = View.Bounds;

            // place the pageViewController inside the UIViewController
            View.AddSubview(pageViewController.View);

            courseManager = new CourseManager(categoryTitle);
            courseManager.MoveFirst();

            CoursePagerViewControllerDataSource dataSource = new CoursePagerViewControllerDataSource(courseManager);
            pageViewController.DataSource = dataSource;

            // Create an instance of the CourseViewController for the current course of the CourseManager
            CourseViewController firstCourseViewController = dataSource.GetFirstViewController();

            pageViewController.SetViewControllers(new UIViewController[] { firstCourseViewController }, UIPageViewControllerNavigationDirection.Forward, false, null);

            // assign delegate methods
            //pageViewController.GetNextViewController = GetNextViewController;
            //pageViewController.GetPreviousViewController = GetPreviousViewController;
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// Perform any additional setup after loading the view, typically from a nib.
            buttonPrev.TouchUpInside += buttonPrev_TouchUpInside;
            buttonNext.TouchUpInside += buttonNext_TouchUpInside;

            courseManager = new CourseManager();
            courseManager.MoveFirst();
            UpdateUI();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // load the main layout
            SetContentView(Resource.Layout.CourseActivity);

            courseCategoryManager = new CourseCategoryManager();
            courseCategoryManager.MoveFirst();
            String displayCategoryTitle = courseCategoryManager.Current.Title;

            //String displayCategoryTitle = DEFAULT_CATEGORY_TITLE;

            //Intent startupIntent = this.Intent;

            //if (startupIntent != null)
            //{
            //    String displayCategoryTitleExtra = startupIntent.GetStringExtra(DISPLAY_CATEGORY_TITLE_EXTRA);

            //    if (displayCategoryTitleExtra != null)
            //    {
            //        displayCategoryTitle = displayCategoryTitleExtra;
            //    }
            //}

            // create courseManager and move to start of courseList
            courseManager = new CourseManager(displayCategoryTitle);
            courseManager.MoveFirst();

            // coursePagerAdapter is used to link together the fragments and the data
            // SupportFragmentManager is a member of FragmentActivity, and allows us to manage fragments
            coursePagerAdapter = new CoursePagerAdapter(SupportFragmentManager, courseManager);

            // Sets the layout for each fragment
            viewPager = FindViewById<ViewPager>(Resource.Id.coursePager);

            viewPager.Adapter = coursePagerAdapter;

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerLayout);

            categoryDrawerListView = FindViewById<ListView>(Resource.Id.categoryDrawerListView);

            categoryDrawerListView.Adapter = new CourseCategoryManagerAdapter(this, Resource.Layout.CourseCategoryItem, courseCategoryManager);

            categoryDrawerListView.SetItemChecked(0, true);

            categoryDrawerListView.ItemClick += categoryDrawerListView_ItemClick;
        }
Esempio n. 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.CourseActivity);

            //code with drawer
            courseCategoryManager = new CourseCategoryManager();
            courseCategoryManager.MoveFirst();

               String displayCategoryTitle = courseCategoryManager.Current.CategoryTitle;

              // String displayCategoryTitle = DEFAULT_CATEGORY_TITLE;

            //Intent startupIntent = this.Intent;
            //if (startupIntent != null)
            //{
            //    String displayCategoryTitleExtra = startupIntent.GetStringExtra(DISPLAY_CATEGORY_TITLE_EXTRA);
            //    if (displayCategoryTitleExtra != null)
            //        displayCategoryTitle = displayCategoryTitleExtra;
            //}

            courseManager = new CourseManager(displayCategoryTitle);
            courseManager.MoveFirst();

            coursePagerAdapter = new CoursePagerAdapter(SupportFragmentManager, courseManager);
            viewPager = FindViewById<ViewPager>(Resource.Id.coursePager);
            viewPager.Adapter = coursePagerAdapter;

            //drawer

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerLayout);
            categoryDrawerListView = FindViewById<ListView>(Resource.Id.categoryDrawerListView);

            //categoryDrawerListView.Adapter =
            //    new CourseCategoryManagerAdapter(this, Android.Resource.Layout.SimpleListItem1, courseCategoryManager);

            categoryDrawerListView.Adapter =
                    new CourseCategoryManagerAdapter(this,Resource.Layout.CourseCategoryItem, courseCategoryManager);

            //android selected as default
            categoryDrawerListView.SetItemChecked(0, true);

            //click event for categories
            categoryDrawerListView.ItemClick += categoryDrawerListView_ItemClick;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            buttonPrev = FindViewById<Button>(Resource.Id.buttonPrev);
            buttonNext = FindViewById<Button>(Resource.Id.buttonNext);
            textTitle = FindViewById<TextView>(Resource.Id.textTitle);
            imageCourse = FindViewById<ImageView>(Resource.Id.imageCourse);
            textDescription = FindViewById<TextView>(Resource.Id.textDescription);

            buttonPrev.Click += buttonPrev_Click;
            buttonNext.Click += buttonNext_Click;

            courseManager = new CourseManager();
            courseManager.MoveFirst();
            UpdateUI();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // create page/view
            pageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
            //sizes
            pageViewController.View.Frame = View.Bounds;
            //sets location
            View.AddSubviews(pageViewController.View);

            courseManager = new CourseManager();
            courseManager.MoveFirst();
            CoursePagerViewControllerDataSource dataSource = new CoursePagerViewControllerDataSource(courseManager);
            pageViewController.DataSource = dataSource;

            //OLD CourseViewController firstCourseViewController = CreateCoursesViewController();
            CourseViewController firstCourseViewController = dataSource.GetFirstViewController();

            pageViewController.SetViewControllers(new UIViewController[] { firstCourseViewController }, UIPageViewControllerNavigationDirection.Forward, false, null);

            //pageViewController.GetNextViewController = GetNextViewController;
            //pageViewController.GetPreviousViewController = GetPreviousViewController;
        }