Esempio n. 1
0
        private void itemListReleased(object sender, PointerRoutedEventArgs e)
        {
            isRightClicking = false;
            DataStructure.ModuleItem selectedItem = (e.OriginalSource as FrameworkElement).DataContext as DataStructure.ModuleItem;

            // make sure the tap event occurs on list items
            if (selectedItem != null && selectedItem != _currentItem)
            {
                switch (selectedItem.itemType)
                {
                    case DataStructure.ItemType.ANNOUNCEMENT:
                        flipView.SelectedItem = null;
                        flipView.SelectedIndex = 1;
                        break;

                    case DataStructure.ItemType.GRADEBOOK:
                        flipView.SelectedItem = null;
                        flipView.SelectedIndex = 3;
                        break;

                    case DataStructure.ItemType.ABOUT:
                        flipView.SelectedItem = null;
                        flipView.SelectedIndex = 0;
                        break;

                    case DataStructure.ItemType.WEBCAST:
                        flipView.SelectedItem = null;
                        flipView.SelectedIndex = 5;

                        // generate a complete list of video files
                        // and store under webcast object
                        _currentModule.moduleWebcasts[selectedItem.itemIndex].GenerateVideoFileList();
                        webcastGridViews.Source = _currentModule.moduleWebcasts[selectedItem.itemIndex].webcastAllVideoFiles;
                        playerStackpanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        webcastGridView.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        break;

                    case DataStructure.ItemType.WORKBIN:
                        flipView.SelectedItem = null;
                        flipView.SelectedIndex = 2;

                        _currentWorkbin = _currentModule.moduleWorkbins[selectedItem.itemIndex];

                        folder.Source = _currentWorkbin.workbinFolders;
                        file.Source = new List<DataStructure.File>();

                        _folderTree.Clear();
                        upFolderButton.Visibility = Visibility.Collapsed;
                        upFolderButton_snapped.Visibility = Visibility.Collapsed;

                        break;

                    case DataStructure.ItemType.FORUM:
                        flipView.SelectedItem = null;
                        flipView.SelectedIndex = 4;

                        _currentForumIndex = selectedItem.itemIndex;

                        // generate content for display
                        updateForum();

                        headers.Source = _currentModule.moduleForums[selectedItem.itemIndex].forumAllTitles;
                   
                        break;

                    default:
                        break;
                }

                _currentItem = selectedItem;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            // display tabs
            itemListView.Source = _currentModule.moduleItems;
            workbinListView.Source = _currentModule.moduleWorkbins;
            ObservableCollection<DataStructure.ModuleItem> moduleItems = _currentModule.moduleItems;
            for (int i = 0; i < moduleItems.Count; i++)
            {
                moduleItems[i].itemShowColor = moduleItems[i].itemPrimaryColor;
            }

            try
            {
                // display module information
                moduleName_textblock.Text = _currentModule.moduleName;
                moduleCode_textblock.Text = _currentModule.moduleCode;
                moduleAcadYear_textblock.Text = _currentModule.moduleAcadYear + _currentModule.moduleSemester;
                lecturerListView.Source = _currentModule.moduleLecturers;
            }
            catch
            {
            }

            // display gradebook
            if(_currentModule.isGradebookAvailable)
            {
                foreach (DataStructure.Gradebook gradebook in _currentModule.moduleGradebooks)
                {
                    gradebook.GenerateGradebookCategoryDisplay();
                    _allGrades = _allGrades.Concat<DataStructure.Grade>(gradebook.gradebookGrades).ToList<DataStructure.Grade>();
                }

                grades.Source = _allGrades;
            }

            // display announcements
            if (_currentModule.isAnnouncementAvailable)
            {
                newAnnouncementListView.Source = _currentModule.moduleAnnouncements;
            }           

            // create forum title for display
            if (_currentModule.isForumAvailable)
            {

            }

            // if announcement index passed from main page is valid
            if (_announcementIndex >= 0)
            {
                //itemList.SelectedIndex = 1;
                flipView.SelectedItem = null;
                flipView.SelectedIndex = 1;
                var obj = flipView.SelectedValue;
                _currentItem = _currentModule.moduleItems[1];
                moduleItems[1].itemShowColor = gray;

                //announcementListView.SelectedIndex = _announcementIndex;
            }
            else
            {
                //itemList.SelectedIndex = 0;
                moduleItems[0].itemShowColor = gray;
                flipView.SelectedIndex = 0;
                _currentItem = _currentModule.moduleItems[0];
            }
            SolidColorBrush backgroundBrush = new SolidColorBrush(_currentModule.modulePrimaryColor);
            leftStackPanel.Background = backgroundBrush;

        }