/// <summary> /// Create Content View. /// </summary> private void CreateContentView() { GridListView preGridList = gridListView; gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); ResourceData data = new ResourceData(); List <object> dataList = data.GetData(); gridListView.CreateList(dataList); gridView = gridListView.GetGridView(); FocusManager.Instance.SetCurrentFocusView(gridView); if (preGridList != null) { preGridList.Destroy(); } }
/// <summary> /// Create the content. /// </summary> private void CreateContentView() { GridListView preGridList = gridListView; gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); HomePageData data = new HomePageData(); List <object> dataList = data.GetData(); gridListView.CreateList(dataList); Tizen.Log.Fatal("NUI", "Create Grid for first Page!"); gridView = gridListView.GetGridView(); gridView.KeyEvent += DoTilePress; if (preGridList != null) { preGridList.Destroy(); } }
/// <summary> /// Callback function on button clicked event /// </summary> /// <param name="sender">sender object</param> /// <param name="e">command event args</param> private void OnButtonClicked(object sender, Dropdown.ItemSelectedEventArgs e) { Dropdown button = sender as Dropdown; GridListView gridListView = CommonResource.MainViewInstance.GetGridListView(); View contentBgView = CommonResource.MainViewInstance.GetContentBgView(); if (button.Name == "FilterBy") { GridListView preGridList = gridListView; int index = e.SelectedItemIndex; switch (index) { case 0: if (this.sortBtn.ButtonText == "SortBy : Title") { //Create item for all resource and sort the content by title gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.DataList); } else if (this.sortBtn.ButtonText == "SortBy : Size") { //Create item for all resource and sort the content by size gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.SortedList); } break; case 1: if (this.sortBtn.ButtonText == "SortBy : Title") { //Create item for photos and sort the content by title gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.PhotoDataList); } else if (this.sortBtn.ButtonText == "SortBy : Size") { //Create item for photos and sort the content by size gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.SortedPhotoList); } break; case 2: if (this.sortBtn.ButtonText == "SortBy : Title") { //Create item for videos and sort the content by title gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.VideoDataList); } else if (this.sortBtn.ButtonText == "SortBy : Size") { //Create item for videos and sort the content by size gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.SortedVideoList); } break; case 3: if (this.sortBtn.ButtonText == "SortBy : Title") { //Create item for musics and sort the content by title gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.MusicDataList); } else if (this.sortBtn.ButtonText == "SortBy : Size") { //Create item for musics and sort the content by size gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.SortedMusicList); } break; } CommonResource.MainViewInstance.SetGridListView(gridListView); if (preGridList != null) { preGridList.Destroy(); } } else if (button.Name == "SortBy") { int index = e.SelectedItemIndex; GridListView preGridList = gridListView; Tizen.Log.Fatal("NUI", "DropDown.ItemSelectedEvent, index = " + index); switch (index) { case 0: if (this.filterBtn.ButtonText == "FilterBy : ALL") { //Create item for all resource and sort the content by title gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.DataList); } else if (this.filterBtn.ButtonText == "FilterBy : Photo") { //Create item for photos and sort the content by title gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.PhotoDataList); } else if (this.filterBtn.ButtonText == "FilterBy : Video") { //Create item for videos and sort the content by title gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.VideoDataList); } else if (this.filterBtn.ButtonText == "FilterBy : Music") { //Create item for musics and sort the content by title gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.MusicDataList); } break; case 1: if (this.filterBtn.ButtonText == "FilterBy : ALL") { //Create item for all resources and sort the content by size gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.SortedList); } else if (this.filterBtn.ButtonText == "FilterBy : Photo") { //Create item for photos and sort the content by size gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.SortedPhotoList); } else if (this.filterBtn.ButtonText == "FilterBy : Video") { //Create item for videos and sort the content by size gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.SortedVideoList); } else if (this.filterBtn.ButtonText == "FilterBy : Music") { //Create item for musics and sort the content by size gridListView = new GridListView(contentBgView, ContentViewType.ALL, false); gridListView.CreateList(CommonResource.SortedMusicList); } break; } CommonResource.MainViewInstance.SetGridListView(gridListView); if (preGridList != null) { preGridList.Destroy(); } } GridView gridView = gridListView.GetGridView(); gridView.DownFocusableView = filterBtn; filterBtn.DropDownButton.UpFocusableView = gridView; sortBtn.DropDownButton.UpFocusableView = gridView; }