Пример #1
0
        private async void cameraBtnClicked(object sender, EventArgs e)
        {
            var action = await DisplayActionSheet("Take or select photo", "Cancel", null, "Take Picture", "Select picture");

            MediaFile m = null;

            switch (action)
            {
            case "Take Picture":
                m = await App.MANAGER.MediaContorller.TakePicture();

                break;

            case "Select picture":
                m = await App.MANAGER.MediaContorller.SelectPicture();

                break;
            }

            if (m == null)
            {
                return;
            }

            IImageProcessing processer = DependencyService.Get <IImageProcessing>();


            Bitmap b = await processer.ScaleBitmap(m.Source, await processer.GetBitmapOptionsOfImageAsync(m.Source), 200, 200);

            image.SetImageBitmap(b);
            pic = processer.compress(b);
            m.Dispose();
        }
Пример #2
0
        protected async override void OnAppearing()
        {
            //disabling add item button if user is not logged in
            if (!App.CredManager.IsLoggedIn())
            {
                donateItem.IsEnabled = false;
            }
            else
            {
                donateItem.IsEnabled = true;
            }

            if (shouldGetChapter)
            {
                if (fbla == null)
                {
                    fbla = await App.MANAGER.YSSI.GetFBLAChapter(myfblaid);

                    populateProfileFields();
                }
            }


            IImageProcessing processer = DependencyService.Get <IImageProcessing>();

            profImg.SetImageBitmap(await processer.ScaleBitmap(fbla.picture, await processer.GetBitmapOptionsOfImageAsync(fbla.picture), 200, 200));
        }
Пример #3
0
        protected override async void OnAppearing()
        {
            IImageProcessing processer = DependencyService.Get <IImageProcessing>();

            profImg.SetImageBitmap(await processer.ScaleBitmap(item.picture, await processer.GetBitmapOptionsOfImageAsync(item.picture), 200, 200));

            if (App.CredManager.IsLoggedIn())
            {
                buyBtn.IsEnabled = true;
                buyBtn.Text      = "Buy Item";
            }
            else
            {
                buyBtn.IsEnabled = false;
                buyBtn.Text      = "Log in to buy Item";
            }
        }
Пример #4
0
        public void populateProfileFields()
        {
            donateItem.Clicked += (s, e) =>
            {
                Navigation.PushAsync(new newItemPage(fbla.id));
            };

            if (App.CredManager.IsLoggedIn())
            {
                int myid = -1;
                int.TryParse(App.CredManager.GetAccountValue("FBLA_chapter_id"), out myid);

                if (fbla.id == myid)                //is part of this chapter
                {
                    if (int.Parse(App.CredManager.GetAccountValue("FBLA_status")) > 4)
                    {
                        ToolbarItems.Add(new ToolbarItem("Settings", "@drawable/book", () =>
                        {
                            Navigation.PushAsync(new pendingMembersPage(fbla.id));
                        }));

                        profImg.GestureRecognizers.Add(new TapGestureRecognizer
                        {
                            Command = new Command(async() =>
                            {
                                var answer = await DisplayAlert("Change Chapter picture", "Would you like to change the Chapters picture?", "Yes", "No");
                                if (answer)
                                {
                                    var action  = await DisplayActionSheet("Take or select photo", "Cancel", null, "Take Picture", "Select picture");
                                    MediaFile m = null;
                                    switch (action)
                                    {
                                    case "Take Picture":
                                        m = await App.MANAGER.MediaContorller.TakePicture();
                                        break;

                                    case "Select picture":
                                        m = await App.MANAGER.MediaContorller.SelectPicture();
                                        break;
                                    }

                                    if (m == null)
                                    {
                                        return;
                                    }

                                    IImageProcessing processer = DependencyService.Get <IImageProcessing>();


                                    Bitmap b = await processer.ScaleBitmap(m.Source, await processer.GetBitmapOptionsOfImageAsync(m.Source), 200, 200);
                                    profImg.SetImageBitmap(b);
                                    App.MANAGER.YSSI.SetFBLAChapterPicture(fbla.id, processer.compress(b));

                                    m.Dispose();
                                }
                            }),
                            NumberOfTapsRequired = 1
                        });
                    }
                }
                if (myid == -1)
                {
                    ToolbarItems.Add(new ToolbarItem("Settings", "@drawable/book", async() =>
                    {
                        bool yes = await DisplayAlert("Apply to join chapter?", "Would you like to apply to join this chapter?", "Yes", "No");
                        if (yes)
                        {
                            bool sucess = await App.MANAGER.YSSI.SetChapterStatusOfUser(0, App.CredManager.GetAccountValue("G_id"));
                            if (sucess)
                            {
                                DisplayAlert("You have applied.", "You have applied to join this chapter. Once an administrator has accepted you you will be a part of " + fbla.school + " FBLA.", "OK");
                            }
                        }
                    }));
                }
            }

            baseStack        = makeGUI();
            Title            = fbla.school + " FBLA";
            lblSchool.Text   = fbla.school;
            lblLocation.Text = fbla.city + ", " + fbla.state;



            Content = baseStack;
        }
