コード例 #1
0
        public FloatingActionButtonViewModel(INavigation nav)
        {
            fab = new FloatingActionButtonView()
            {
                ImageName    = "plus",
                ColorNormal  = Color.CadetBlue,
                ColorPressed = Color.White,
                ColorRipple  = Color.LightBlue,
                Clicked      = async(sender, args) =>
                {
                    fab.Hide();
                    //var masterPage = pg;
                    await Task.Delay(1500);

                    await nav.PushPopupAsync(new AddNewSubjectPopUp());

                    fab.Show();
                    //await masterPage.Navigation.PushAsync(new NavigationPage(pg));
                },
                IsEnabled         = true,
                IsVisible         = true,
                IsPlatformEnabled = true
            };
            absolute = new AbsoluteLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Nav = nav;
        }
コード例 #2
0
        public CustomChartPage()
        {
            chartService   = new CustomCharts.Services.ChartController();
            pageLayout     = new StackLayout();
            absolutelayout = new AbsoluteLayout();
            lView          = InitializeListView();
            floatingButton = InitializeFloatingButton();

            this.Icon = new FileImageSource {
                File = "ic_pie_chart_black_24dp.png"
            };
            this.Title   = "My Charts";
            this.Content = absolutelayout;

            UpdateLayout();
            AbsoluteLayout.SetLayoutFlags(pageLayout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(pageLayout, new Rectangle(0f, 0f, 1f, 1f));

            absolutelayout.HorizontalOptions = LayoutOptions.FillAndExpand;
            absolutelayout.VerticalOptions   = LayoutOptions.FillAndExpand;
            absolutelayout.Children.Add(pageLayout);
            absolutelayout.Children.Add(floatingButton);

            chartService.Charts.CollectionChanged += CollectionCustomChart_CollectionChanged;
        }
        public PersonalChartsPage()
        {
            InitializeComponent();

            pageLayout     = new StackLayout();
            absolutelayout = new AbsoluteLayout();
            lView          = InitializeListView();
            navBar         = new NavigationBarViewModel(lView, new List <Models.ItemsListView>(), master);
            floatingButton = InitializeFloatingButton();

            this.Icon = new FileImageSource {
                File = "ic_pie_chart_black_24dp.png"
            };
            this.Title   = "My Charts";
            this.Content = absolutelayout;

            pageLayout.Children.Add(navBar);
            UpdateLayout();
            AbsoluteLayout.SetLayoutFlags(pageLayout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(pageLayout, new Rectangle(0f, 0f, 1f, 1f));

            absolutelayout.HorizontalOptions = LayoutOptions.FillAndExpand;
            absolutelayout.VerticalOptions   = LayoutOptions.FillAndExpand;
            absolutelayout.Children.Add(pageLayout);
            absolutelayout.Children.Add(floatingButton);
        }
コード例 #4
0
        private void InitFAB()
        {
            fab = new FloatingActionButtonView()
            {
                ImageName    = "ic_add.png",
                ColorNormal  = Color.FromHex("ff3498db"),
                ColorPressed = Color.Black,
                ColorRipple  = Color.FromHex("ff3498db"),
                Clicked      = OnAddButtonClicked
            };

            // Overlay the FAB in the bottom-right corner
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            absoluteLayout.Children.Add(fab);
        }
コード例 #5
0
        private FloatingActionButtonView InitializeFloatingButton()
        {
            FloatingActionButtonView floatingButton = new FloatingActionButtonView();
            EntryPopup entryPopup = new EntryPopup();

            entryPopup.SetOnBackButtonPressed(floatingButton);
            entryPopup.SetOnAppearing(floatingButton);

            floatingButton.ColorNormal  = Color.FromRgb(33, 150, 243);
            floatingButton.ColorPressed = floatingButton.ColorNormal.AddLuminosity(0.1);
            floatingButton.ColorRipple  = floatingButton.ColorNormal.AddLuminosity(0.2);
            floatingButton.ImageName    = "ic_add.png";
            AbsoluteLayout.SetLayoutFlags(floatingButton, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(floatingButton, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            return(floatingButton);
        }
コード例 #6
0
        async void DroidLayout(View mainView)
        {
            if (this.Content is AbsoluteLayout)
            {
                await(this.Content as AbsoluteLayout).Children[0].FadeTo(0, (uint)Integers.AnimationSpeed, Easing.SinIn);
                (this.Content as AbsoluteLayout).Children.RemoveAt(0);
                AbsoluteLayout.SetLayoutFlags(mainView, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(mainView, new Rectangle(0f, 0f, 1f, 1f));
                (this.Content as AbsoluteLayout).Children.Insert(0, mainView);
                mainView.Opacity = 0;
                await mainView.FadeTo(1, (uint)Integers.AnimationSpeed, Easing.SinIn);

                return;
            }

            fab = new FloatingActionButtonView
            {
                ImageName    = League.IsFavorite ? "ic_favorite_white" : "ic_favorite_border_white",
                ColorNormal  = Color.FromHex("009688"),
                ColorPressed = Color.FromHex("80CBC4"),
                ColorRipple  = Color.FromHex("E0F2F1"),
                Clicked      = (sender, args) => FabAction(),
            };

            absoluteAndroid = new AbsoluteLayout
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            // Position the pageLayout to fill the entire screen.
            // Manage positioning of child elements on the page by editing the pageLayout.
            AbsoluteLayout.SetLayoutFlags(mainView, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(mainView, new Rectangle(0f, 0f, 1f, 1f));
            absoluteAndroid.Children.Add(mainView);

            // Overlay the FAB in the bottom-right corner
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            absoluteAndroid.Children.Add(fab);

            Content = absoluteAndroid;
            await mainView.FadeTo(1, (uint)Integers.AnimationSpeed, Easing.SinIn);
        }
コード例 #7
0
        public async void Invoke(FloatingActionButtonView sender)
        {
            View hideMe = null;
            View showMe = null;

            if (Target != null)
            {
                // Find showMe based on property set in xaml
                showMe = ((View)sender.Parent.Parent).FindByName <View>(Target);
                if (showMe != null)
                {
                    // Find hideMe based on property set in xaml
                    if (Source != null)
                    {
                        hideMe = ((View)sender.Parent.Parent).FindByName <View>(Source);
                        if (hideMe != null)
                        {
                            await PerformAnimation(hideMe, showMe);
                        }
                    }
                }
            }
        }
コード例 #8
0
        // Crea el floatingButton y le añade las características básicas
        private FloatingActionButtonView InitializeFloatingButton()
        {
            FloatingActionButtonView floatingButton = new FloatingActionButtonView();
            EntryPopup entryPopup = new EntryPopup();

            entryPopup.SetOnBackButtonPressed(floatingButton);
            entryPopup.SetOnAppearing(floatingButton);

            floatingButton.ColorNormal  = Color.FromRgb(33, 150, 243);
            floatingButton.ColorPressed = floatingButton.ColorNormal.AddLuminosity(0.1);
            floatingButton.ColorRipple  = floatingButton.ColorNormal.AddLuminosity(0.2);
            floatingButton.Clicked      = async(sender, args) =>
            {
                //var animate = await this.DisplayAlert("Fab", "Hide and show the Fab?", "Sure", "Not now");
                //if (!animate) return;

                entryPopup.Display(chartService, _master.GetNavigationPage);
            };
            floatingButton.ImageName = "ic_add.png";
            AbsoluteLayout.SetLayoutFlags(floatingButton, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(floatingButton, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            return(floatingButton);
        }
コード例 #9
0
        public CustomerOrdersPage()
        {
            #region toolbar items
            if (Device.OS != TargetPlatform.Android)
            {
                ToolbarItems.Add(new ToolbarItem
                {
                    Text    = "Add",
                    Icon    = "add.png",
                    Command = new Command(AddNewOrderTapped)
                });
            }
            #endregion
            #region activity indicator
            ActivityIndicator activityIndicator = new ActivityIndicator()
            {
                HeightRequest = Sizes.LargeRowHeight
            };
            activityIndicator.SetBinding(IsEnabledProperty, "IsBusy");
            activityIndicator.SetBinding(IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            #endregion

            #region header
            Label companyTitleLabel = new Label()
            {
                Text          = TextResources.Customers_Orders_EditOrder_CompanyTitle,
                TextColor     = Palette._007,
                FontSize      = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                XAlign        = TextAlignment.Start,
                YAlign        = TextAlignment.End,
                LineBreakMode = LineBreakMode.TailTruncation
            };

            Label companyNameLabel = new Label()
            {
                TextColor     = Palette._006,
                FontSize      = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                XAlign        = TextAlignment.Start,
                YAlign        = TextAlignment.Start,
                LineBreakMode = LineBreakMode.TailTruncation
            };
            companyNameLabel.SetBinding(Label.TextProperty, "Account.Company");

            Image addNewOrderImage = new Image()
            {
                Aspect = Aspect.AspectFit
            };
            Device.OnPlatform(
                iOS: () => addNewOrderImage.Source = new FileImageSource()
            {
                File = "add_ios_blue"
            },
                Android: () => addNewOrderImage.Source = new FileImageSource()
            {
                File = "add_android_blue"
            }
                );
            addNewOrderImage.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(AddNewOrderTapped),
                NumberOfTapsRequired = 1
            });

            addNewOrderImage.IsVisible = Device.OS != TargetPlatform.Android;

            AbsoluteLayout headerAbsoluteLayout = new AbsoluteLayout()
            {
                HeightRequest = Sizes.LargeRowHeight
            };

            headerAbsoluteLayout.Children.Add(
                view: new UnspacedStackLayout()
            {
                Children =
                {
                    companyTitleLabel,
                    companyNameLabel
                }
            },
                bounds: new Rectangle(0, .5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize),
                flags: AbsoluteLayoutFlags.PositionProportional
                );

            headerAbsoluteLayout.Children.Add(
                view: addNewOrderImage,
                bounds: new Rectangle(1, .5, AbsoluteLayout.AutoSize, Device.OnPlatform(.5, .4, .5)),
                flags: AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.HeightProportional
                );

            ContentView headerLabelsView = new ContentView()
            {
                Content = headerAbsoluteLayout, Padding = new Thickness(20, 0)
            };

            headerLabelsView.SetBinding(IsVisibleProperty, "IsBusy", converter: new InverseBooleanConverter());
            headerLabelsView.SetBinding(IsEnabledProperty, "IsBusy", converter: new InverseBooleanConverter());
            #endregion

            #region order list view
            var customerOrderListView = new CustomerOrderListView()
            {
                IsGroupingEnabled = true
            };
            customerOrderListView.GroupDisplayBinding = new Binding("Key");
            customerOrderListView.GroupHeaderTemplate = new DataTemplate(typeof(CustomerOrderListViewGroupHeaderCell));
            customerOrderListView.SetBinding(ListView.ItemsSourceProperty, "OrderGroups");
            customerOrderListView.SetBinding(IsVisibleProperty, "IsBusy", converter: new InverseBooleanConverter());
            customerOrderListView.SetBinding(IsEnabledProperty, "IsBusy", converter: new InverseBooleanConverter());

            customerOrderListView.ItemTapped += async(sender, e) =>
            {
                var order = (Order)e.Item;
                await Navigation.PushAsync(new CustomerOrderDetailPage()
                {
                    BindingContext = new OrderDetailViewModel(ViewModel.Account, order)
                    {
                        Navigation = Navigation
                    },
                });
            };
            #endregion

            #region compose view hierarchy
            var stack = new UnspacedStackLayout()
            {
                Children =
                {
                    activityIndicator,
                    customerOrderListView
                }
            };

            if (Device.OS == TargetPlatform.Android)
            {
                var fab = new FloatingActionButtonView
                {
                    ImageName    = "fab_add.png",
                    ColorNormal  = Palette._001,
                    ColorPressed = Palette._002,
                    ColorRipple  = Palette._001,
                    Clicked      = (sender, args) =>
                                   AddNewOrderTapped(),
                };

                var absolute = new AbsoluteLayout
                {
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                // Position the pageLayout to fill the entire screen.
                // Manage positioning of child elements on the page by editing the pageLayout.
                AbsoluteLayout.SetLayoutFlags(stack, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(stack, new Rectangle(0f, 0f, 1f, 1f));
                absolute.Children.Add(stack);

                // Overlay the FAB in the bottom-right corner
                AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                absolute.Children.Add(fab);

                Content = absolute;
            }
            else
            {
                Content = stack;
            }
            #endregion
        }
コード例 #10
0
        public SalesDashboardPage()
        {
            _AuthenticationService = DependencyService.Get <IAuthenticationService>();

            this.SetBinding(Page.TitleProperty, new Binding()
            {
                Source = TextResources.Sales
            });

            #region sales chart view
            var salesChartView = new SalesDashboardChartView()
            {
                BindingContext = _SalesDashboardChartViewModel = new SalesDashboardChartViewModel()
            };

            #endregion

            #region leads view
            var leadsView = new LeadsView {
                BindingContext = _SalesDashboardLeadsViewModel = new SalesDashboardLeadsViewModel(new Command(PushTabbedLeadPageAction))
            };
            #endregion

            _ScrollView = new ScrollView
            {
                Content = new StackLayout
                {
                    Spacing  = 0,
                    Children =
                    {
                        salesChartView,
                        leadsView
                    }
                }
            };

            #region compose view hierarchy
            if (Device.OS == TargetPlatform.Android)
            {
                _Fab = new FloatingActionButtonView
                {
                    ImageName    = "fab_add.png",
                    ColorNormal  = Palette._001,
                    ColorPressed = Palette._002,
                    ColorRipple  = Palette._001,
                    Clicked      = (sender, args) =>
                                   _SalesDashboardLeadsViewModel.PushTabbedLeadPageCommand.Execute(null),
                };

                var absolute = new AbsoluteLayout
                {
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                // Position the pageLayout to fill the entire screen.
                // Manage positioning of child elements on the page by editing the pageLayout.
                AbsoluteLayout.SetLayoutFlags(_ScrollView, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(_ScrollView, new Rectangle(0f, 0f, 1f, 1f));
                absolute.Children.Add(_ScrollView);

                // Overlay the FAB in the bottom-right corner
                AbsoluteLayout.SetLayoutFlags(_Fab, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(_Fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                absolute.Children.Add(_Fab);

                Content = absolute;
            }
            else
            {
                ToolbarItems.Add(new ToolbarItem("Add", "add_ios_gray", () =>
                                                 _SalesDashboardLeadsViewModel.PushTabbedLeadPageCommand.Execute(null)));

                Content = _ScrollView;
            }
            #endregion

            #region wire up MessagingCenter
            // Catch the login success message from the MessagingCenter.
            // This is really only here for Android, which doesn't fire the OnAppearing() method in the same way that iOS does (every time the page appears on screen).
            Device.OnPlatform(Android: () => MessagingCenter.Subscribe <SplashPage>(this, MessagingServiceConstants.AUTHENTICATED, sender => OnAppearing()));
            #endregion
        }
コード例 #11
0
        private AbsoluteLayout initLayout5_risultatoGiorni()
        {
            fab5 = new FloatingActionButtonView()
            {
                ImageName    = "ic_sharee.png",
                ColorNormal  = ColorHelper.Blue500,
                ColorPressed = ColorHelper.Blue900,
                ColorRipple  = ColorHelper.Blue500,
                Size         = FloatingActionButtonSize.Normal,
                Clicked      = (sender, args) =>
                {
                    share5();
                }
            };

            var lblOrario = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Medium, this),
                Text              = "Ecco l'elenco dei corsi suggeriti!",
                TextColor         = ColorHelper.Green500,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            //var lblLaurea = new Label()
            //{
            //    FontSize = Device.GetNamedSize(NamedSize.Medium, this),
            //    TextColor = ColorHelper.DarkBlue,
            //    HorizontalOptions = LayoutOptions.CenterAndExpand
            //};
            //lblLaurea.SetBinding(Label.TextProperty, "LaureaString");

            //var lblAnno = new Label()
            //{
            //    FontSize = Device.GetNamedSize(NamedSize.Medium, this),
            //    TextColor = ColorHelper.DarkBlue,
            //    HorizontalOptions = LayoutOptions.CenterAndExpand
            //};
            //lblAnno.SetBinding(Label.TextProperty, "AnnoSemestre");

            _lvGiorni = new ListView()
            {
                //SCHERMATA DIVISA PER CORSO
                //HasUnevenRows = true,
                //VerticalOptions = LayoutOptions.FillAndExpand,
                //SeparatorColor = Color.Transparent,
                //ItemTemplate = new DataTemplate(typeof(OrarioComplCell))

                //SCHERMATA DIVISA PER GIORNO
                ItemTemplate        = new DataTemplate(typeof(OrarioComplCellGroup)),
                HasUnevenRows       = true,
                IsGroupingEnabled   = true,
                GroupDisplayBinding = new Binding("Key"),
            };

            //lv.ItemSelected += (sender, e) => {
            //    ((ListView)sender).SelectedItem = null;
            //};

            //            lv.ItemSelected += lv_ItemSelected;

            //var searchbar = new SearchBar()
            //{
            //    Placeholder = "Cerca",
            //    VerticalOptions = LayoutOptions.EndAndExpand,
            //    HorizontalOptions = LayoutOptions.FillAndExpand,
            //};
            //searchbar.TextChanged += searchbar_TextChanged;


            //var l = new StackLayout()
            //{
            //    BackgroundColor = ColorHelper.White,
            //    Padding = new Thickness(15, 10, 15, 10),
            //    Spacing = 5,
            //    Children = { lblOrario } //, lblLaurea, lblAnno }
            //};
            var layout = new StackLayout()
            {
                Padding     = new Thickness(15, 10, 15, 10),
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    //l,
                    lblOrario,
                    _lvGiorni,
                    //new StackLayout(){ Children = {searchbar}, BackgroundColor = Color.White}
                }
            };

            //tbiShowFav = new ToolbarItem("Mostra preferiti", "ic_nostar.png", showFavourites, 0, 0);
            //tbiShowAll = new ToolbarItem("Mostra tutti", "ic_star.png", showAll, 0, 0);
            //			tbiShare = new ToolbarItem ("Share", "ic_next.png", share, 0, 1);

            //if (Settings.SuccessLogin)
            //    ToolbarItems.Add(tbiShowFav);

            var absolute = new AbsoluteLayout()
            {
                //Padding = new Thickness(10, 10, 10, 10),
                BackgroundColor   = ColorHelper.WhiteSmokeDark,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            // Position the pageLayout to fill the entire screen.
            // Manage positioning of child elements on the page by editing the pageLayout.
            AbsoluteLayout.SetLayoutFlags(layout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(layout, new Rectangle(0f, 0f, 1f, 1f));
            absolute.Children.Add(layout);

            // Overlay the FAB in the bottom-right corner
            AbsoluteLayout.SetLayoutFlags(fab5, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab5, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            absolute.Children.Add(fab5);

            return(absolute);
            //return layout;
        }
コード例 #12
0
        private void CreateLayout()
        {
            var imgUser = new CachedImage
            {
                HeightRequest      = 85,
                WidthRequest       = 85,
                Aspect             = Aspect.AspectFit,
                LoadingPlaceholder = "http://www.appleyardpress.com/assets/img/ui/image-placeholder.png",
                Source             = "http://www.appleyardpress.com/assets/img/ui/image-placeholder.png",
                Transformations    = new List <FFImageLoading.Work.ITransformation> {
                    new CircleTransformation(0, App.StyleKit.PrimaryColor.ToString())
                }
            };

            imgUser.SetBinding(CachedImage.SourceProperty, Binding.Create <UserDetailViewModel>(o => o.SelectedUser.ImageUri));

            var username = new Label
            {
                Text           = "User Name",
                TextColor      = App.StyleKit.TextColorPrimaryLight,
                FontAttributes = FontAttributes.Bold,
                FontSize       = 18,
            };

            username.SetBinding(Label.TextProperty, Binding.Create <UserDetailViewModel>(o => o.SelectedUser.Name));

            var email = new Label
            {
                Text           = "email",
                TextColor      = App.StyleKit.TextColorPrimaryLight,
                FontAttributes = FontAttributes.Bold,
            };

            email.SetBinding(Label.TextProperty, Binding.Create <UserDetailViewModel>(o => o.SelectedUser.Email));


            var data = new StackLayout
            {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Children        =
                {
                    username,
                    email
                }
            };

            var headerLayout = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = App.StyleKit.PrimaryColor,
                Padding           = 8,
                Spacing           = 10,
                Children          =
                {
                    imgUser, data
                }
            };

            var header = new ContentView
            {
                Content = headerLayout,
            };

            var label = new Label
            {
                Text           = "Description",
                FontAttributes = FontAttributes.Bold,
                FontSize       = 18,
                TextColor      = App.StyleKit.PrimaryTextColor
            };

            var description = new Label
            {
                TextColor = App.StyleKit.SecondaryTextColor
            };

            description.SetBinding(Label.TextProperty, Binding.Create <UserDetailViewModel>(o => o.SelectedUser.Description));

            var layoutDescUser = new StackLayout
            {
                Padding  = 8,
                Spacing  = 10,
                Children =
                {
                    label,
                    description
                }
            };


            ToolbarItem sendEmail = new ToolbarItem
            {
                Text = "Send email",
                Icon = "ic_email_white_24dp"
            };

            sendEmail.SetBinding(ToolbarItem.CommandProperty, Binding.Create <UserDetailViewModel>(o => o.SendEmailCommand));

            ToolbarItem address = new ToolbarItem
            {
                Text = "Address",
                Icon = "ic_location_on_white_24dp"
            };

            address.SetBinding(ToolbarItem.CommandProperty, Binding.Create <UserDetailViewModel>(o => o.FindLocationCommand));
            ToolbarItems.Add(address);
            ToolbarItems.Add(sendEmail);

            var fab = new FloatingActionButtonView
            {
                Icon = "ic_phone_white_24dp",
            };

            fab.Clicked += (s, e) =>
            {
                vm.CallCommand.Execute(null);
            };
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            var stackFab = new StackLayout
            {
                Padding  = new Thickness(250, 55, 0, 0),
                Children =
                {
                    fab
                }
            };

            var content = new StackLayout
            {
                Children =
                {
                    header,
                    layoutDescUser
                }
            };

            AbsoluteLayout.SetLayoutFlags(content, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(content, new Rectangle(0f, 0f, 1f, 1f));

            Content = new AbsoluteLayout
            {
                Children =
                {
                    content,
                    stackFab,
                }
            };
        }
コード例 #13
0
 public void SetOnAppearing(FloatingActionButtonView view)
 {
     onAppearingActionElement = view;
 }
コード例 #14
0
        private View getView()
        {
            var fab = new FloatingActionButtonView()
            {
                ImageName    = "ic_sharee.png",
                ColorNormal  = ColorHelper.Blue500,
                ColorPressed = ColorHelper.Blue900,
                ColorRipple  = ColorHelper.Blue500,
                Size         = FloatingActionButtonSize.Normal,
                Clicked      = (sender, args) =>
                {
                    share();
                }
            };

            fab.SetBinding(Label.IsVisibleProperty, new Binding("ListaLezioni", converter: new IsINVisibleCountConverter()));
//            _lblDay = new Label()
//            {
//                FontSize = Device.GetNamedSize(NamedSize.Small, this),
//                FontAttributes = Xamarin.Forms.FontAttributes.Bold,
//                HorizontalOptions = LayoutOptions.EndAndExpand,
//            };
//            _lblDay.SetBinding(Label.TextProperty, "Day");
//
//            _lblDate = new Label()
//            {
//                FontSize = Device.GetNamedSize(NamedSize.Small, this),
//                FontAttributes = Xamarin.Forms.FontAttributes.Bold,
//                HorizontalOptions = LayoutOptions.StartAndExpand,
//            };
//            _lblDate.SetBinding(Label.TextProperty, "DateString");

            _lblInfo = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Medium, this),
                Text              = "Rilassati! Non hai lezioni!",
                TextColor         = ColorHelper.Green500,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            _lblInfo.SetBinding(Label.IsVisibleProperty, new Binding("ListaLezioni", converter: new IsVisibleCountConverter()));
            updateLabelInfo();

            _listView = new ListView()
            {
                ItemTemplate    = new DataTemplate(typeof(OrarioFavCell)),
                VerticalOptions = LayoutOptions.FillAndExpand,
                SeparatorColor  = Color.Transparent,
                HasUnevenRows   = true,
            };
            _listView.SetBinding(ListView.ItemsSourceProperty, "ListaLezioni");
            _listView.ItemSelected += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
            };
//			_listView.ItemSelected += _listView_ItemSelected;

            _listUtenze = new ListView()
            {
                ItemTemplate  = new DataTemplate(typeof(UtenzaCell)),
                HasUnevenRows = true,
                //				VerticalOptions = LayoutOptions.Start,
                //				VerticalOptions = LayoutOptions.End,
                VerticalOptions = LayoutOptions.EndAndExpand,
                SeparatorColor  = Color.Transparent,
                IsEnabled       = false,
//				HeightRequest = 90,
            };
            _listUtenze.SetBinding(ListView.ItemsSourceProperty, "ListUtenza");
//			_listUtenze.SetBinding(Label.IsVisibleProperty, new Binding("ListUtenza", converter: new IsVisibleListUtenze()));
            _listUtenze.SetBinding(ListView.HeightRequestProperty, new Binding("ListUtenza", converter: new ListUtenzeHeight()));

            layoutListaUtenza = new StackLayout()
            {
                //				Padding = new Thickness(10, 10, 10, 10),
//				BackgroundColor = ColorHelper.White,
//				Orientation = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.EndAndExpand,
                //				Spacing = 5,
            };
            layoutListaUtenza.SetBinding(StackLayout.HeightRequestProperty, new Binding("ListUtenza", converter: new ListUtenzeHeight()));
            layoutListaUtenza.SetBinding(StackLayout.IsVisibleProperty, new Binding("ListUtenza", converter: new IsVisibleListUtenze()));
            layoutListaUtenza.Children.Add(_listUtenze);

            _lblTitleUtenza = new Label()
            {
                Text            = "USO UTENZA",
                FontSize        = Device.GetNamedSize(NamedSize.Small, this),
                VerticalOptions = LayoutOptions.EndAndExpand
            };
            _lblTitleUtenza.SetBinding(Label.IsVisibleProperty, new Binding("ListUtenza", converter: new IsVisibleUsoUtenza()));

            _lblUtenza = new Label()
            {
                FontSize        = Device.GetNamedSize(NamedSize.Small, this),
                VerticalOptions = LayoutOptions.EndAndExpand,
            };
            _lblUtenza.SetBinding(Label.TextProperty, "UsoUtenza");
            _lblTitleUtenza.SetBinding(Label.IsVisibleProperty, new Binding("ListUtenza", converter: new IsVisibleUsoUtenza()));


            //_activityIndicator = new ActivityIndicator()
            //{
            //    IsRunning = true,
            //    IsVisible = false,
            //    VerticalOptions = LayoutOptions.EndAndExpand,
            //};

//            var layoutUtenza = new StackLayout()
//            {
//				Padding = new Thickness(10, 10, 10, 10),
//                BackgroundColor = ColorHelper.White,
//                Orientation = StackOrientation.Horizontal,
//                VerticalOptions = LayoutOptions.EndAndExpand,
//                Spacing = 5,
//                Children = { _lblTitleUtenza, _lblUtenza }
//            };
//            layoutUtenza.SetBinding(Label.IsVisibleProperty, new Binding("ListUtenza", converter: new IsVisibleUsoUtenza()));


            var layout = new StackLayout()
            {
                Padding           = new Thickness(15, 10, 15, 10),
                Spacing           = 5,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          =
                {
//                    new StackLayout() {Padding = new Thickness(15, 10, 15, 10), BackgroundColor = ColorHelper.White, Orientation = StackOrientation.Horizontal, Spacing = 5, Children = {_lblDay, _lblDate}},
                    _lblInfo,
                    _listView,
                    layoutListaUtenza,
                    //_activityIndicator,
//                    layoutUtenza,
//					_listUtenze
                }
            };

            //MessagingCenter.Subscribe<TabbedHomeView, bool>(this, "sync", (sender, arg2) => {
            //	if (arg2)
            //		_activityIndicator.IsVisible = true;
            //	else
            //		_activityIndicator.IsVisible = false;
            //});

            var absolute = new AbsoluteLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            // Position the pageLayout to fill the entire screen.
            // Manage positioning of child elements on the page by editing the pageLayout.
            AbsoluteLayout.SetLayoutFlags(layout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(layout, new Rectangle(0f, 0f, 1f, 1f));
            absolute.Children.Add(layout);

            // Overlay the FAB in the bottom-right corner
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            absolute.Children.Add(fab);

            return(absolute);

//            return layout;
        }
コード例 #15
0
//		private ToolbarItem tbiShare;
        #endregion

        #region Private Methods

        private View getView()
        {
            fab = new FloatingActionButtonView()
            {
                ImageName    = "ic_sharee.png",
                ColorNormal  = ColorHelper.Blue500,
                ColorPressed = ColorHelper.Blue900,
                ColorRipple  = ColorHelper.Blue500,
                Size         = FloatingActionButtonSize.Normal,
                Clicked      = (sender, args) =>
                {
                    share();
                }
//				ColorNormal = Color.FromHex("ff3498db"),
//				ColorPressed = Color.Black,
//				ColorRipple = Color.FromHex("ff3498db")
            };

            var lblData = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Medium, this),
                TextColor         = ColorHelper.DarkBlue,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            lblData.SetBinding(Label.TextProperty, "DataString");

            var lblLaurea = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Medium, this),
                TextColor         = ColorHelper.DarkBlue,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            lblLaurea.SetBinding(Label.TextProperty, "LaureaString");

            lv = new ListView()
            {
                ItemTemplate    = new DataTemplate(typeof(OrarioGiornCell)),
                HasUnevenRows   = true,
                VerticalOptions = LayoutOptions.FillAndExpand,
                SeparatorColor  = Color.Transparent
            };
            lv.SetBinding(ListView.ItemsSourceProperty, "ListOrari");
            lv.ItemSelected += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
            };
//            lv.ItemSelected += lv_ItemSelected;

            var searchbar = new SearchBar()
            {
                Placeholder       = "Cerca",
                VerticalOptions   = LayoutOptions.EndAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            //searchbar.SearchButtonPressed += searchbar_SearchButtonPressed;
            searchbar.TextChanged += searchbar_TextChanged;

            var layoutLabel = new StackLayout()
            {
                BackgroundColor = ColorHelper.White,
                Spacing         = 0,
                Padding         = new Thickness(15, 10, 15, 10),
                Orientation     = StackOrientation.Vertical,
                Children        = { lblData, lblLaurea }
            };

            var l = new StackLayout()
            {
                Padding     = new Thickness(15, 10, 15, 10),
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    layoutLabel,
                    lv,
                    new StackLayout()
                    {
                        Children = { searchbar },BackgroundColor                   = Color.White
                    }
                }
            };

            tbiShowFav = new ToolbarItem("Mostra preferiti", "ic_nostar.png", showFavourites, 0, 0);
            tbiShowAll = new ToolbarItem("Mostra tutti", "ic_star.png", showAll, 0, 0);
//			tbiShare = new ToolbarItem ("Share", "ic_next.png", share, 0, 1);

            if (Settings.SuccessLogin)
            {
                ToolbarItems.Add(tbiShowFav);
            }
//			ToolbarItems.Add(tbiShare);
            //ToolbarItems.Add(tbiShowAll);


            var absolute = new AbsoluteLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            // Position the pageLayout to fill the entire screen.
            // Manage positioning of child elements on the page by editing the pageLayout.
            AbsoluteLayout.SetLayoutFlags(l, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(l, new Rectangle(0f, 0f, 1f, 1f));
            absolute.Children.Add(l);

            // Overlay the FAB in the bottom-right corner
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            absolute.Children.Add(fab);


//            return l;
            return(absolute);
        }
コード例 #16
0
        private void CreateLayout()
        {
            Title = "Second Page";


            var userList = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                ItemTemplate    = new DataTemplate(typeof(UserListCell)),
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowHeight       = 80,
                SelectedItem    = false
            };

            userList.SetBinding(ListView.ItemsSourceProperty, Binding.Create <UserListViewModel>(o => o.ListUsers));
            userList.ItemTapped += UserList_ItemTapped;


            var fab = new FloatingActionButtonView
            {
                Icon = "ic_add_white_24dp",
            };

            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            fab.Clicked += (o, e) =>
            {
                vm.GoToTabbedPageCommand.Execute(null);
            };

            var search = new StyledSearchBar
            {
                BackgroundColor   = App.StyleKit.PrimaryColor,
                TextColor         = App.StyleKit.TextColorPrimaryLight,
                CancelButtonColor = App.StyleKit.TextColorPrimaryLight,
                Placeholder       = "Search...",
                PlaceholderColor  = App.StyleKit.TextColorPrimaryLight,
            };

            search.SetBinding(SearchBar.TextProperty, Binding.Create <UserListViewModel>(o => o.SearchInput, BindingMode.TwoWay));
            search.SearchButtonPressed += Search_SearchButtonPressed;
            search.TextChanged         += Search_TextChanged;

            var pageLayout = new StackLayout
            {
                Children =
                {
                    search,
                    userList
                }
            };

            var absolute = new AbsoluteLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            AbsoluteLayout.SetLayoutFlags(pageLayout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(pageLayout, new Rectangle(0f, 0f, 1f, 1f));
            absolute.Children.Add(pageLayout);
            absolute.Children.Add(fab);

            Content = absolute;
        }
コード例 #17
0
 public void SetOnBackButtonPressed(FloatingActionButtonView view)
 {
     onBackActionElement = view;
 }
コード例 #18
0
        // Construction
        public DiaryDashboardPage()
        {
            _AuthenticationService = DependencyService.Get <IAuthenticationService>();

            this.SetBinding(Page.TitleProperty, new Binding()
            {
                Source = TextResources.DiaryDashboardPage_Title
            });

            var foodsChartView = new DiaryDashboardChartView()
            {
                BindingContext = _DiaryDashboardChartViewModel = new DiaryDashboardChartViewModel()
            };


            // Bind FoodsView to ViewModel and Populate the list
            var foodsView = new FoodsView
            {
                BindingContext =
                    _DiaryDashboardFoodsViewModel =
                        new DiaryDashboardFoodsViewModel(new Command(PushTabbedFoodPageAction))
            };

            _scrollView = new ScrollView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        foodsView
                    }
                }
            };

            _frameStackLayout = new StackLayout()
            {
                Spacing  = 0,
                Children =
                {
                    new Label()
                    {
                        Text           = "Diet Intake Summary",
                        FontSize       = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                        FontAttributes = FontAttributes.Bold
                    },
                    foodsChartView,
                    _scrollView
                }
            };


            if (Device.OS == TargetPlatform.Android)
            {
                _fab = new FloatingActionButtonView
                {
                    ImageName    = "fab_add.png",
                    ColorNormal  = Palette._001,
                    ColorPressed = Palette._002,
                    ColorRipple  = Palette._001,

                    Clicked = async(sender, args) =>
                    {
                        // When the + FAB is clicked. Load the database with Sample 8 Weeks worth of Data
                        DateTime now = DateTime.UtcNow;
                        for (int i = 0; i < 6; i++)
                        {
                            for (int j = 0; j < 7; j++)
                            {
                                now = now.AddDays(j);
                                DateTime today = DateTime.SpecifyKind(new DateTime(now.Year, now.Month, now.Day, 0, 0, 0), DateTimeKind.Utc);

                                var item = new FoodItem()
                                {
                                    Name        = $"TestItem week{i + 1} day{j + 1}",
                                    Calories    = 100 * j + 1,
                                    DateCreated = today.AddDays(j),
                                    Servings    = 1,
                                    MealType    = MealTypeOption.All
                                };

                                await App.UserUserAsyncDataService.SaveFoodAsync(item);
                            }
                        }
                    }
                };

                var absoluteLayout = new AbsoluteLayout
                {
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };
                // Position the pageLayout to fill the entire screen.
                // Manage positioning of child elements on the page by editing the pageLayout.
                AbsoluteLayout.SetLayoutFlags(_frameStackLayout, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(_frameStackLayout, new Rectangle(0f, 0f, 1f, 1f));
                absoluteLayout.Children.Add(_frameStackLayout);

                // Overlay the FAB in the bottom-right corner
                AbsoluteLayout.SetLayoutFlags(_fab, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(_fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                absoluteLayout.Children.Add(_fab);

                Content = absoluteLayout;
            }
            else
            {
                ToolbarItems.Add(new ToolbarItem("Add", "add_ios_gray", () =>
                {
                    _DiaryDashboardFoodsViewModel.PushTabbedFoodPageCommand.Execute(null);
                }));


                Content = _scrollView;
            }


            // Messaging for android devices
            Device.OnPlatform(
                Android: () => MessagingCenter.Subscribe <SplashPage>(this, MessagingServiceConstants.AUTHENTICATED,
                                                                      sender => OnAppearing()));
        }