protected void buildRankImages() { voteBoxes = new List <iiBitmapView>(); for (int i = 0; i < 4; i++) { iiBitmapView vBox = new iiBitmapView { Bitmap = GlobalSingletonHelpers.loadSKBitmapFromResourceName(JudgingContentPage.VOTE_BOX_FILENAME, assembly), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, MinimumWidthRequest = 60, Margin = 2, }; voteBoxes.Add(vBox); } rankImages = new List <iiBitmapView>(); foreach (string filename in JudgingContentPage.rankFilenames) { iiBitmapView img = new iiBitmapView { Bitmap = GlobalSingletonHelpers.loadSKBitmapFromResourceName(filename, assembly), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, MinimumWidthRequest = 60, Margin = 2, }; //img.GestureRecognizers.Add(tap); rankImages.Add(img); } }
public CameraClosedCategorySelectionCell() { if (cameraImage == null) { cameraImage = GlobalSingletonHelpers.loadSKBitmapFromResourceName(CAMERA_IMAGE_NAME, this.GetType().GetTypeInfo().Assembly); } rowSplitter = new Grid { ColumnSpacing = 0, RowSpacing = 0, Margin = 1, }; for (int i = 0; i < 10; i++) { rowSplitter.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); } categoryName.SetBinding(Label.TextProperty, "categoryName"); categoryName.MinimumHeightRequest = 32; rowSplitter.Children.Add(categoryName, 0, 0); Grid.SetColumnSpan(categoryName, 10); cameraButton = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName(CAMERA_IMAGE_NAME, this.GetType().GetTypeInfo().Assembly)) { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, Margin = 3, }; rowSplitter.Children.Add(cameraButton, 9, 0); // col, row rowSplitter.HeightRequest = 32; this.View = rowSplitter; }
public LightbulbProgessBar() : base() { Assembly assembly = this.GetType().GetTypeInfo().Assembly; offBulb = GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.reward_inactive.png", assembly); onBulb = GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.reward.png", assembly); Bitmap = new SKBitmap(offBulb.Width, offBulb.Height); }
public UpperProfileSection() { Assembly assembly = this.GetType().GetTypeInfo().Assembly; lightbulbs = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.reward.png", assembly)); mostBulbsInOneDay.SizeChanged += fixFontSizes; buildUI(); }
public ProfileNavRow(IProvideProfileNavigation parent) { this.parent = parent; RowSpacing = 0; ColumnSpacing = 0; BackgroundColor = GlobalStatusSingleton.backgroundColor; Assembly assembly = this.GetType().GetTypeInfo().Assembly; mySubmissionsOff = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.play_inactive.png", assembly)); mySubmissionsOn = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.play.png", assembly)); mySubmissionsOff.IsVisible = false; // default to my entries page. myLikesOff = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.unliked.png", assembly)); myLikesOn = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.liked.png", assembly)); myLikesOn.IsVisible = false; myEventsOff = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.events_inactive.png", assembly)); myEventsOn = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.events.png", assembly)); myEventsOn.IsVisible = false; myBadgesOff = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.contests_inactive.png", assembly)); myBadgesOn = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.contest.png", assembly)); myBadgesOn.IsVisible = false; hideButton = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.upCaret.png", assembly)); showButton = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.downCaret.png", assembly)); showButton.IsVisible = false; // default to showing profile TapGestureRecognizer tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += OnClicked; mySubmissionsOff.GestureRecognizers.Add(tapGesture); myLikesOff.GestureRecognizers.Add(tapGesture); myEventsOff.GestureRecognizers.Add(tapGesture); myBadgesOff.GestureRecognizers.Add(tapGesture); showButton.GestureRecognizers.Add(tapGesture); hideButton.GestureRecognizers.Add(tapGesture); // on buttons behave differently... TapGestureRecognizer tapGestureOn = new TapGestureRecognizer(); tapGestureOn.Tapped += OnClickedWhenOn; mySubmissionsOn.GestureRecognizers.Add(tapGestureOn); myLikesOn.GestureRecognizers.Add(tapGestureOn); myEventsOn.GestureRecognizers.Add(tapGestureOn); myBadgesOn.GestureRecognizers.Add(tapGestureOn); horizLine = new BoxView { HeightRequest = 1.0, BackgroundColor = GlobalStatusSingleton.highlightColor, HorizontalOptions = LayoutOptions.FillAndExpand, }; horizLine2 = new BoxView { HeightRequest = 1.0, BackgroundColor = GlobalStatusSingleton.highlightColor, HorizontalOptions = LayoutOptions.FillAndExpand, }; buildUI(); NavHighlightIndex = 0; }
public iiBitmapView() { if (BLANK_BITMAP == null) { BLANK_BITMAP = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, this.GetType().GetTypeInfo().Assembly); } this.PaintSurface += OnCanvasViewPaintSurface; //Bitmap = BLANK_BITMAP; }
public void SetBadgesData(BadgesResponseJSON badges) { Assembly assembly = this.GetType().GetTypeInfo().Assembly; if (badges.firstphoto == true) { upload1 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedal_01.png", assembly)); } else { upload1 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedals_inactive.png", assembly)); } if (badges.upload7 == true) { upload7 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedal_02.png", assembly)); } else { upload7 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedals_inactive.png", assembly)); } if (badges.upload30 == true) { upload30 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedal_03.png", assembly)); } else { upload30 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedals_inactive.png", assembly)); } if (badges.upload100 == true) { upload100 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedal_04.png", assembly)); } else { upload100 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedals_inactive.png", assembly)); } if (badges.vote30 == true) { vote30 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.voteMedal_01.png", assembly)); } else { vote30 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.voteMedal_inactive.png", assembly)); } if (badges.vote100 == true) { vote100 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.voteMedal_01.png", assembly)); } else { vote100 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.voteMedal_inactive.png", assembly)); } Device.BeginInvokeOnMainThread(() => { buildUI(); }); }
private int buildUI() { Assembly assembly = this.GetType().GetTypeInfo().Assembly; if (portraitView == null) { portraitView = new Grid { ColumnSpacing = 1, RowSpacing = 1, BackgroundColor = GlobalStatusSingleton.backgroundColor }; for (int i = 0; i < 16; i++) { portraitView.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); } portraitView.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); backButton = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.backbutton.png", assembly)) { HorizontalOptions = LayoutOptions.Start, Margin = 4, }; TapGestureRecognizer backTap = new TapGestureRecognizer(); backTap.Tapped += OnBackPressed; backButton.GestureRecognizers.Add(backTap); //eventCategories = new ListView { ItemsSource = catNames, ItemTemplate = myDataTemplate, }; eventCategories = new ListView { ItemsSource = catNames, }; eventCategories.ItemSelected += OnRowTapped; } else { // flush the old children. portraitView.Children.Clear(); portraitView.IsEnabled = true; } portraitView.Children.Add(eventName, 0, 0); portraitView.Children.Add(backButton, 0, 0); portraitView.Children.Add(eventCreator, 0, 2); portraitView.Children.Add(eventMaxPlayers, 0, 3); portraitView.Children.Add(eventStartDate, 0, 4); portraitView.Children.Add(categoryHeader, 0, 5); portraitView.Children.Add(eventCategories, 0, 6); Grid.SetRowSpan(eventCategories, 8); Content = portraitView; return(1); }
private void buildBackCaret() { backCaret = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.backbutton.png", assembly)) { Margin = 4, HorizontalOptions = LayoutOptions.Start, }; TapGestureRecognizer back = new TapGestureRecognizer(); back.Tapped += (e, a) => { callingPage.switchToEventView(); }; backCaret.GestureRecognizers.Add(back); }
public CameraEnterPhotoView(CameraContentPage parent) { if (Device.Idiom == TargetIdiom.Tablet) { heightAdjustment = 20.0; } Assembly assembly = this.GetType().GetTypeInfo().Assembly; /* try in buildUI to see if that makes a difference for ios... * backButton = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.backbutton.png", assembly)) { * HorizontalOptions = LayoutOptions.Start, * Margin = 4, * }; * TapGestureRecognizer backTap = new TapGestureRecognizer(); * backTap.Tapped += OnBackPressed; * backButton.GestureRecognizers.Add(backTap); */ // the above is not working on ios and it makes no sense as it works in Android. grrrr. // this didn't help. //if (Device.OS == TargetPlatform.iOS) { // challengeLabelP.GestureRecognizers.Add(backTap); //} //Debug.WriteLine("DHB:CameraEnterPhotoView:CameraEnterPhotoView in ctor ok"); alertBulb = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.alert.png", assembly)) { HorizontalOptions = LayoutOptions.End, Margin = 4, IsVisible = false, }; this.cameraPage = parent; submitCurrentPictureP = new Button { Text = "Enter this photo!", HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, TextColor = Color.White, BackgroundColor = GlobalStatusSingleton.ButtonColor, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), IsVisible = false, //IsEnabled = false, }; submitCurrentPictureP.Clicked += this.OnSubmitCurrentPicture; latestTakenImgP = new iiBitmapView(); this.animate += new EventHandler(AnimationEvent); tagsEntry.TextChanged += tagTextChanged; submitOnTagEntryBegin += OnTagEntryBeginSubmit; }
public CameraCreateCategoryView(CameraContentPage parent) { cameraPage = parent; Assembly assembly = this.GetType().GetTypeInfo().Assembly; backButton = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.backbutton.png", assembly)) { Margin = 4, }; TapGestureRecognizer tapped = new TapGestureRecognizer(); tapped.Tapped += OnBackPressed; backButton.GestureRecognizers.Add(tapped); // make sure categoryNames is seeded with at least one entry box. Entry newCategory = new Entry { Placeholder = "Category Name, e.g. Red", PlaceholderColor = Color.Gray, TextColor = Color.Black, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), BackgroundColor = Color.White, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Margin = 1, }; newCategory.TextChanged += PreventCommasInCategoryNames; categoryNames.Add(newCategory); addCategory = new iiBitmapView { Bitmap = GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.votebox.png", assembly), HorizontalOptions = LayoutOptions.End, Margin = 3, }; TapGestureRecognizer catTapped = new TapGestureRecognizer(); catTapped.Tapped += OnAddCategory; addCategory.GestureRecognizers.Add(catTapped); TapGestureRecognizer createTapped = new TapGestureRecognizer(); createTapped.Tapped += OnCreateEvent; createEvent.GestureRecognizers.Add(createTapped); buildUI(); }
public PageHeader() { Assembly assembly = this.GetType().GetTypeInfo().Assembly; settingsButton = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.settings_inactive.png", assembly)) { HorizontalOptions = LayoutOptions.End, Margin = 4, IsVisible = false, // starts invis. }; settingsButton_active = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.settings.png", assembly)) { HorizontalOptions = LayoutOptions.End, Margin = 4, IsVisible = false, // starts invis. }; TapGestureRecognizer tapped = new TapGestureRecognizer(); tapped.Tapped += ((e, s) => { MasterPage mp = ((MasterPage)Application.Current.MainPage); settingsButton_active.IsVisible = true; settingsButton.IsVisible = false; mp.thePages.profilePage.gotoSettingsPage(); }); settingsButton.GestureRecognizers.Add(tapped); backCaret = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.backbutton.png", assembly)) { HorizontalOptions = LayoutOptions.Start, Margin = 4, IsVisible = false, // starts invis. }; TapGestureRecognizer goBack = new TapGestureRecognizer(); goBack.Tapped += ((a, b) => { if (backButtonDelegate != null) { backButtonDelegate(a, b); } }); backCaret.GestureRecognizers.Add(goBack); this.Content = buildTextLogo(); }
/// <summary> /// created an instance in globalsingletonhelpers. /// @deprecated /// </summary> /// <param name="pid"></param> /// <param name="attempt"></param> /// <returns></returns> protected async Task <SKBitmap> loadBitmapAsync(long pid, int attempt = 0) { Debug.WriteLine("DHB:ImageScrollingPage:loadBitmapAsync depth:" + attempt); SKBitmap output = null; byte[] result = await requestImageAsync(pid); if (result != null) { try { /* * PreviewResponseJSON resp = JsonConvert.DeserializeObject<PreviewResponseJSON>(result); * if (resp != null) { * output = GlobalSingletonHelpers.SKBitmapFromBytes(resp.imgStr); * } */ //output = SKBitmap.Decode(result); output = GlobalSingletonHelpers.SKBitmapFromBytes(result); } catch (Exception e) { Debug.WriteLine("DHB:ImageScrollingPage:loadBitmapAsync err:" + e.ToString()); } } if (output == null) { //output = GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.alert.png", assembly); if (attempt < 10) // fail after 10 attempts. { await Task.Delay(3000); await loadBitmapAsync(pid, attempt + 1); // will recurse down till we get it. } else { Debug.WriteLine("DHB:ImageScrollingPage:loadBitmapAsync MaxDepth hit"); output = GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.alert.png", assembly); } } return(output); }
public CameraCategorySelectionView(CameraContentPage parent) { cameraPage = parent; Assembly assembly = this.GetType().GetTypeInfo().Assembly; categoryCreationButton = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.createaneventbutton.png", assembly)) { Scaling = true, EnsureSquare = false, //MinimumHeightRequest = 80, //MinimumWidthRequest = .8*360, //HorizontalOptions = LayoutOptions.CenterAndExpand, Margin = 2, }; categoryCreationButton.SizeChanged += CheckCatButton; TapGestureRecognizer tap = new TapGestureRecognizer(); tap.Tapped += OnCategoryCreateClicked; categoryCreationButton.GestureRecognizers.Add(tap); //joinPassphraseFrame.Content = joinPassphrase; joinImageEnd = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.play.png", assembly)) { HorizontalOptions = LayoutOptions.End, Margin = 3, }; TapGestureRecognizer joinTap = new TapGestureRecognizer(); joinTap.Tapped += OnJoinClicked; //joinLabel.GestureRecognizers.Add(joinTap); joinImageEnd.GestureRecognizers.Add(joinTap); LoadEventsRequest += new EventHandler(OnEventsLoadRequest); }
private void buildMetaButtons() { saveDataOnExit = false; //default setting. unlikedImg = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.unliked.png", assembly)); unflaggedImg = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.unflagged.png", assembly)); likedImg = new iiBitmapView { Bitmap = (GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.liked.png", assembly)), IsVisible = false }; flaggedImg = new iiBitmapView { Bitmap = GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.ImageMetaIcons.flagged.png", assembly), IsVisible = false }; TapGestureRecognizer ulTap = new TapGestureRecognizer(); ulTap.Tapped += (sender, args) => { ActiveMetaBallot.isLiked = true; unlikedImg.IsVisible = false; likedImg.IsVisible = true; saveDataOnExit = true; }; unlikedImg.GestureRecognizers.Add(ulTap); TapGestureRecognizer lTap = new TapGestureRecognizer(); lTap.Tapped += (sender, args) => { ActiveMetaBallot.isLiked = false; likedImg.IsVisible = false; unlikedImg.IsVisible = true; saveDataOnExit = true; }; likedImg.GestureRecognizers.Add(lTap); TapGestureRecognizer ufTap = new TapGestureRecognizer(); ufTap.Tapped += (sender, args) => { ActiveMetaBallot.isFlagged = true; unflaggedImg.IsVisible = false; flaggedImg.IsVisible = true; saveDataOnExit = true; }; unflaggedImg.GestureRecognizers.Add(ufTap); TapGestureRecognizer fTap = new TapGestureRecognizer(); fTap.Tapped += (sender, args) => { ActiveMetaBallot.isFlagged = false; flaggedImg.IsVisible = false; unflaggedImg.IsVisible = true; saveDataOnExit = true; }; flaggedImg.GestureRecognizers.Add(fTap); /* * backButton = new Button { * //Text = buttonText, * Text = "Back", * HorizontalOptions = LayoutOptions.CenterAndExpand, * //VerticalOptions = LayoutOptions.FillAndExpand, * TextColor = Color.Black, * BackgroundColor = GlobalStatusSingleton.ButtonColor, * FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), * }; * backButton.Clicked += (sender, args) => { * // Need to return to caller instead. * //MasterPage mp = ((MasterPage)Application.Current.MainPage); * //await mp.Navigation.PopModalAsync(); * * // only bother checking the textentry on exit. * if (ActiveMetaBallot != null) { * if ((ActiveMetaBallot.tags == null) || (!ActiveMetaBallot.tags.Equals(tagEntry.Text))) { * ActiveMetaBallot.tags = tagEntry.Text; * } * } * * if (saveDataOnExit) { * saveDataOnExitAsync(this); * Debug.WriteLine("DHB:ZoomPage:buildMetaButtons:backButtonClickedAnon this should print first"); * } * PreviousContent.returnToCaller(); * };*/ /*backCaret = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.backbutton.png", assembly)) { * Margin = 4, * HorizontalOptions = LayoutOptions.Start, * }; * TapGestureRecognizer back = new TapGestureRecognizer(); * back.Tapped += OnBack; * backCaret.GestureRecognizers.Add(back);*/ }
public override async Task processImageLoadAsync(long lookupId) { loadingMoreCategories = true; string result = await failProcessing(lookupId); Debug.WriteLine("DHB:LikesPage:processImageLoadAsync through request call"); if ((result.Equals(EMPTY)) && (submissions.Count == 0)) { SubmissionsTitleRow titleRow = new SubmissionsTitleRow { title = "No favorites yet", }; submissions.Add(titleRow); } else { try { // Results can be empty. This means we have some results already, but no more from older stuff. if (!result.Equals(EMPTY)) { LikesResponseJSON myLikes = JsonConvert.DeserializeObject <LikesResponseJSON>(result); Debug.WriteLine("DHB:LikesPage:processImageLoadAsync pre if stmt"); if ((myLikes != null) && (myLikes.likes != null) && (myLikes.likes.Count > 0)) { Debug.WriteLine("DHB:LikesPage:processImageLoadAsync post if stmt"); myLikes.likes.Sort(); myLikes.likes.Reverse(); // hmm.... harry may have done this already... Debug.WriteLine("DHB:LikesPage:processImageLoadAsync break"); foreach (LikesJSON subCategory in myLikes.likes) { Debug.WriteLine("DHB:LikesPage:processImageLoadAsync inside foreach"); if ((subCategory.photos != null) && (subCategory.photos.Count > 0)) { SubmissionsTitleRow titleRow = new SubmissionsTitleRow { title = subCategory.category.description }; #if DEBUG titleRow.title += " - " + subCategory.category.categoryId; #endif submissions.Add(titleRow); Debug.WriteLine("DHB:LikesPage:processImageLoadAsync about to load: " + subCategory.photos.Count + " photos."); //foreach (PhotoMetaJSON photo in subCategory.photos) { for (int i = 0; i < subCategory.photos.Count; i = i + 3) { int j = i; SubmissionsImageRow imgRow = new SubmissionsImageRow(); submissions.Add(imgRow); imgRow.bitmap0 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp0Meta = subCategory.photos[j]; PhotoLoad pl = new PhotoLoad(subCategory.photos[j].pid, imgRow, 0); photosToLoad.Enqueue(pl); //imgRow.bitmap0 = loadBitmapAsync(subCategory.photos[j].pid).Result; if (j + 1 < subCategory.photos.Count) { imgRow.bitmap1 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp1Meta = subCategory.photos[j + 1]; //imgRow.bitmap1 = loadBitmapAsync(subCategory.photos[j + 1].pid).Result; //Task.Run(() => imgRow.bitmap1 = loadBitmapAsync(subCategory.photos[j + 1].pid).Result); //imgRow.bmp1Meta = subCategory.photos[j + 1]; pl = new PhotoLoad(subCategory.photos[j + 1].pid, imgRow, 1); photosToLoad.Enqueue(pl); } if (j + 2 < subCategory.photos.Count) { imgRow.bitmap2 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp2Meta = subCategory.photos[j + 2]; pl = new PhotoLoad(subCategory.photos[j + 2].pid, imgRow, 2); photosToLoad.Enqueue(pl); } Debug.WriteLine("DHB:LikesPage:processImageLoadAsync complete."); } //SubmissionsBlankRow blank = new SubmissionsBlankRow(); //submissions.Add(blank); // causing issues at this row. skip for now. } Debug.WriteLine("DHB:LikesPage:processImageLoadAsync category: " + subCategory.category.description + " complete."); } nextLookupId = myLikes.likes[myLikes.likes.Count - 1].category.categoryId; } } } catch (Exception ex) { Debug.WriteLine("DHB:LikesPage:processImageLoadAsync LikesResponseJSON crash"); Debug.WriteLine("DHB:LikesPage:processImageLoadAsync input json:" + result); Debug.WriteLine("DHB:LikesPage:processImageLoadAsync LikesResponseJSON crash Done."); } } // this did not fix the problem. //myListView.ItemsSource = null; // testing whether this clears up my observable collection changed issue. //myListView.ItemsSource = submissions; // testing whether this clears up my observable collection changed issue. Debug.WriteLine("DHB:LikesPage:processImageLoadAsync complete."); loadingMoreCategories = false; }
public override async Task processImageLoadAsync(long lookupId) { loadingMoreCategories = true; string result = await failProcessing(lookupId); Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync through request call"); if (result.Equals(EMPTY)) { SubmissionsTitleRow titleRow = new SubmissionsTitleRow { title = "No entries yet, be the first!", }; submissions.Add(titleRow); } else { try { // Results can be empty. This means we have some results already, but no more from older stuff. if (!result.Equals(EMPTY)) { PhotosResponseJSON catImages = JsonConvert.DeserializeObject <PhotosResponseJSON>(result); // need to update Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync pre if stmt"); if ((catImages != null) && (catImages.photos != null) && (catImages.photos.Count > 0)) { Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync post if stmt"); catImages.photos.Sort(); catImages.photos.Reverse(); // hmm.... harry may have done this already... Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync break"); // title row // @todo There's a race condition here... shitshers. SubmissionsTitleRow titleRow = new SubmissionsTitleRow { title = _ActiveCategory.description }; #if DEBUG titleRow.title += " - " + _ActiveCategory.categoryId; #endif submissions.Add(titleRow); Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync about to load: " + catImages.photos.Count + " photos."); //foreach (PhotoMetaJSON photo in subCategory.photos) { for (int i = 0; i < catImages.photos.Count; i = i + 3) { int j = i; SubmissionsImageRow imgRow = new SubmissionsImageRow(); submissions.Add(imgRow); imgRow.bitmap0 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp0Meta = catImages.photos[j]; PhotoLoad pl = new PhotoLoad(catImages.photos[j].pid, imgRow, 0); photosToLoad.Enqueue(pl); //imgRow.bitmap0 = loadBitmapAsync(subCategory.photos[j].pid).Result; if (j + 1 < catImages.photos.Count) { imgRow.bitmap1 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp1Meta = catImages.photos[j + 1]; //imgRow.bitmap1 = loadBitmapAsync(subCategory.photos[j + 1].pid).Result; //Task.Run(() => imgRow.bitmap1 = loadBitmapAsync(subCategory.photos[j + 1].pid).Result); //imgRow.bmp1Meta = subCategory.photos[j + 1]; pl = new PhotoLoad(catImages.photos[j + 1].pid, imgRow, 1); photosToLoad.Enqueue(pl); } if (j + 2 < catImages.photos.Count) { imgRow.bitmap2 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp2Meta = catImages.photos[j + 2]; pl = new PhotoLoad(catImages.photos[j + 2].pid, imgRow, 2); photosToLoad.Enqueue(pl); } Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync complete."); } //SubmissionsBlankRow blank = new SubmissionsBlankRow(); //submissions.Add(blank); // causing issues at this row. skip for now. } else { // @todo This may need to adjust after an entry comes in! SubmissionsTitleRow titleRow = new SubmissionsTitleRow { title = "No entries yet, be the first!", }; submissions.Add(titleRow); } Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync category: " + _ActiveCategory.description + " complete."); } } catch (Exception ex) { Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync PhotosResponseJSON crash"); Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync input json:" + result); Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync ex:" + ex.ToString()); Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync PhotosResponseJSON crash Done."); } } Debug.WriteLine("DHB:EventCategoryImagesPage:processImageLoadAsync complete."); loadingMoreCategories = false; }
public override async Task processImageLoadAsync(long lookupId) { loadingMoreCategories = true; /* * string result = "fail"; * while (result.Equals("fail")) { * result = await requestApiCallAsync(lookupId, activeApiCall); * if (result == null) result = "fail"; * if (result.Equals("fail")) { * await Task.Delay(10000); * } * } */ string result = await failProcessing(lookupId); Debug.WriteLine("DHB:MySubmissionsPage:processImageLoadAsync through request call"); if (result.Equals(EMPTY)) { SubmissionsTitleRow titleRow = new SubmissionsTitleRow { title = "You have not yet submitted a photo", }; if (submissions.Count == 0) { submissions.Add(titleRow); } } else { SubmissionsResponseJSON mySubs = JsonConvert.DeserializeObject <SubmissionsResponseJSON>(result); Debug.WriteLine("DHB:MySubmissionsPage:processSubmissionsLoadAsync pre if stmt"); if ((mySubs != null) && (mySubs.submissions != null) && (mySubs.submissions.Count > 0)) { Debug.WriteLine("DHB:MySubmissionsPage:processSubmissionsLoadAsync post if stmt"); mySubs.submissions.Sort(); printSubs(mySubs.submissions); mySubs.submissions.Reverse(); Debug.WriteLine("DHB:MySubmissionsPage:processSubmissionsLoadAsync break"); printSubs(mySubs.submissions); foreach (SubmissionJSON subCategory in mySubs.submissions) { Debug.WriteLine("DHB:MySubmissionsPage:processSubmissionsLoadAsync inside foreach"); //if (subCategory.photos.Count > 0) && (!subCategory.category.state.Equals(CategoryJSON.CLOSED))) { if ((subCategory.photos != null) && (subCategory.photos.Count > 0)) { if ((GlobalStatusSingleton.pendingCategories.Count == 0) || ((GlobalStatusSingleton.pendingCategories.Count > 0) && (subCategory.category.categoryId < GlobalStatusSingleton.pendingCategories[0].categoryId))) { SubmissionsTitleRow titleRow = new SubmissionsTitleRow { title = subCategory.category.description }; #if DEBUG titleRow.title += " - " + subCategory.category.categoryId; #endif submissions.Add(titleRow); Debug.WriteLine("DHB:MySubmissionsPage:processSubmissionsLoadAsync about to load: " + subCategory.photos.Count + " photos."); //foreach (PhotoMetaJSON photo in subCategory.photos) { for (int i = 0; i < subCategory.photos.Count; i = i + 3) { int j = i; SubmissionsImageRow imgRow = new SubmissionsImageRow(); submissions.Add(imgRow); imgRow.bitmap0 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp0Meta = subCategory.photos[j]; PhotoLoad pl = new PhotoLoad(subCategory.photos[j].pid, imgRow, 0); photosToLoad.Enqueue(pl); //imgRow.bitmap0 = loadBitmapAsync(subCategory.photos[j].pid).Result; /* * Task.Run(async () => { * Debug.WriteLine("DHB:MySubmissionsPage imgload started for img " + j); * imgRow.bitmap0 = await loadBitmapAsync(subCategory.photos[j].pid); * Debug.WriteLine("DHB:MySubmissionsPage imgload finished for img " + j); * }); */ if (j + 1 < subCategory.photos.Count) { imgRow.bitmap1 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp1Meta = subCategory.photos[j + 1]; //imgRow.bitmap1 = loadBitmapAsync(subCategory.photos[j + 1].pid).Result; //Task.Run(() => imgRow.bitmap1 = loadBitmapAsync(subCategory.photos[j + 1].pid).Result); //imgRow.bmp1Meta = subCategory.photos[j + 1]; pl = new PhotoLoad(subCategory.photos[j + 1].pid, imgRow, 1); photosToLoad.Enqueue(pl); } if (j + 2 < subCategory.photos.Count) { imgRow.bitmap2 = GlobalSingletonHelpers.loadSKBitmapFromResourceName(LOADING_IMG_NAME, assembly); imgRow.bmp2Meta = subCategory.photos[j + 2]; pl = new PhotoLoad(subCategory.photos[j + 2].pid, imgRow, 2); photosToLoad.Enqueue(pl); } Debug.WriteLine("DHB:MySubmissionsPage:processSubmissionsLoadAsync complete."); } //SubmissionsBlankRow blank = new SubmissionsBlankRow(); //submissions.Add(blank); // causing issues at this row. skip for now. } } Debug.WriteLine("DHB:MySubmissionsPage:processSubmissionsLoadAsync category: " + subCategory.category.description + " complete."); } nextLookupId = mySubs.submissions[mySubs.submissions.Count - 1].category.categoryId; } } // this did not fix the problem. //myListView.ItemsSource = null; // testing whether this clears up my observable collection changed issue. //myListView.ItemsSource = submissions; // testing whether this clears up my observable collection changed issue. Debug.WriteLine("DHB:MySubmissionsPage:processSubmissionsLoadAsync complete."); loadingMoreCategories = false; }
public KeyPageNavigator(string categoryDesc = "") { RowSpacing = 0; ColumnSpacing = 0; BackgroundColor = GlobalStatusSingleton.backgroundColor; //Padding = 10; Assembly assembly = this.GetType().GetTypeInfo().Assembly; gotoVotingImgButtonOff = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.vote_inactive.png", assembly)); gotoVotingImgButtonOn = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.vote.png", assembly)); gotoVotingImgButtonOff.IsVisible = false; gotoLeaderboardImgButtonOff = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.leaderboard_inactive.png", assembly)); gotoLeaderboardImgButtonOn = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.leaderboard.png", assembly)); gotoLeaderboardImgButtonOn.IsVisible = false; gotoCameraImgButtonOff = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.play_inactive.png", assembly)); gotoCameraImgButtonOn = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.play.png", assembly)); gotoCameraImgButtonOn.IsVisible = false; gotoHamburgerImgButtonOff = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.profile_inactive.png", assembly)); gotoHamburgerImgButtonOn = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.profile.png", assembly)); gotoHamburgerImgButtonOn.IsVisible = false; categoryLabel = new Label { Text = categoryDesc, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.Black, BackgroundColor = GlobalStatusSingleton.backgroundColor, LineBreakMode = LineBreakMode.WordWrap, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), }; tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += OnClicked; gotoVotingImgButtonOff.GestureRecognizers.Add(tapGesture); //goHomeImgButton.GestureRecognizers.Add(tapGesture); gotoLeaderboardImgButtonOff.GestureRecognizers.Add(tapGesture); gotoCameraImgButtonOff.GestureRecognizers.Add(tapGesture); gotoHamburgerImgButtonOff.GestureRecognizers.Add(tapGesture); // on buttons behave differently... TapGestureRecognizer tapGestureOn = new TapGestureRecognizer(); tapGestureOn.Tapped += OnClickedWhenOn; gotoVotingImgButtonOn.GestureRecognizers.Add(tapGestureOn); gotoLeaderboardImgButtonOn.GestureRecognizers.Add(tapGestureOn); gotoCameraImgButtonOn.GestureRecognizers.Add(tapGestureOn); gotoHamburgerImgButtonOn.GestureRecognizers.Add(tapGestureOn); horizLine = new BoxView { HeightRequest = 1.0, BackgroundColor = GlobalStatusSingleton.highlightColor, HorizontalOptions = LayoutOptions.FillAndExpand, }; // ColumnSpacing = 1; RowSpacing = 1; ColumnDefinitions.Add(new ColumnDefinition()); ColumnDefinitions.Add(new ColumnDefinition()); ColumnDefinitions.Add(new ColumnDefinition()); ColumnDefinitions.Add(new ColumnDefinition()); RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(14, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(60, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(20, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(5, GridUnitType.Star) }); Children.Add(horizLine, 0, 0); Grid.SetColumnSpan(horizLine, 4); Children.Add(gotoVotingImgButtonOff, 0, 2); Children.Add(gotoVotingImgButtonOn, 0, 2); //Children.Add(goHomeImgButton, 1, 1); Children.Add(gotoLeaderboardImgButtonOff, 1, 2); Children.Add(gotoLeaderboardImgButtonOn, 1, 2); Children.Add(gotoCameraImgButtonOff, 2, 2); Children.Add(gotoCameraImgButtonOn, 2, 2); Children.Add(categoryLabel, 2, 3); Children.Add(gotoHamburgerImgButtonOff, 3, 2); Children.Add(gotoHamburgerImgButtonOn, 3, 2); // We now have a play button. // This object should always be created AFTER the judging page, so this should exist... //if (GlobalStatusSingleton.ptrToJudgingPageLoadCategory != null) { // GlobalStatusSingleton.ptrToJudgingPageLoadCategory += new CategoryLoadSuccessEventHandler(OnCategoryLoad); //} }
private int buildUI() { this.BackgroundColor = Color.Transparent; assembly = this.GetType().GetTypeInfo().Assembly; if (portraitView == null) { portraitView = new Grid { ColumnSpacing = 0, RowSpacing = 0, BackgroundColor = Color.White, }; for (int i = 0; i < 20; i++) // we're a whole page modal { portraitView.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); } for (int i = 0; i < 12; i++) // we're a whole page modal { portraitView.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); } } iiBitmapView backButton = new iiBitmapView { Bitmap = GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.backbutton.png", assembly), HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, Margin = 2, }; TapGestureRecognizer tap = new TapGestureRecognizer(); tap.Tapped += OnCloseTapped; backButton.GestureRecognizers.Add(tap); portraitView.Children.Add(backButton, 0, 2); Grid.SetRowSpan(backButton, 2); buildRankImages(); addImage(0, 1, 5); addImage(1, 7, 5); addImage(2, 1, 10); addImage(3, 7, 10); Label instructionsOne = new Label { Text = "Pick your favorites and earn lightbulbs!\n" + "Tap the vote box starting with your favorite\n" + "Tap an image to zoom in, like, tag, or flag\n" + "Click play to enter your own photos!", TextColor = Color.Black, Opacity = 1, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), HorizontalTextAlignment = TextAlignment.Center, }; portraitView.Children.Add(instructionsOne, 0, 15); Grid.SetColumnSpan(instructionsOne, 12); Grid.SetRowSpan(instructionsOne, 5); portraitView.Opacity = .8; Content = portraitView; if (animate != null) { animate(this, new EventArgs()); } return(1); }