コード例 #1
0
        private void InspoGrid_Clicked(object sender, EventArgs e)
        {
            btnInspoGrid.FontFamily  = "Lato-Bold.ttf#Lato-Bold";
            btnCollection.FontFamily = "Lato-Light.ttf#Lato-Light";



            int row    = 4;
            int column = 0;

            for (int i = _userCollection.Count() + 4; i > 4; i--)
            {
                ProfileGrid.Children.RemoveAt(i);
            }

            for (int i = 0; i < _userPhotos.Count(); i++)
            {
                if (column < 1)
                {
                    var userInspoObject = new CachedImage {
                        Source = _userPhotos[i].URL, WidthRequest = 145, HeightRequest = 145, DownsampleHeight = 145, DownsampleWidth = 145, LoadingPlaceholder = "placeholder.png", VerticalOptions = LayoutOptions.StartAndExpand
                    };

                    Inspo obj         = _userPhotos[i];
                    var   tappedInspo = new TapGestureRecognizer();
                    tappedInspo.Tapped += (s, et) =>
                    {
                        UserInspoImageTapped(obj);
                    };
                    userInspoObject.GestureRecognizers.Add(tappedInspo);

                    ProfileGrid.Children.Add(userInspoObject, 0, 5, row, row + 1);
                    column++;
                }
                else if (column == 1)
                {
                    var userInspoObject = new CachedImage {
                        Source = _userPhotos[i].URL, WidthRequest = 145, HeightRequest = 145, DownsampleHeight = 145, DownsampleWidth = 145, LoadingPlaceholder = "placeholder.png", VerticalOptions = LayoutOptions.StartAndExpand
                    };

                    Inspo obj         = _userPhotos[i];
                    var   tappedInspo = new TapGestureRecognizer();
                    tappedInspo.Tapped += (s, et) =>
                    {
                        UserInspoImageTapped(obj);
                    };
                    userInspoObject.GestureRecognizers.Add(tappedInspo);

                    ProfileGrid.Children.Add(userInspoObject, 5, 10, row, row + 1);
                    column = 0;
                    row++;
                }
                else
                {
                    DisplayAlert("Error", "Something went wrong with loading userphotos", "OK");
                }
            }
        }
コード例 #2
0
        public CommentsPage(Inspo obj)
        {
            InitializeComponent();

            var navigationPage = Application.Current.MainPage as NavigationPage;

            navigationPage.BarBackgroundColor = Color.White;
            navigationPage.BarTextColor       = Color.Black;


            _obj = obj;


            _comments = new ObservableCollection <Comment>(_obj.Comments);
            listviewComments.ItemsSource = _comments;
        }
コード例 #3
0
        public ShowProductsPage(Inspo obj)
        {
            InitializeComponent();

            var navigationPage = Application.Current.MainPage as NavigationPage;

            navigationPage.BarBackgroundColor = Color.White;
            navigationPage.BarTextColor       = Color.Black;

            _obj = obj;

            productsList = new ObservableCollection <string>(_obj.ProductsUsed);
            listviewProducts.ItemsSource = productsList;

            if (productsList.Count() == 0)
            {
                NoAddedProducts.Text = "The user did not add any products for this Inspo :(";
            }
        }
コード例 #4
0
        public ImagePage(Inspo obj)
        {
            InitializeComponent();
            Obj = obj;

            var navigationPage = Application.Current.MainPage as NavigationPage;

            navigationPage.BarBackgroundColor = Color.White;
            navigationPage.BarTextColor       = Color.Black;

            this.BindingContext = Obj;

            lblUsernameText.Text = lblUsernameText.Text.ToUpper();
            lblShowComments.Text = "Show all " + obj.Comments.Length + " comments.";

            if (Obj.UserId != MainUser.MainUserID.ID)
            {
                if (this.ToolbarItems.Count > 0)
                {
                    this.ToolbarItems.Clear();
                }
            }
        }
コード例 #5
0
 private async void UserInspoImageTapped(Inspo i)
 {
     await Navigation.PushAsync(new ImagePage(i));
 }
