public async Task CreatePlaylist(object sender, EventArgs e) { #if __IOS__ if (playListNameEntry.Text != null) { playlist = new PlayList(); playlist.Name = playListNameEntry.Text; playlist.Description = playListDescriptionEditor.Text; account = _baseViewModel.GetAccountInformation(); user = await _baseViewModel.FindUserByIdAsync(FINDUSER, account.Properties["Id"]); await _playlistCreatePageViewModel.CreatePlaylist(playlist, user.Id); if (_playlistCreatePageViewModel.Successful) { await Navigation.PopModalAsync(); } else { await DisplayAlert("Playlist Not Added", playlist.Name + " has not been added. Check your network connectivity!", "Ok"); } } else { await DisplayAlert("Error", "Name cannot be empty, fill it in!", "Ok"); playListNameEntry.Focus(); } #endif #if __ANDROID__ if (!string.IsNullOrWhiteSpace(androidPlaylistNameEntry.Text)) { playlist = new PlayList(); playlist.Name = androidPlaylistNameEntry.Text; playlist.Description = androidPlaylistDescriptionEntry.Text; account = _baseViewModel.GetAccountInformation(); user = await _baseViewModel.FindUserByIdAsync(FINDUSER, account.Properties["Id"]); await _playlistCreatePageViewModel.CreatePlaylist(playlist, user.Id); if (_playlistCreatePageViewModel.Successful) { await Navigation.PopModalAsync(); } else { await DisplayAlert("Playlist Not Added", playlist.Name + " has not been added. Check your network connectivity!", "Ok"); } } else { await DisplayAlert("Error", "Name cannot be empty, fill it in!", "Ok"); androidPlaylistNameEntry.RequestFocus(); } #endif }
public async Task DeleteFromPlaylist(object sender, EventArgs e) { bool deleteVideo = await DisplayAlert("Delete Video From Playlist", "Remove " + videoTechnique.Name + " from " + userPlaylist.Name + "?", "Yes", "No"); if (deleteVideo) { account = _baseViewModel.GetAccountInformation(); id = account.Properties["Id"]; await _playListVideoPageViewModel.DeleteVideoFromPlaylist(Constants.DELETEVIDEOFROMPLAYLIST, id, userPlaylist, videoTechnique.Name); if (_playListVideoPageViewModel.Successful) { await DisplayAlert("Video Deleted From Playlist", videoTechnique.Name + " has been successfully deleted from " + userPlaylist.Name + ".", "Ok"); await Navigation.PopModalAsync(); } else { await DisplayAlert("Video Not Deleted From Playlist", videoTechnique.Name + " has not been deleted from " + userPlaylist.Name + ". Try again!", "Ok"); } } else { return; } }
private async Task Validate() { if (this.hasPackage) { #if __ANDROID__ if (!string.IsNullOrWhiteSpace(androidNameEntry.Text) || !string.IsNullOrWhiteSpace(androidEmailAddressEntry.Text) || !string.IsNullOrWhiteSpace(androidPassWordEntry.Text) || !string.IsNullOrWhiteSpace(androidSecretQuestionEntry.Text)) #endif #if __IOS__ if (!string.IsNullOrWhiteSpace(nameEntry.Text) || !string.IsNullOrWhiteSpace(emailAddressEntry.Text) || !string.IsNullOrWhiteSpace(passWordEntry.Text) || !string.IsNullOrWhiteSpace(secretQuestionEntry.Text)) #endif { CreateUser(); await Navigation.PushModalAsync(new SummaryPage(user)); } else { await DisplayAlert("Sign Up Error", "Make sure all fields are filled in!", "Okay, got it."); } } else { _account = _baseViewModel.GetAccountInformation(); if (_account.Properties["Package"] == "Gi") { this.package = Package.Gi; } else if (_account.Properties["Package"] == "NoGi") { this.package = Package.NoGi; } else { this.package = Package.GiAndNoGi; } #if __ANDROID__ if (androidNameEntry.Text != null || androidEmailAddressEntry.Text != null || androidPassWordEntry.Text != null || androidSecretQuestionEntry.Text != null) #endif #if __IOS__ if (nameEntry.Text != null || emailAddressEntry.Text != null || passWordEntry.Text != null || secretQuestionEntry.Text != null) #endif { CreateUser(); await _summaryPageViewModel.CreateUser(user); _baseViewModel.DeleteCredentials(); _baseViewModel.SaveCredentials(_summaryPageViewModel.User); Application.Current.MainPage = new MainTabbedPage(true); } else { await DisplayAlert("Sign Up Error", "Make sure all fields are filled in!", "Okay, got it."); } } }
public async void FindPlaylists() { account = _baseViewModel.GetAccountInformation(); id = account.Properties["Id"]; await _playlistViewPageViewModel.GetUserPlaylists(Constants.GETPLAYLIST, id); userPlaylist = _playlistViewPageViewModel.Playlist; SetListView(); }
protected bool LoginCheck() { account = _baseViewModel.GetAccountInformation(); if (account == null) { return(false); } else { return(true); } }
//Functions private void DoesUserHaveAccount() { account = _baseViewModel.GetAccountInformation(); if (account.Username == "NO_ACCOUNT") { userHasAccount = false; } else { userHasAccount = true; } }
public BrowsePage() { _baseViewModel = new BaseViewModel(); account = _baseViewModel.GetAccountInformation(); BackgroundColor = Color.FromHex("#F1ECCE"); #if __IOS__ Icon = "openbook.png"; Title = "Browse"; Padding = new Thickness(10, 30, 10, 10); #endif #if __ANDROID__ Icon = "openbook.png"; Padding = new Thickness(5, 5, 5, 5); #endif SetContent(); }
public PurchasePage(Package package, bool hasAccount) { _baseViewModel = new BaseViewModel(); _purchasePageViewModel = new PurchasePageViewModel(); account = _baseViewModel.GetAccountInformation(); BackgroundColor = Color.FromHex("#F1ECCE"); this.package = package; this.isLoggedIn = hasAccount; #if __ANDROID__ Padding = new Thickness(5, 5, 5, 5); #endif #if __IOS__ Padding = new Thickness(10, 30, 10, 10); #endif SetContent(); }
public HomePage(bool hasAccount) { _baseViewModel = new BaseViewModel(); _homePageViewModel = new HomePageViewModel(); _account = _baseViewModel.GetAccountInformation(); BackgroundColor = Color.FromHex("#F1ECCE"); this.account = hasAccount; #if __IOS__ Icon = "construction.png"; Title = "Home"; Padding = new Thickness(10, 10, 10, 10); #endif #if __ANDROID__ Icon = "construction.png"; Padding = new Thickness(5, -5, 5, 5); #endif SetVimeoUrl(); BuildPageObjects(); SetContent(hasAccount); }
//Functions private void SetSearch() { account = _baseViewModel.GetAccountInformation(); if (account.Properties["Package"] != null) { var package = account.Properties["Package"]; if (package == "Gi") { VIMEOVIDEOS = Constants.VIMEOGIALBUM; } else if (package == "NoGi") { VIMEOVIDEOS = Constants.VIMEONOGIALBUM; } else { VIMEOVIDEOS = Constants.VIMEOGIANDNOGIALBUM; } } }
//Functions private void SetContent() { var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button)); innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(3, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(2, GridUnitType.Star) } } }; outerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; stackLayout = new StackLayout(); scrollView = new ScrollView(); #if __ANDROID__ androidBlogLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidBlogLbl.Text = "Blog"; androidBlogLbl.Typeface = Constants.COMMONFONT; androidBlogLbl.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidBlogLbl.SetTextColor(Android.Graphics.Color.Rgb(241, 236, 206)); androidBlogLbl.Gravity = Android.Views.GravityFlags.Center; androidBlogLbl.Click += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PushModalAsync(new BlogViewPage()); ToggleButtons(); }; #endif sweepLbl = new Label { Style = (Style)Application.Current.Resources["common-blue-lbl"], Text = "Sweep", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize #endif #if __ANDROID__ FontFamily = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt", FontSize = lblSize * 1.5, FontAttributes = FontAttributes.Bold #endif }; sweepTap = new TapGestureRecognizer(); sweepTap.Tapped += async(sender, e) => { ToggleButtons(); account = _baseViewModel.GetAccountInformation(); if (account.Properties["Package"] == "Gi") { await Navigation.PushModalAsync(new SearchPage(Album.GiSweep)); } else if (account.Properties["Package"] == "NoGi") { await Navigation.PushModalAsync(new SearchPage(Album.NoGiSweep)); } else { await Navigation.PushModalAsync(new SearchPage(Album.Sweep)); } ToggleButtons(); }; sweepLbl.GestureRecognizers.Add(sweepTap); sweepFrame = new Frame { BackgroundColor = Color.FromRgb(58, 93, 174), HasShadow = false, BorderColor = Color.Black, Content = sweepLbl, Padding = new Thickness(10, 10, 10, 10) }; takeDownLbl = new Label { Style = (Style)Application.Current.Resources["common-blue-lbl"], Text = "Take Down", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize #endif #if __ANDROID__ FontFamily = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt", FontSize = lblSize * 1.5, FontAttributes = FontAttributes.Bold #endif }; takeDownTap = new TapGestureRecognizer(); takeDownTap.Tapped += async(sender, e) => { ToggleButtons(); account = _baseViewModel.GetAccountInformation(); if (account.Properties["Package"] == "Gi") { await Navigation.PushModalAsync(new SearchPage(Album.GiTakeDown)); } else if (account.Properties["Package"] == "NoGi") { await Navigation.PushModalAsync(new SearchPage(Album.NoGiTakeDown)); } else { await Navigation.PushModalAsync(new SearchPage(Album.TakeDown)); } ToggleButtons(); }; takeDownLbl.GestureRecognizers.Add(takeDownTap); takeDownFrame = new Frame { BackgroundColor = Color.FromRgb(58, 93, 174), HasShadow = false, BorderColor = Color.Black, Content = takeDownLbl, Padding = new Thickness(10, 10, 10, 10) }; submissionLbl = new Label { Style = (Style)Application.Current.Resources["common-blue-lbl"], Text = "Submission", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize #endif #if __ANDROID__ FontFamily = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt", FontSize = lblSize * 1.5, FontAttributes = FontAttributes.Bold #endif }; submissionTap = new TapGestureRecognizer(); submissionTap.Tapped += async(sender, e) => { ToggleButtons(); account = _baseViewModel.GetAccountInformation(); if (account.Properties["Package"] == "Gi") { await Navigation.PushModalAsync(new SearchPage(Album.GiSubmission)); } else if (account.Properties["Package"] == "NoGi") { await Navigation.PushModalAsync(new SearchPage(Album.NoGiSubmission)); } else { await Navigation.PushModalAsync(new SearchPage(Album.Submission)); } ToggleButtons(); }; submissionLbl.GestureRecognizers.Add(submissionTap); submissionFrame = new Frame { BackgroundColor = Color.FromRgb(58, 93, 174), HasShadow = false, BorderColor = Color.Black, Content = submissionLbl, Padding = new Thickness(10, 10, 10, 10) }; guardPassLbl = new Label { Style = (Style)Application.Current.Resources["common-blue-lbl"], Text = "Guard Pass", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize #endif #if __ANDROID__ FontFamily = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt", FontSize = lblSize * 1.5, FontAttributes = FontAttributes.Bold #endif }; guardPassTap = new TapGestureRecognizer(); guardPassTap.Tapped += async(sender, e) => { ToggleButtons(); account = _baseViewModel.GetAccountInformation(); if (account.Properties["Package"] == "Gi") { await Navigation.PushModalAsync(new SearchPage(Album.GiGuardPass)); } else if (account.Properties["Package"] == "NoGi") { await Navigation.PushModalAsync(new SearchPage(Album.NoGiGuardPass)); } else { await Navigation.PushModalAsync(new SearchPage(Album.GuardPass)); } ToggleButtons(); }; guardPassLbl.GestureRecognizers.Add(guardPassTap); guardPassFrame = new Frame { BackgroundColor = Color.FromRgb(58, 93, 174), HasShadow = false, BorderColor = Color.Black, Content = guardPassLbl, Padding = new Thickness(10, 10, 10, 10) }; defenseLbl = new Label { Style = (Style)Application.Current.Resources["common-blue-lbl"], Text = "Defense", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize #endif #if __ANDROID__ FontFamily = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt", FontSize = lblSize * 1.5, FontAttributes = FontAttributes.Bold #endif }; defenseTap = new TapGestureRecognizer(); defenseTap.Tapped += async(sender, e) => { ToggleButtons(); account = _baseViewModel.GetAccountInformation(); if (account.Properties["Package"] == "Gi") { await Navigation.PushModalAsync(new SearchPage(Album.GiDefense)); } else if (account.Properties["Package"] == "NoGi") { await Navigation.PushModalAsync(new SearchPage(Album.NoGiDefense)); } else { await Navigation.PushModalAsync(new SearchPage(Album.Defense)); } ToggleButtons(); }; defenseLbl.GestureRecognizers.Add(defenseTap); defenseFrame = new Frame { BackgroundColor = Color.FromRgb(58, 93, 174), HasShadow = false, BorderColor = Color.Black, Content = defenseLbl, Padding = new Thickness(10, 10, 10, 10) }; backTakeLbl = new Label { Style = (Style)Application.Current.Resources["common-blue-lbl"], Text = "Back Take", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize #endif #if __ANDROID__ FontFamily = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt", FontSize = lblSize * 1.5, FontAttributes = FontAttributes.Bold #endif }; backTakeTap = new TapGestureRecognizer(); backTakeTap.Tapped += async(sender, e) => { ToggleButtons(); account = _baseViewModel.GetAccountInformation(); if (account.Properties["Package"] == "Gi") { await Navigation.PushModalAsync(new SearchPage(Album.GiBackTake)); } else if (account.Properties["Package"] == "NoGi") { await Navigation.PushModalAsync(new SearchPage(Album.NoGiBackTake)); } else { await Navigation.PushModalAsync(new SearchPage(Album.BackTake)); } ToggleButtons(); }; backTakeLbl.GestureRecognizers.Add(backTakeTap); backTakeFrame = new Frame { BackgroundColor = Color.FromRgb(58, 93, 174), HasShadow = false, BorderColor = Color.Black, #if __ANDROID__ Content = backTakeLbl, #endif #if __IOS__ Content = backTakeLbl, #endif Padding = new Thickness(10, 10, 10, 10) }; drillsLbl = new Label { Style = (Style)Application.Current.Resources["common-blue-lbl"], Text = "Drills", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize #endif #if __ANDROID__ FontFamily = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt", FontSize = lblSize * 1.5, FontAttributes = FontAttributes.Bold #endif }; drillsTap = new TapGestureRecognizer(); drillsTap.Tapped += async(object sender, EventArgs e) => { ToggleButtons(); account = _baseViewModel.GetAccountInformation(); if (account.Properties["Package"] == "Gi") { await Navigation.PushModalAsync(new SearchPage(Album.GiDrills)); } else if (account.Properties["Package"] == "NoGi") { await Navigation.PushModalAsync(new SearchPage(Album.NoGiDrills)); } else { await Navigation.PushModalAsync(new SearchPage(Album.Drills)); } ToggleButtons(); }; drillsLbl.GestureRecognizers.Add(drillsTap); drillsFrame = new Frame { BackgroundColor = Color.FromRgb(58, 93, 174), HasShadow = false, BorderColor = Color.Black, Content = drillsLbl, Padding = new Thickness(10, 10, 10, 10) }; //blog objects blogLbl = new Label { Style = (Style)Application.Current.Resources["common-technique-lbl"], Text = "Blog", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", #endif FontSize = lblSize * 2 }; blogTap = new TapGestureRecognizer(); blogTap.Tapped += async(sender, e) => { ToggleButtons(); await Navigation.PushModalAsync(new BlogViewPage()); ToggleButtons(); }; blogLbl.GestureRecognizers.Add(blogTap); blogImage = new Image { Aspect = Aspect.AspectFill, Source = ImageSource.FromFile("blog.jpg") }; blogFrame = new Frame { Content = blogImage, BorderColor = Color.Black, BackgroundColor = Color.Black, HasShadow = false, Padding = 3 }; //Events //adding children stackLayout.Children.Add(sweepFrame); stackLayout.Children.Add(takeDownFrame); stackLayout.Children.Add(submissionFrame); stackLayout.Children.Add(guardPassFrame); stackLayout.Children.Add(defenseFrame); stackLayout.Children.Add(backTakeFrame); stackLayout.Children.Add(drillsFrame); scrollView.Content = stackLayout; #if __ANDROID__ scrollView.IsClippedToBounds = true; #endif innerGrid.Children.Add(scrollView, 0, 0); innerGrid.Children.Add(blogFrame, 0, 1); #if __ANDROID__ innerGrid.Children.Add(androidBlogLbl.ToView(), 0, 1); #endif #if __IOS__ innerGrid.Children.Add(blogLbl, 0, 1); #endif outerGrid.Children.Add(innerGrid, 0, 0); Content = outerGrid; }
public async void SetContent() { account = _baseViewModel.GetAccountInformation(); //add activity indicator while contents load if (hasAccount) { innerGrid.Children.Clear(); activityIndicator.IsRunning = true; innerGrid.Children.Add(activityIndicator, 0, 0); Grid.SetRowSpan(activityIndicator, 6); Grid.SetColumnSpan(activityIndicator, 3); if (_baseViewModel.User == null) { try { user = await _baseViewModel.FindUserByIdAsync(Constants.FINDUSER, account.Properties["Id"]); } catch (KeyNotFoundException ex) { Console.WriteLine(ex.StackTrace); await DisplayAlert("Unknown Error", "There has been an unknown error, please sign in again.", "Ok"); LogOut(); } } if (_baseViewModel.Successful) { activityIndicator.IsRunning = false; #if __IOS__ nameTextLbl.Text = user.Name; emailTextLbl.Text = user.Email; beltTextLbl.Text = user.Belt; userCredentialStack.Children.Add(nameLbl); userCredentialStack.Children.Add(nameTextLbl); userCredentialStack.Children.Add(beltLbl); userCredentialStack.Children.Add(beltTextLbl); userCredentialStack.Children.Add(emailLbl); userCredentialStack.Children.Add(emailTextLbl); //Building Grid innerGrid.Children.Clear(); innerGrid.Children.Add(userCredentialStack, 0, 0); Grid.SetRowSpan(userCredentialStack, 3); innerGrid.Children.Add(packageBtn, 0, 3); innerGrid.Children.Add(contactUsBtn, 0, 4); innerGrid.Children.Add(settingsBtn, 0, 5); innerGrid.Children.Add(logOutBtn, 0, 6); #endif #if __ANDROID__ androidNameLbl.Text = $"{androidNameLbl.Text} {user.Name}"; androidEmailLbl.Text = $"{androidEmailLbl.Text} {user.Email}"; androidBeltLbl.Text = $"{androidBeltLbl.Text} {user.Belt}"; userCredentialStack.Children.Add(contentViewNameLbl); userCredentialStack.Children.Add(contentViewEmailLbl); userCredentialStack.Children.Add(contentViewBeltLbl); //Building Grid innerGrid.Children.Clear(); //innerGrid.Children.Add(userCredentialStack, 0, 0); innerGrid.Children.Add(contentViewNameLbl, 0, 0); innerGrid.Children.Add(contentViewEmailLbl, 0, 1); innerGrid.Children.Add(contentViewBeltLbl, 0, 2); //Grid.SetRowSpan(userCredentialStack, 3); innerGrid.Children.Add(androidPackageBtn.ToView(), 0, 3); innerGrid.Children.Add(androidContactUsBtn.ToView(), 0, 4); innerGrid.Children.Add(androidSettingsBtn.ToView(), 0, 5); innerGrid.Children.Add(androidLogOutBtn.ToView(), 0, 6); #endif } else { LogOut(); } } else { #if __ANDROID__ //Building Grid innerGrid.Children.Clear(); innerGrid.Children.Add(androidPackageBtn.ToView(), 0, 1); innerGrid.Children.Add(androidContactUsBtn.ToView(), 0, 3); innerGrid.Children.Add(androidLoginBtn.ToView(), 0, 4); innerGrid.Children.Add(androidCreateAccountBtn.ToView(), 0, 5); #endif #if __IOS__ innerGrid.Children.Clear(); innerGrid.Children.Add(packageBtn, 0, 1); innerGrid.Children.Add(contactUsBtn, 0, 3); innerGrid.Children.Add(loginBtn, 0, 4); innerGrid.Children.Add(createAccountBtn, 0, 5); #endif } }