Пример #5
0
        public fblaChapterListView()
        {
            SeparatorColor = Constants.palette.divider;
            Label schoolLabel = null;
            Label locLabel    = null;

            // Source of data items.
            VerticalOptions   = LayoutOptions.FillAndExpand;
            HorizontalOptions = LayoutOptions.FillAndExpand;

            RowHeight = 75;
            // Define template for displaying each item.
            // (Argument of DataTemplate constructor is called for
            //      each item; it must return a Cell derivative.)
            ItemTemplate = new DataTemplate(() =>
            {
                // Create views with bindings for displaying each property.
                schoolLabel = new Label {
                    FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
                };
                locLabel = new Label();
                schoolLabel.SetBinding(Label.TextProperty, "school");

                imageView = new CustomImageView
                {
                    HeightRequest = 75,
                    WidthRequest  = 75,
                };


                // Return an assembled ViewCell.
                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(5, 5, 5, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            imageView,
                            new StackLayout
                            {
                                //VerticalOptions = LayoutOptions.Center,
                                Spacing = 5,
                                Children =
                                {
                                    schoolLabel,
                                    locLabel,
                                }
                            }
                        }
                    }
                });
            });

            this.ItemSelected += ((sender, eventArgs) =>
            {
                if (this.SelectedItem != null)
                {
                    var c = SelectedItem as myDataTypes.fblaChapter;
                    var chapterView = new fblaChapterPage(c);
                    this.SelectedItem = null;
                    Navigation.PushAsync(chapterView);
                }
            });

            ItemAppearing += async(s, e) =>
            {
                if (e.Item == null)
                {
                    return;
                }

                myDataTypes.fblaChapter i = e.Item as myDataTypes.fblaChapter;


                locLabel.Text    = i.city + ", " + i.state;
                schoolLabel.Text = i.school;

                IImageProcessing processer = DependencyService.Get <IImageProcessing>();
                imageView.SetImageBitmap(await processer.ScaleBitmap(i.picture, await processer.GetBitmapOptionsOfImageAsync(i.picture), 200, 200));
            };
        }
Пример #6
0
        public itemListView()
        {
            SeparatorColor = Constants.palette.divider;

            Label           conditionLabel = null;
            Label           priceLabel     = null;
            CustomImageView imageView      = null;

            // Source of data items.

            RowHeight = 80;
            // Define template for displaying each item.
            // (Argument of DataTemplate constructor is called for
            //      each item; it must return a Cell derivative.)
            ItemTemplate = new DataTemplate(() =>
            {
                // Create views with bindings for displaying each property.
                Label nameLabel = new Label()
                {
                    LineBreakMode = LineBreakMode.TailTruncation
                }, descLabel = new Label()
                {
                    LineBreakMode = LineBreakMode.TailTruncation
                };
                priceLabel     = new Label();
                conditionLabel = new Label();
                nameLabel.SetBinding(Label.TextProperty, "name");
                descLabel.SetBinding(Label.TextProperty, "description");



                //&#9734
                imageView = new CustomImageView
                {
                    HeightRequest = 100,
                    WidthRequest  = 100,
                };

                // Return an assembled ViewCell.
                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(5, 5, 5, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            imageView,
                            new StackLayout
                            {
                                VerticalOptions = LayoutOptions.Center,
                                //Spacing = 0,
                                Children =
                                {
                                    nameLabel,
                                    descLabel,
                                    new StackLayout {
                                        //Spacing = 0,
                                        Orientation = StackOrientation.Horizontal,
                                        Children =
                                        {
                                            priceLabel,
                                            conditionLabel
                                        }
                                    }
                                }
                            }
                        }
                    }
                });
            });

            ItemAppearing += async(s, e) =>
            {
                myDataTypes.item item = e.Item as myDataTypes.item;
                //formatting price to money
                CultureInfo culture = new CultureInfo("en-us");
                culture.NumberFormat.CurrencyNegativePattern = 1;

                priceLabel.Text = string.Format(culture, "{0:c2}", item.price);

                //giving stars to rating
                string st = "";
                for (int i = 0; i < item.quality; i++)
                {
                    st += "\u2605";
                }
                conditionLabel.Text = st;

                IImageProcessing processer = DependencyService.Get <IImageProcessing>();
                imageView.SetImageBitmap(await processer.ScaleBitmap(item.picture, await processer.GetBitmapOptionsOfImageAsync(item.picture), 200, 200));
            };

            this.ItemSelected += ((sender, eventArgs) =>
            {
                if (this.SelectedItem != null)
                {
                    var itemView = new itemPage(SelectedItem as myDataTypes.item);

                    this.SelectedItem = null;
                    Navigation.PushAsync(itemView);
                }
            });
        }