コード例 #6
0
        public void GridCreation()
        {
            try
            {
                for (int MyCount = 0; MyCount < _userPhotos.Count() / 2; MyCount++)
                {
                    ProfileGrid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(150, GridUnitType.Absolute)
                    });
                }



                //set row and columns => column to 1 since AddInspoBtn should always be at position 0,0
                int row    = 4;
                int column = 0;



                for (int i = 0; i < _userPhotos.Count(); i++)
                {
                    if (column < 1)
                    {
                        var userInspoObject = new CachedImage {
                            Source = _userPhotos[i].URL, WidthRequest = 145, HeightRequest = 145, DownsampleHeight = 145, DownsampleWidth = 145, LoadingPlaceholder = "placeholder.png", VerticalOptions = LayoutOptions.StartAndExpand
                        };

                        Inspo obj         = _userPhotos[i];
                        var   tappedInspo = new TapGestureRecognizer();
                        tappedInspo.Tapped += (s, et) =>
                        {
                            UserInspoImageTapped(obj);
                        };
                        userInspoObject.GestureRecognizers.Add(tappedInspo);

                        ProfileGrid.Children.Add(userInspoObject, 0, 5, row, row + 1);
                        column++;
                    }
                    else if (column == 1)
                    {
                        var userInspoObject = new CachedImage {
                            Source = _userPhotos[i].URL, WidthRequest = 145, HeightRequest = 145, DownsampleHeight = 145, DownsampleWidth = 145, LoadingPlaceholder = "placeholder.png", VerticalOptions = LayoutOptions.StartAndExpand
                        };

                        Inspo obj         = _userPhotos[i];
                        var   tappedInspo = new TapGestureRecognizer();
                        tappedInspo.Tapped += (s, et) =>
                        {
                            UserInspoImageTapped(obj);
                        };
                        userInspoObject.GestureRecognizers.Add(tappedInspo);

                        ProfileGrid.Children.Add(userInspoObject, 5, 10, row, row + 1);
                        column = 0;
                        row++;
                    }
                    else
                    {
                        DisplayAlert("Error", "Something went wrong with loading userphotos", "OK");
                    }
                }
                //Inspos are now loaded and grid does not need to update gridrows
            }
            catch (Exception ex)
            {
                try
                {
                    Insights.Report(ex);
                    DisplayAlert("Dammit", "I'm not ready to upload an inspo. Like, emotionally, you know?", "*Takes a deep breath*");
                }
                catch
                {
                    DisplayAlert("Dammit", "I'm not ready to upload an inspo. Like, emotionally, you know?", "*Counting backwards from 10*");
                }
            }
        }
コード例 #7
0
        public ReportPage(Inspo objInspoReported)
        {
            InitializeComponent();

            _objInspoReported = objInspoReported;
        }
コード例 #8
0
        private async void Collection_Clicked(object sender, EventArgs e)
        {
            for (int i = _userPhotos.Count() + 6; i > 6; i--)
            {
                ProfileGrid.Children.RemoveAt(i);
            }

            var content_p = await _client.GetStringAsync(url_user_collection + MainUser.MainUserID.ID);

            var user_obj = JsonConvert.DeserializeObject <List <Inspo> >(content_p);

            _userCollection = new ObservableCollection <Inspo>(user_obj);

            btnInspoGrid.FontFamily  = SetLightFont();
            btnCollection.FontFamily = SetBoldFont();

            int row    = 4;
            int column = 0;

            for (int i = 0; i < _userCollection.Count(); i++)
            {
                if (column < 1)
                {
                    var userInspoObject = new CachedImage {
                        Source = _userCollection[i].URL, WidthRequest = 145, HeightRequest = 145, DownsampleHeight = 145, DownsampleWidth = 145, LoadingPlaceholder = "placeholder.png", VerticalOptions = LayoutOptions.StartAndExpand
                    };

                    Inspo obj         = _userCollection[i];
                    var   tappedInspo = new TapGestureRecognizer();
                    tappedInspo.Tapped += (s, ex) =>
                    {
                        UserInspoImageTapped(obj);
                    };
                    userInspoObject.GestureRecognizers.Add(tappedInspo);

                    ProfileGrid.Children.Add(userInspoObject, 0, 5, row, row + 1);
                    column++;
                }
                else if (column == 1)
                {
                    var userInspoObject = new CachedImage {
                        Source = _userCollection[i].URL, WidthRequest = 145, HeightRequest = 145, DownsampleHeight = 145, DownsampleWidth = 145, LoadingPlaceholder = "placeholder.png", VerticalOptions = LayoutOptions.StartAndExpand
                    };

                    Inspo obj         = _userCollection[i];
                    var   tappedInspo = new TapGestureRecognizer();
                    tappedInspo.Tapped += (s, ex) =>
                    {
                        UserInspoImageTapped(obj);
                    };
                    userInspoObject.GestureRecognizers.Add(tappedInspo);

                    ProfileGrid.Children.Add(userInspoObject, 5, 10, row, row + 1);
                    column = 0;
                    row++;
                }
                else
                {
                    await DisplayAlert("Error", "Something went wrong with loading Collection", "OK");
                }
            }
        }